-
Notifications
You must be signed in to change notification settings - Fork 154
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
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7c71ca6
Add tests for segment css
sopa301 87e0304
Fix style
sopa301 3fa0676
Fix style
sopa301 3fbe48b
Fix date to 2021
sopa301 51c2d69
Revert changes
sopa301 1904414
Specify correct colours for highlighting test
sopa301 e8f820c
Add transparency values
sopa301 23a334d
Merge branch 'master' into 2136-highlighting-test
sopa301 00fae2f
Merge branch 'master' of https://github.com/sopa301/RepoSense into 21…
sopa301 1c88cdf
Merge branch '2136-highlighting-test' of https://github.com/sopa301/R…
sopa301 d8d4319
Change var name
sopa301 b4eaaa3
Fix not visible buttons failing tests
sopa301 ff15f8a
Merge branch 'master' of https://github.com/sopa301/RepoSense into 21…
sopa301 dde2f9b
Merge branch 'master' into 2136-highlighting-test
sopa301 3158569
Merge branch 'master' into 2136-highlighting-test
sopa301 32e2d4c
Merge branch 'master' into 2136-highlighting-test
sopa301 7b98ab1
Merge branch 'master' into 2136-highlighting-test
sopa301 306cc2b
Merge branch 'master' of https://github.com/reposense/RepoSense into …
sopa301 c51dc67
Merge branch 'master' into 2136-highlighting-test
sopa301 9f9e4a0
Merge branch 'master' into 2136-highlighting-test
ckcherry23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
frontend/cypress/tests/codeView/codeView_codeHighlighting.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// 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') | ||
.and('not.eq', 'rgb(255, 255, 255)') // #ffffff | ||
.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 | ||
.should('have.css', 'background-color') | ||
.and('not.eq', color) | ||
.and('not.eq', 'rgb(255, 255, 255)'); | ||
}); | ||
}); | ||
|
||
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 | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the background color used is always consistently chosen, is it not possible to check for the exact color here instead of checking for not white?
Doing this would make the test case more robust, ensuring the merged group code is highlighted based on author's color and not all just green.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out! I went to look at how the colours are generated (in
c-authorship.vue
) and it turns out that the first 10 colours are consistently chosen, while the 11th onward is randomly generated. I'll amend the code since we're only testing the first two colours.