-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add highlight and scroll to group It can be useful to have a way to send a RepoSense link that automatically scrolls to and highlights the group that the sender thinks the recipient should pay attention to, saving them time to find the repo in question. Let's add this functionality to add convenience when sending around RepoSense reports.
- Loading branch information
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
frontend/cypress/tests/chartView/chartView_scrollToActiveRepo.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,62 @@ | ||
describe('scroll to active repo', () => { | ||
// need to set scrollBehavior to false because the default behavior is to scroll the element into view | ||
it('selecting a visible repo should not scroll', { scrollBehavior: false }, () => { | ||
// close the error message box | ||
cy.get('.error-message-box') | ||
.should('be.visible'); | ||
|
||
cy.get('#summary-wrapper > #summary > .error-message-box > .error-message-box__close-button') | ||
.click(); | ||
|
||
cy.get('.error-message-box') | ||
.should('not.be.visible'); | ||
|
||
cy.get('.icon-button.fa-code') | ||
.should('exist') | ||
.first(); | ||
|
||
let scrollTopOriginal = 0; | ||
cy.get('#summary-wrapper') | ||
.first() | ||
.then(($el) => { | ||
scrollTopOriginal = $el.prop('scrollTop'); | ||
}); | ||
|
||
cy.get('.icon-button.fa-code') | ||
.should('exist') | ||
.first() | ||
.click(); | ||
|
||
cy.get('#summary-wrapper') | ||
.first() | ||
.then(($el) => { | ||
const scrollTop = $el.prop('scrollTop'); | ||
expect(scrollTop).to.equal(scrollTopOriginal); | ||
}); | ||
}); | ||
|
||
it('selecting a non-visible repo should scroll', () => { | ||
cy.get('.icon-button.fa-code') | ||
.should('exist') | ||
.last() | ||
.click(); | ||
|
||
cy.get('#summary-wrapper') | ||
.first() | ||
.then(($el) => { | ||
const scrollTop = $el.prop('scrollTop'); | ||
expect(scrollTop).to.not.equal(0); | ||
}); | ||
|
||
cy.url() | ||
.should('contain', 'tabAuthor=yong24s') | ||
.should('contain', 'tabRepo=reposense%2FRepoSense%5Bcypress%5D'); | ||
|
||
cy.reload(); | ||
|
||
cy.get('.icon-button.fa-code') | ||
.should('exist') | ||
.last() | ||
.should('be.visible'); | ||
}); | ||
}); |
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