-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Check after [PR-567](#567) ## Definition of Done 1. [ ] If required, the desciption of your change is added to the [QA changelog](https://www.notion.so/octantapp/Changelog-for-the-QA-d96fa3b411cf488bb1d8d9a598d88281) 2. [ ] Acceptance criteria are met. 3. [ ] PR is manually tested before the merge by developer(s). - [ ] Happy path is manually checked. 4. [ ] PR is manually tested by QA when their assistance is required (1). - [ ] Octant Areas & Test Cases are checked for impact and updated if required (2). 5. [ ] Unit tests are added unless there is a reason to omit them. 6. [ ] Automated tests are added when required. 7. [ ] The code is merged. 8. [ ] Tech documentation is added / updated, reviewed and approved (including mandatory approval by a code owner, should such exist for changed files). - [ ] BE: Swagger documentation is updated. 9. [ ] When required by QA: - [ ] Deployed to the relevant environment. - [ ] Passed system tests. --- (1) Developer(s) in coordination with QA decide whether it's required. For small tickets introducing small changes QA assistance is most probably not required. (2) [Octant Areas & Test Cases](https://docs.google.com/spreadsheets/d/1cRe6dxuKJV3a4ZskAwWEPvrFkQm6rEfyUCYwLTYw_Cc).
- Loading branch information
Showing
15 changed files
with
234 additions
and
26 deletions.
There are no files selected for viewing
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
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
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,191 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import chaiColors from 'chai-colors'; | ||
|
||
import { mockCoinPricesServer, visitWithLoader } from 'cypress/utils/e2e'; | ||
import viewports from 'cypress/utils/viewports'; | ||
import { | ||
HAS_ONBOARDING_BEEN_CLOSED, | ||
IS_ONBOARDING_ALWAYS_VISIBLE, | ||
IS_ONBOARDING_DONE, | ||
} from 'src/constants/localStorageKeys'; | ||
import { ROOT_ROUTES } from 'src/routes/RootRoutes/routes'; | ||
|
||
chai.use(chaiColors); | ||
|
||
Object.values(viewports).forEach( | ||
({ device, viewportWidth, viewportHeight, isMobile, isTablet }) => { | ||
describe(`[AW IS OPEN] Metrics: ${device}`, { viewportHeight, viewportWidth }, () => { | ||
before(() => { | ||
cy.clearLocalStorage(); | ||
}); | ||
|
||
beforeEach(() => { | ||
mockCoinPricesServer(); | ||
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false'); | ||
localStorage.setItem(IS_ONBOARDING_DONE, 'true'); | ||
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true'); | ||
visitWithLoader(ROOT_ROUTES.metrics.absolute); | ||
}); | ||
|
||
it('Metrics title is visible and has correct text', () => { | ||
cy.get('[data-test=MetricsView__title]').should('be.visible'); | ||
cy.get('[data-test=MetricsView__title]').invoke('text').should('eq', 'Explore the data'); | ||
}); | ||
|
||
it('"Epoch" secion is visible', () => { | ||
cy.get('[data-test=MetricsEpoch]').should('be.visible'); | ||
}); | ||
|
||
it('"General" secion is visible', () => { | ||
cy.get('[data-test=MetricsGeneral]').should('be.visible'); | ||
}); | ||
|
||
it('"Epoch" section title is visible and has correct text', () => { | ||
cy.get('[data-test=MetricsEpochHeader__title]').should('be.visible'); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E3 Allocation' : 'Epoch 3 Allocation Window'); | ||
}); | ||
|
||
it('"General" section title is visible and has correct text', () => { | ||
cy.get('[data-test=MetricsGeneral__header__title]').should('be.visible'); | ||
cy.get('[data-test=MetricsGeneral__header__title]') | ||
.invoke('text') | ||
.should('eq', 'General metrics'); | ||
}); | ||
|
||
it('"Epoch" section title has "OPEN" badge when AW is open', () => { | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]').should('be.visible'); | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]').invoke('text').should('eq', 'Open'); | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]') | ||
.then($el => $el.css('backgroundColor')) | ||
.should('be.colored', '#2d9b87'); | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]') | ||
.then($el => $el.css('textTransform')) | ||
.should('eq', 'uppercase'); | ||
}); | ||
|
||
it('User is able to change epoch via arrow buttons', { scrollBehavior: false }, () => { | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows]').should('be.visible'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E2 Allocation' : 'Epoch 2 Allocation Window'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__rightArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E3 Allocation' : 'Epoch 3 Allocation Window'); | ||
}); | ||
|
||
it('"Epoch" section title has epoch dates range when epoch is past', () => { | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]').should('be.visible'); | ||
cy.get('[data-test=MetricsEpochHeader__epochDuration]').should('not.exist'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__openBadge]').should('not.exist'); | ||
cy.get('[data-test=MetricsEpochHeader__epochDuration]').should('be.visible'); | ||
}); | ||
|
||
it( | ||
'Next arrow button is disabled when there is no more next epochs', | ||
{ scrollBehavior: false }, | ||
() => { | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__rightArrow]') | ||
.then($el => $el.css('backgroundColor')) | ||
.should('be.colored', '#fafafa'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__rightArrowSvg] path') | ||
.then($el => $el.css('fill')) | ||
.should('be.colored', '#ebebeb'); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E3 Allocation' : 'Epoch 3 Allocation Window'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__rightArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E3 Allocation' : 'Epoch 3 Allocation Window'); | ||
}, | ||
); | ||
|
||
it( | ||
'Prev arrow button is disabled when there is no more prev epochs ', | ||
{ scrollBehavior: false }, | ||
() => { | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]') | ||
.then($el => $el.css('backgroundColor')) | ||
.should('be.colored', '#fafafa'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrowSvg] path') | ||
.then($el => $el.css('fill')) | ||
.should('be.colored', '#9ea39e'); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E3 Allocation' : 'Epoch 3 Allocation Window'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E1 Allocation' : 'Epoch 1 Allocation Window'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]') | ||
.then($el => $el.css('backgroundColor')) | ||
.should('be.colored', '#fafafa'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrowSvg] path') | ||
.then($el => $el.css('fill')) | ||
.should('be.colored', '#ebebeb'); | ||
cy.get('[data-test=MetricsEpochHeader__NavigationArrows__leftArrow]').click(); | ||
cy.get('[data-test=MetricsEpochHeader__title]') | ||
.invoke('text') | ||
.should('eq', isMobile || isTablet ? 'E1 Allocation' : 'Epoch 1 Allocation Window'); | ||
}, | ||
); | ||
|
||
it('All tiles in "Epoch" section are visible in correct order', () => { | ||
const metricsEpochGridTilesDataTest = [ | ||
'MetricsEpochGridTopProjects', | ||
'MetricsEpochGridFundsUsage', | ||
'MetricsEpochGridTotalUsers', | ||
'MetricsEpochGridPatrons', | ||
'MetricsEpochGridRewardsUnused', | ||
'MetricsEpochGridUnallocatedValue', | ||
'MetricsEpochGridTotalDonations', | ||
'MetricsEpochGridTotalMatchingFund', | ||
'MetricsEpochGridCurrentDonors', | ||
'MetricsEpochGridAverageLeverage', | ||
'MetricsEpochGridDonationsVsMatching', | ||
'MetricsEpochGridDonationsVsPersonalAllocations', | ||
]; | ||
|
||
cy.get('[data-test=MetricsEpoch__MetricsGrid]') | ||
.children() | ||
.should('have.length', metricsEpochGridTilesDataTest.length); | ||
|
||
for (let i = 0; i < metricsEpochGridTilesDataTest.length; i++) { | ||
cy.get('[data-test=MetricsEpoch__MetricsGrid]') | ||
.children() | ||
.eq(i) | ||
.invoke('data', 'test') | ||
.should('eq', metricsEpochGridTilesDataTest[i]); | ||
} | ||
}); | ||
|
||
it('All tiles in "General" section are visible in correct order', () => { | ||
const metricsGeneralGridTilesDataTest = [ | ||
'MetricsGeneralGridCumulativeGlmLocked', | ||
'MetricsGeneralGridWalletsWithGlmLocked', | ||
'MetricsGeneralGridTotalGlmLockedAndTotalSupply', | ||
'MetricsGeneralGridTotalProjects', | ||
'MetricsGeneralGridTotalEthStaked', | ||
]; | ||
|
||
cy.get('[data-test=MetricsGeneral__MetricsGrid]') | ||
.children() | ||
.should('have.length', metricsGeneralGridTilesDataTest.length); | ||
|
||
for (let i = 0; i < metricsGeneralGridTilesDataTest.length; i++) { | ||
cy.get('[data-test=MetricsGeneral__MetricsGrid]') | ||
.children() | ||
.eq(i) | ||
.invoke('data', 'test') | ||
.should('eq', metricsGeneralGridTilesDataTest[i]); | ||
} | ||
}); | ||
}); | ||
}, | ||
); |
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
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
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
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
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
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
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
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
Oops, something went wrong.