Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into kacper/chore/oct-2…
Browse files Browse the repository at this point in the history
…262-align-time-threshold-for-sablier
  • Loading branch information
kgarbacinski committed Dec 20, 2024
2 parents 02ab38b + 579b2b7 commit 567b775
Show file tree
Hide file tree
Showing 39 changed files with 1,551 additions and 112 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
11 changes: 7 additions & 4 deletions client/cypress/e2e/_13allocationAWClosed.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Object.values(viewports).forEach(
});

it('if user resize viewport from large-desktop/desktop to tablet/mobile allocation drawer will hide and current view will change to Allocation view.', () => {
cy.wait(1000);
// mobile
cy.viewport(viewports.mobile.viewportWidth, viewports.mobile.viewportHeight);
cy.get('[data-test=AllocationDrawer]').should('not.exist');
Expand All @@ -50,6 +51,7 @@ Object.values(viewports).forEach(
});

it('If user resize viewport from large-desktop/desktop to tablet/mobile when allocation drawer was open and then change view and resize again to large/desktop allocation drawer won`t be visible.', () => {
cy.wait(1000);
// mobile
cy.viewport(viewports.mobile.viewportWidth, viewports.mobile.viewportHeight);
cy.get('[data-test=LayoutNavbar__Button--projects]').click();
Expand Down Expand Up @@ -80,6 +82,7 @@ Object.values(viewports).forEach(
});

it('if user resize viewport from tablet/mobile to large-desktop/desktop allocation view will change to the last opened or Home view and Allocation drawer will be visible.', () => {
cy.wait(1000);
// desktop
cy.viewport(viewports.desktop.viewportWidth, viewports.desktop.viewportHeight);
cy.get('[data-test=AllocationDrawer]').should('be.visible');
Expand Down Expand Up @@ -152,13 +155,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 567b775

Please sign in to comment.