test: update e2e tests after X rollout (#7583)
test: updatea e2e tests after X rollout
This commit is contained in:
parent
7b10c94e4d
commit
1feeaea181
@ -46,7 +46,7 @@ describe('UniswapX Toggle', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
stubNonPriceQuoteWith(QuoteWhereUniswapXIsBetter)
|
stubNonPriceQuoteWith(QuoteWhereUniswapXIsBetter)
|
||||||
cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, {
|
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.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.wait('@quote')
|
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
|
// UniswapX UI should be visible
|
||||||
cy.get(getTestSelector('gas-estimate-uniswapx-icon')).should('exist')
|
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', () => {
|
describe('UniswapX Orders', () => {
|
||||||
@ -100,7 +70,7 @@ describe('UniswapX Orders', () => {
|
|||||||
|
|
||||||
cy.hardhat().then((hardhat) => hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8)))
|
cy.hardhat().then((hardhat) => hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8)))
|
||||||
cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, {
|
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.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
|
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
cy.contains('Confirm swap').click()
|
cy.contains('Confirm swap').click()
|
||||||
@ -130,8 +98,6 @@ describe('UniswapX Orders', () => {
|
|||||||
cy.get('#swap-currency-output .token-amount-input').type('300')
|
cy.get('#swap-currency-output .token-amount-input').type('300')
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
|
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
cy.contains('Confirm swap').click()
|
cy.contains('Confirm swap').click()
|
||||||
@ -151,8 +117,6 @@ describe('UniswapX Orders', () => {
|
|||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
|
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
cy.contains('Confirm swap').click()
|
cy.contains('Confirm swap').click()
|
||||||
@ -169,8 +133,6 @@ describe('UniswapX Orders', () => {
|
|||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
|
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
cy.contains('Confirm swap').click()
|
cy.contains('Confirm swap').click()
|
||||||
@ -198,7 +160,7 @@ describe('UniswapX Eth Input', () => {
|
|||||||
stubSwapTxReceipt()
|
stubSwapTxReceipt()
|
||||||
|
|
||||||
cy.visit(`/swap/?inputCurrency=ETH&outputCurrency=${DAI.address}`, {
|
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.get('#swap-currency-input .token-amount-input').type('1')
|
||||||
|
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Prompt ETH wrap to use for order
|
// Prompt ETH wrap to use for order
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
@ -241,8 +202,6 @@ describe('UniswapX Eth Input', () => {
|
|||||||
cy.get('#swap-currency-input .token-amount-input').type('1')
|
cy.get('#swap-currency-input .token-amount-input').type('1')
|
||||||
cy.wait('@quote')
|
cy.wait('@quote')
|
||||||
|
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Prompt ETH wrap and confirm
|
// Prompt ETH wrap and confirm
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
cy.contains('Confirm swap').click()
|
cy.contains('Confirm swap').click()
|
||||||
@ -289,14 +248,13 @@ describe('UniswapX activity history', () => {
|
|||||||
await hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8))
|
await hardhat.fund(hardhat.wallet, CurrencyAmount.fromRawAmount(USDC_MAINNET, 3e8))
|
||||||
})
|
})
|
||||||
cy.visit(`/swap/?inputCurrency=${USDC_MAINNET.address}&outputCurrency=${DAI.address}`, {
|
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', () => {
|
it('can view UniswapX order status progress in activity', () => {
|
||||||
// Setup a swap
|
// Setup a swap
|
||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
@ -324,7 +282,6 @@ describe('UniswapX activity history', () => {
|
|||||||
it('can view UniswapX order status progress in activity upon expiry', () => {
|
it('can view UniswapX order status progress in activity upon expiry', () => {
|
||||||
// Setup a swap
|
// Setup a swap
|
||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
@ -351,7 +308,6 @@ describe('UniswapX activity history', () => {
|
|||||||
it('deduplicates remote vs local uniswapx orders', () => {
|
it('deduplicates remote vs local uniswapx orders', () => {
|
||||||
// Setup a swap
|
// Setup a swap
|
||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
// Submit uniswapx order signature
|
// Submit uniswapx order signature
|
||||||
cy.get('#swap-button').click()
|
cy.get('#swap-button').click()
|
||||||
@ -383,7 +339,6 @@ describe('UniswapX activity history', () => {
|
|||||||
it('balances should refetch after uniswapx swap', () => {
|
it('balances should refetch after uniswapx swap', () => {
|
||||||
// Setup a swap
|
// Setup a swap
|
||||||
cy.get('#swap-currency-input .token-amount-input').type('300')
|
cy.get('#swap-currency-input .token-amount-input').type('300')
|
||||||
cy.contains('Try it now').click()
|
|
||||||
|
|
||||||
const gqlSpy = cy.spy().as('gqlSpy')
|
const gqlSpy = cy.spy().as('gqlSpy')
|
||||||
cy.intercept(/graphql/, (req) => {
|
cy.intercept(/graphql/, (req) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user