Skip to content
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

OCT-2139: Allocation AW Open E2E #585

Merged
merged 12 commits into from
Dec 17, 2024
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