Skip to content

Commit

Permalink
OCT-2139: Allocation AW Open E2E (#585)
Browse files Browse the repository at this point in the history
## Description

## 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
jmikolajczyk authored Dec 17, 2024
2 parents e5f720a + c3ff322 commit 2f800aa
Show file tree
Hide file tree
Showing 16 changed files with 472 additions and 59 deletions.
71 changes: 49 additions & 22 deletions client/cypress/e2e/_12homeGLMLock.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ Object.values(viewports).forEach(
});

beforeEach(() => {
cy.disconnectMetamaskWalletFromAllDapps();
mockCoinPricesServer();
localStorage.setItem(IS_ONBOARDING_ALWAYS_VISIBLE, 'false');
localStorage.setItem(IS_ONBOARDING_DONE, 'true');
localStorage.setItem(HAS_ONBOARDING_BEEN_CLOSED, 'true');
visitWithLoader(ROOT_ROUTES.home.absolute);
});

it('Title is visible and has correct text', () => {
it('Title is visible and has correct text', { scrollBehavior: false }, () => {
cy.get('[data-test=HomeGridCurrentGlmLock__title]').should('be.visible');
cy.get('[data-test=HomeGridCurrentGlmLock__title]')
.invoke('text')
.should('eq', 'Current GLM lock');
});

it('Main value is 0 (GLM/$) when wallet isn`t connected ', () => {
it('Main value is 0 (GLM/$) when wallet isn`t connected ', { scrollBehavior: false }, () => {
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary]')
.invoke('text')
.should('eq', '0 GLM');
Expand All @@ -47,16 +48,20 @@ Object.values(viewports).forEach(
.should('eq', '$0.00');
});

it('Effective value is 0 (GLM/$) when wallet isn`t connected ', () => {
cy.get('[data-test=HomeGridCurrentGlmLock__Section--effective__DoubleValue__primary]')
.invoke('text')
.should('eq', '0 GLM');
cy.get('[data-test=HomeGridCurrentGlmLock__Section--effective__DoubleValue__secondary]')
.invoke('text')
.should('eq', '$0.00');
});
it(
'Effective value is 0 (GLM/$) when wallet isn`t connected ',
{ scrollBehavior: false },
() => {
cy.get('[data-test=HomeGridCurrentGlmLock__Section--effective__DoubleValue__primary]')
.invoke('text')
.should('eq', '0 GLM');
cy.get('[data-test=HomeGridCurrentGlmLock__Section--effective__DoubleValue__secondary]')
.invoke('text')
.should('eq', '$0.00');
},
);

it('Effective label has a tooltip with correct text', () => {
it('Effective label has a tooltip with correct text', { scrollBehavior: false }, () => {
if (isLargeDesktop || isDesktop) {
cy.get('[data-test=TooltipEffectiveLockedBalance]').trigger('mouseover');
} else {
Expand All @@ -72,14 +77,18 @@ Object.values(viewports).forEach(
);
});

it('Button has "Lock GLM" text and is disabled when wallet isn`t connected', () => {
cy.get('[data-test=HomeGridCurrentGlmLock__Button]').should('be.disabled');
cy.get('[data-test=HomeGridCurrentGlmLock__Button]')
.invoke('text')
.should('eq', 'Lock GLM');
});
it(
'Button has "Lock GLM" text and is disabled when wallet isn`t connected',
{ scrollBehavior: false },
() => {
cy.get('[data-test=HomeGridCurrentGlmLock__Button]').should('be.disabled');
cy.get('[data-test=HomeGridCurrentGlmLock__Button]')
.invoke('text')
.should('eq', 'Lock GLM');
},
);

it('User is able to close Lock/Unlock GLM Modal', () => {
it('User is able to close Lock/Unlock GLM Modal', { scrollBehavior: false }, () => {
connectWallet({ isPatronModeEnabled: false });
cy.wait(5000);

Expand All @@ -95,14 +104,19 @@ Object.values(viewports).forEach(
cy.disconnectMetamaskWalletFromAllDapps();
});

it('Wallet connected: Lock 100 GLM', () => {
it('Wallet connected: Lock 1000 GLM', () => {
connectWallet({ isPatronModeEnabled: false });
cy.wait(5000);

cy.get('[data-test=HomeView]').scrollIntoView();
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary__DoubleValueSkeleton]').should(
'not.exist',
);
cy.wait(1000);
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary]')
.invoke('text')
.then(text => {
const amountToLock = 100;
const amountToLock = 1000;
const lockedGlms = parseInt(text, 10);

cy.get('[data-test=HomeGridCurrentGlmLock__Button]').click();
Expand All @@ -117,7 +131,6 @@ Object.values(viewports).forEach(
'Waiting for confirmation',
);
cy.confirmMetamaskPermissionToSpend({
shouldWaitForPopupClosure: true,
spendLimit: '99999999999999999999',
});
// Workaround for two notifications during first transaction.
Expand All @@ -136,6 +149,11 @@ Object.values(viewports).forEach(
cy.get('[data-test=LockGlmNotification--success]').should('be.visible');
cy.get('[data-test=LockGlmTabs__Button]').click();
cy.wait(5000);
cy.get('[data-test=HomeView]').scrollIntoView();
cy.get(
'[data-test=HomeGridCurrentGlmLock--current__primary__DoubleValueSkeleton]',
).should('not.exist');
cy.wait(1000);
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary]', {
timeout: 60000,
})
Expand Down Expand Up @@ -174,6 +192,11 @@ Object.values(viewports).forEach(
connectWallet({ isPatronModeEnabled: false });
cy.wait(5000);

cy.get('[data-test=HomeView]').scrollIntoView();
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary__DoubleValueSkeleton]').should(
'not.exist',
);
cy.wait(1000);
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary]')
.invoke('text')
.then(text => {
Expand All @@ -192,7 +215,6 @@ Object.values(viewports).forEach(
'Waiting for confirmation',
);
cy.confirmMetamaskPermissionToSpend({
shouldWaitForPopupClosure: true,
spendLimit: '99999999999999999999',
});
cy.get('[data-test=LockGlmTabs__Button]', { timeout: 60000 }).should(
Expand All @@ -202,6 +224,11 @@ Object.values(viewports).forEach(
cy.get('[data-test=LockGlmNotification--success]').should('be.visible');
cy.get('[data-test=LockGlmTabs__Button]').click();
cy.wait(5000);
cy.get('[data-test=HomeView]').scrollIntoView();
cy.get(
'[data-test=HomeGridCurrentGlmLock--current__primary__DoubleValueSkeleton]',
).should('not.exist');
cy.wait(1000);
cy.get('[data-test=HomeGridCurrentGlmLock--current__primary]', {
timeout: 60000,
})
Expand Down
8 changes: 4 additions & 4 deletions client/cypress/e2e/_13allocationAWClosed.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ Object.values(viewports).forEach(
});

it('User can`t reset allocation', () => {
cy.get('[data-test=AllocationNavigation__resetButton]').should('be.visible');
cy.get('[data-test=AllocationNavigation__resetButton]').should('be.disabled');
cy.get('[data-test=AllocationNavigation__Button--reset]').should('be.visible');
cy.get('[data-test=AllocationNavigation__Button--reset]').should('be.disabled');
});

it('User can`t confirm allocation', () => {
cy.get('[data-test=AllocationNavigation__ctaButton]').should('be.visible');
cy.get('[data-test=AllocationNavigation__ctaButton]').should('be.disabled');
cy.get('[data-test=AllocationNavigation__Button--cta]').should('be.visible');
cy.get('[data-test=AllocationNavigation__Button--cta]').should('be.disabled');
});
});
},
Expand Down
Loading

0 comments on commit 2f800aa

Please sign in to comment.