From 1feeaea1812333072d083c75c0bed36a6e7d01cf Mon Sep 17 00:00:00 2001 From: eddie <66155195+just-toby@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:13:57 -0800 Subject: [PATCH] test: update e2e tests after X rollout (#7583) test: updatea e2e tests after X rollout --- cypress/e2e/swap/uniswapx.test.ts | 53 +++---------------------------- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/cypress/e2e/swap/uniswapx.test.ts b/cypress/e2e/swap/uniswapx.test.ts index fa5e358b1c..c282568c2e 100644 --- a/cypress/e2e/swap/uniswapx.test.ts +++ b/cypress/e2e/swap/uniswapx.test.ts @@ -46,7 +46,7 @@ describe('UniswapX Toggle', () => { beforeEach(() => { stubNonPriceQuoteWith(QuoteWhereUniswapXIsBetter) cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, { - featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: false }], + featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: true }], }) }) @@ -55,39 +55,9 @@ describe('UniswapX Toggle', () => { cy.get('#swap-currency-input .token-amount-input').type('300') cy.wait('@quote') - // UniswapX UI should not be visible - cy.get(getTestSelector('gas-estimate-uniswapx-icon')).should('not.exist') - - // Opt-in to UniswapX - cy.contains('Try it now').click() - // UniswapX UI should be visible cy.get(getTestSelector('gas-estimate-uniswapx-icon')).should('exist') }) - - it('prompts opt-in if UniswapX is better', () => { - // Setup a swap - cy.get('#swap-currency-input .token-amount-input').type('300') - cy.wait('@quote') - - // UniswapX should not display in gas estimate row before opt-in - cy.get(getTestSelector('gas-estimate-uniswapx-icon')).should('not.exist') - - // UniswapX mustache should be visible - cy.contains('Try it now').click() - - // Opt-in dialog should now be hidden - cy.contains('Try it now').should('not.be.visible') - - // UniswapX should display in gas estimate row - cy.get(getTestSelector('gas-estimate-uniswapx-icon')).should('exist') - - // Opt-in dialog should not reappear if user manually toggles UniswapX off - cy.get(getTestSelector('open-settings-dialog-button')).click() - cy.get(getTestSelector('toggle-uniswap-x-button')).click() - cy.get(getTestSelector('open-settings-dialog-button')).click() - cy.contains('Try it now').should('not.be.visible') - }) }) describe('UniswapX Orders', () => { @@ -100,7 +70,7 @@ describe('UniswapX Orders', () => { cy.hardhat().then((hardhat) => hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8))) cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, { - featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: false }], + featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: true }], }) }) @@ -109,8 +79,6 @@ describe('UniswapX Orders', () => { cy.get('#swap-currency-input .token-amount-input').type('300') cy.wait('@quote') - cy.contains('Try it now').click() - // Submit uniswapx order signature cy.get('#swap-button').click() cy.contains('Confirm swap').click() @@ -130,8 +98,6 @@ describe('UniswapX Orders', () => { cy.get('#swap-currency-output .token-amount-input').type('300') cy.wait('@quote') - cy.contains('Try it now').click() - // Submit uniswapx order signature cy.get('#swap-button').click() cy.contains('Confirm swap').click() @@ -151,8 +117,6 @@ describe('UniswapX Orders', () => { cy.get('#swap-currency-input .token-amount-input').type('300') cy.wait('@quote') - cy.contains('Try it now').click() - // Submit uniswapx order signature cy.get('#swap-button').click() cy.contains('Confirm swap').click() @@ -169,8 +133,6 @@ describe('UniswapX Orders', () => { cy.get('#swap-currency-input .token-amount-input').type('300') cy.wait('@quote') - cy.contains('Try it now').click() - // Submit uniswapx order signature cy.get('#swap-button').click() cy.contains('Confirm swap').click() @@ -198,7 +160,7 @@ describe('UniswapX Eth Input', () => { stubSwapTxReceipt() cy.visit(`/swap/?inputCurrency=ETH&outputCurrency=${DAI.address}`, { - featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: false }], + featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: true }], }) }) @@ -207,7 +169,6 @@ describe('UniswapX Eth Input', () => { cy.get('#swap-currency-input .token-amount-input').type('1') cy.wait('@quote') - cy.contains('Try it now').click() // Prompt ETH wrap to use for order cy.get('#swap-button').click() @@ -241,8 +202,6 @@ describe('UniswapX Eth Input', () => { cy.get('#swap-currency-input .token-amount-input').type('1') cy.wait('@quote') - cy.contains('Try it now').click() - // Prompt ETH wrap and confirm cy.get('#swap-button').click() cy.contains('Confirm swap').click() @@ -289,14 +248,13 @@ describe('UniswapX activity history', () => { await hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8)) }) cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, { - featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: false }], + featureFlags: [{ name: FeatureFlag.uniswapXDefaultEnabled, value: true }], }) }) it('can view UniswapX order status progress in activity', () => { // Setup a swap cy.get('#swap-currency-input .token-amount-input').type('300') - cy.contains('Try it now').click() // Submit uniswapx order signature cy.get('#swap-button').click() @@ -324,7 +282,6 @@ describe('UniswapX activity history', () => { it('can view UniswapX order status progress in activity upon expiry', () => { // Setup a swap cy.get('#swap-currency-input .token-amount-input').type('300') - cy.contains('Try it now').click() // Submit uniswapx order signature cy.get('#swap-button').click() @@ -351,7 +308,6 @@ describe('UniswapX activity history', () => { it('deduplicates remote vs local uniswapx orders', () => { // Setup a swap cy.get('#swap-currency-input .token-amount-input').type('300') - cy.contains('Try it now').click() // Submit uniswapx order signature cy.get('#swap-button').click() @@ -383,7 +339,6 @@ describe('UniswapX activity history', () => { it('balances should refetch after uniswapx swap', () => { // Setup a swap cy.get('#swap-currency-input .token-amount-input').type('300') - cy.contains('Try it now').click() const gqlSpy = cy.spy().as('gqlSpy') cy.intercept(/graphql/, (req) => {