Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2136] Add Tests for Segment CSS #2137

Merged
merged 20 commits into from
Apr 18, 2024
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions frontend/cypress/tests/codeView/codeView_codeHighlighting.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Assumes: RepoSense repo from 03/05/2018 to current date
describe('code highlighting works properly', () => {
it('should highlight code when there is a single author', () => {
// open the code panel
cy.get('.icon-button.fa-code')
.should('be.visible')
.first()
.click();

cy.get('#tab-authorship .files', { timeout: 90000 })
.should('be.visible');

cy.get('.hljs-comment').contains('* Represents a Git Author.')
.parent() // .line-content
.parent() // .code
.should('have.css', 'background-color', 'rgb(230, 255, 237)'); // #e6ffed
});

it('should highlight code when multiple authors are merged in a repo group', () => {
cy.get('div.mui-select.grouping > select:visible')
.select('groupByRepos');

cy.get('#summary label.merge-group > input:visible')
.should('be.visible')
.check()
.should('be.checked');

// open the code panel
cy.get('.icon-button.fa-code')
.should('be.visible')
.first()
.click();

cy.get('#tab-authorship .files', { timeout: 90000 })
.should('be.visible');

cy.get('.hljs-comment').contains('* MUI Colors module') // eugenepeh
.parent() // .line-content
.parent() // .code
.should('have.css', 'background-color', 'rgba(30, 144, 255, 0.19)') // #1e90ff, transparencyValue 30
.then((color) => {
sopa301 marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-next-line quotes
cy.get('.line-content').contains("'red': (") // jamessspanggg
.parent() // .code
// #f08080, transparencyValue 30
.should('have.css', 'background-color', 'rgba(240, 128, 128, 0.19)')
.and('not.eq', color);
});
});

it('should not highlight non-attributed lines', () => {
// open the code panel
cy.get('.icon-button.fa-code')
.should('be.visible')
.first()
.click();

cy.get('#tab-authorship .files', { timeout: 90000 })
.should('be.visible');

cy.get('.hljs-title').contains('Author')
.parent() // .hljs-class
.parent() // .line-content
.parent() // .code
.should('have.css', 'background-color', 'rgb(255, 255, 255)'); // #ffffff
});
});
Loading