Skip to content

Commit

Permalink
OCT-1396: Implement an onscreen route back to onboarding if users acc…
Browse files Browse the repository at this point in the history
…identally close it (#164)

## Description

## Definition of Done

1. [ ] Acceptance criteria are met.
2. [ ] PR is manually tested before the merge by developer(s).
    - [ ] Happy path is manually checked.
3. [ ] 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).
4. [ ] Unit tests are added unless there is a reason to omit them.
5. [ ] Automated tests are added when required.
6. [ ] The code is merged.
7. [ ] 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.
8. [ ] 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
jmikolajczyk authored May 8, 2024
2 parents 4b6a4d0 + a456021 commit e0a95e5
Show file tree
Hide file tree
Showing 37 changed files with 1,094 additions and 493 deletions.
7 changes: 6 additions & 1 deletion client/cypress/e2e/_2makePendingSnapshot.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { mockCoinPricesServer, visitWithLoader } from 'cypress/utils/e2e';
import { mutateAsyncMakeSnapshot } from 'cypress/utils/moveTime';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
import {
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
import { ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

// In E2E snapshotter is disabled. Before the first test can be run, pending snapshot needs to be done.
Expand All @@ -19,6 +23,7 @@ describe('Make pending snapshot', () => {
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
visitWithLoader(ROOT_ROUTES.playground.absolute);
});

Expand Down
2 changes: 2 additions & 0 deletions client/cypress/e2e/allocationItemWindowClosed.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import viewports from 'cypress/utils/viewports';
import { QUERY_KEYS } from 'src/api/queryKeys';
import {
ALLOCATION_ITEMS_KEY,
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
Expand Down Expand Up @@ -57,6 +58,7 @@ describe('allocation (allocation window closed)', () => {
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
localStorage.setItem(ALLOCATION_ITEMS_KEY, '[]');
visitWithLoader(ROOT_ROUTES.projects.absolute);

Expand Down
2 changes: 2 additions & 0 deletions client/cypress/e2e/allocationItemWindowOpen.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import viewports from 'cypress/utils/viewports';
import { QUERY_KEYS } from 'src/api/queryKeys';
import {
ALLOCATION_ITEMS_KEY,
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
Expand Down Expand Up @@ -64,6 +65,7 @@ describe('allocation (allocation window open)', () => {
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
localStorage.setItem(ALLOCATION_ITEMS_KEY, '[]');
visitWithLoader(ROOT_ROUTES.projects.absolute);
connectWallet(true, false);
Expand Down
8 changes: 7 additions & 1 deletion client/cypress/e2e/allocationRewardsBox.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import chaiColors from 'chai-colors';

import { visitWithLoader, mockCoinPricesServer, connectWallet } from 'cypress/utils/e2e';
import viewports from 'cypress/utils/viewports';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
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);
Expand All @@ -16,6 +20,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
beforeEach(() => {
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
visitWithLoader(ROOT_ROUTES.allocation.absolute);
});

Expand Down Expand Up @@ -108,6 +113,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
visitWithLoader(ROOT_ROUTES.allocation.absolute);
cy.intercept('GET', '/rewards/budget/*/epoch/*', { body: { budget: '10000000000' } });
connectWallet(true, false);
Expand Down
35 changes: 15 additions & 20 deletions client/cypress/e2e/earn.cy.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { visitWithLoader, mockCoinPricesServer } from 'cypress/utils/e2e';
import { visitWithLoader, mockCoinPricesServer, connectWallet } from 'cypress/utils/e2e';
import { moveTime } from 'cypress/utils/moveTime';
import viewports from 'cypress/utils/viewports';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
import {
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
import { ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

import Chainable = Cypress.Chainable;

const connectWallet = (): Chainable => {
cy.intercept('GET', '/user/*/tos', { body: { accepted: true } });
cy.get('[data-test=MainLayout__Button--connect]').click();
cy.get('[data-test=ConnectWallet__BoxRounded--browserWallet]').click();
cy.acceptMetamaskAccess();
return cy.switchToCypressWindow();
};

Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDesktop }, idx) => {
describe(`earn: ${device}`, { viewportHeight, viewportWidth }, () => {
before(() => {
Expand All @@ -30,6 +24,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
visitWithLoader(ROOT_ROUTES.earn.absolute);
});

Expand Down Expand Up @@ -73,18 +68,18 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
}

it('Wallet connected: "Lock GLM" / "Edit Locked GLM" button is active', () => {
connectWallet();
connectWallet(true, false);
cy.get('[data-test=BoxGlmLock__Button]').should('not.be.disabled');
});

it('Wallet connected: "Lock GLM" / "Edit Locked GLM" button opens "ModalGlmLock"', () => {
connectWallet();
connectWallet(true, false);
cy.get('[data-test=BoxGlmLock__Button]').click();
cy.get('[data-test=ModalGlmLock]').should('be.visible');
});

it('Wallet connected: "ModalGlmLock" has overflow', () => {
connectWallet();
connectWallet(true, false);
cy.get('[data-test=BoxGlmLock__Button]').click();
cy.get('[data-test=ModalGlmLock__overflow]').should('exist');
});
Expand All @@ -94,7 +89,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
* In EarnGlmLock there are multiple autofocus rules set.
* This test checks if user is still able to type without any autofocus disruption.
*/
connectWallet();
connectWallet(true, false);
cy.get('[data-test=BoxGlmLock__Button]').click();
cy.get('[data-test=ModalGlmLock]').should('be.visible');
cy.get('[data-test=InputsCryptoFiat__InputText--crypto]').should('have.focus');
Expand All @@ -106,7 +101,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
});

it('Wallet connected: "ModalGlmLock" - changing tabs keep focus on first input', () => {
connectWallet();
connectWallet(true, false);
cy.get('[data-test=BoxGlmLock__Button]').click();
cy.get('[data-test=ModalGlmLock]').should('be.visible');
cy.get('[data-test=InputsCryptoFiat__InputText--crypto]').should('have.focus');
Expand All @@ -117,7 +112,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
});

it('Wallet connected: Lock 1 GLM', () => {
connectWallet();
connectWallet(true, false);

cy.get('[data-test=BoxGlmLock__Section--current__DoubleValue__primary]')
.invoke('text')
Expand Down Expand Up @@ -169,7 +164,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
});

it('Wallet connected: Unlock 1 GLM', () => {
connectWallet();
connectWallet(true, false);

cy.get('[data-test=BoxGlmLock__Section--current__DoubleValue__primary]')
.invoke('text')
Expand Down Expand Up @@ -216,7 +211,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
});

it('Wallet connected: Effective deposit after locking 1000 GLM and moving epoch is equal to current deposit', () => {
connectWallet();
connectWallet(true, false);

cy.get('[data-test=BoxGlmLock__Section--current__DoubleValue__primary]')
.invoke('text')
Expand Down
7 changes: 6 additions & 1 deletion client/cypress/e2e/layout.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { navigateWithCheck, mockCoinPricesServer } from 'cypress/utils/e2e';
import viewports from 'cypress/utils/viewports';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
import {
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
import { navigationTabs } from 'src/constants/navigationTabs/navigationTabs';
import { ROOT, ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

Expand All @@ -16,6 +20,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight }) =>
cy.disconnectMetamaskWalletFromAllDapps();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
cy.visit(ROOT.absolute);
});

Expand Down
7 changes: 6 additions & 1 deletion client/cypress/e2e/metrics.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { mockCoinPricesServer, visitWithLoader } from 'cypress/utils/e2e';
import viewports from 'cypress/utils/viewports';
import { IS_ONBOARDING_ALWAYS_VISIBLE, IS_ONBOARDING_DONE } from 'src/constants/localStorageKeys';
import {
HAS_ONBOARDING_BEEN_CLOSED,
IS_ONBOARDING_ALWAYS_VISIBLE,
IS_ONBOARDING_DONE,
} from 'src/constants/localStorageKeys';
import { ROOT_ROUTES } from 'src/routes/RootRoutes/routes';

Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDesktop }) => {
Expand All @@ -18,6 +22,7 @@ Object.values(viewports).forEach(({ device, viewportWidth, viewportHeight, isDes
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);
});

Expand Down
Loading

0 comments on commit e0a95e5

Please sign in to comment.