fix: disable UniswapX opt-out in e2e tests (#7423)
This commit is contained in:
parent
0381200fec
commit
53f0ca9b7e
@ -1,4 +1,5 @@
|
|||||||
import { ChainId, CurrencyAmount } from '@uniswap/sdk-core'
|
import { ChainId, CurrencyAmount } from '@uniswap/sdk-core'
|
||||||
|
import { FeatureFlag } from 'featureFlags'
|
||||||
|
|
||||||
import { DAI, nativeOnChain, USDC_MAINNET } from '../../../src/constants/tokens'
|
import { DAI, nativeOnChain, USDC_MAINNET } from '../../../src/constants/tokens'
|
||||||
import { getTestSelector } from '../../utils'
|
import { getTestSelector } from '../../utils'
|
||||||
@ -26,7 +27,9 @@ function stubSwapTxReceipt() {
|
|||||||
describe('UniswapX Toggle', () => {
|
describe('UniswapX Toggle', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept(QuoteEndpoint, { fixture: QuoteWhereUniswapXIsBetter })
|
cy.intercept(QuoteEndpoint, { fixture: 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 }],
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('only displays uniswapx ui when setting is on', () => {
|
it('only displays uniswapx ui when setting is on', () => {
|
||||||
@ -76,7 +79,9 @@ describe('UniswapX Orders', () => {
|
|||||||
stubSwapTxReceipt()
|
stubSwapTxReceipt()
|
||||||
|
|
||||||
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 }],
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can swap exact-in trades using uniswapX', () => {
|
it('can swap exact-in trades using uniswapX', () => {
|
||||||
@ -164,7 +169,9 @@ 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 }],
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can swap using uniswapX with ETH as input', () => {
|
it('can swap using uniswapX with ETH as input', () => {
|
||||||
@ -249,7 +256,9 @@ describe('UniswapX activity history', () => {
|
|||||||
cy.hardhat().then(async (hardhat) => {
|
cy.hardhat().then(async (hardhat) => {
|
||||||
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 }],
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can view UniswapX order status progress in activity', () => {
|
it('can view UniswapX order status progress in activity', () => {
|
||||||
|
@ -53,7 +53,7 @@ describe('Wallet Dropdown', () => {
|
|||||||
|
|
||||||
describe('should change locale with feature flag', () => {
|
describe('should change locale with feature flag', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.visit('/', { featureFlags: [FeatureFlag.currencyConversion] })
|
cy.visit('/', { featureFlags: [{ name: FeatureFlag.currencyConversion, value: true }] })
|
||||||
cy.get(getTestSelector('web3-status-connected')).click()
|
cy.get(getTestSelector('web3-status-connected')).click()
|
||||||
cy.get(getTestSelector('wallet-settings')).click()
|
cy.get(getTestSelector('wallet-settings')).click()
|
||||||
})
|
})
|
||||||
@ -147,19 +147,19 @@ describe('Wallet Dropdown', () => {
|
|||||||
|
|
||||||
describe('local currency', () => {
|
describe('local currency', () => {
|
||||||
it('loads local currency from the query param', () => {
|
it('loads local currency from the query param', () => {
|
||||||
cy.visit('/', { featureFlags: [FeatureFlag.currencyConversion] })
|
cy.visit('/', { featureFlags: [{ name: FeatureFlag.currencyConversion, value: true }] })
|
||||||
cy.get(getTestSelector('web3-status-connected')).click()
|
cy.get(getTestSelector('web3-status-connected')).click()
|
||||||
cy.get(getTestSelector('wallet-settings')).click()
|
cy.get(getTestSelector('wallet-settings')).click()
|
||||||
cy.contains('USD')
|
cy.contains('USD')
|
||||||
|
|
||||||
cy.visit('/?cur=AUD', { featureFlags: [FeatureFlag.currencyConversion] })
|
cy.visit('/?cur=AUD', { featureFlags: [{ name: FeatureFlag.currencyConversion, value: true }] })
|
||||||
cy.get(getTestSelector('web3-status-connected')).click()
|
cy.get(getTestSelector('web3-status-connected')).click()
|
||||||
cy.get(getTestSelector('wallet-settings')).click()
|
cy.get(getTestSelector('wallet-settings')).click()
|
||||||
cy.contains('AUD')
|
cy.contains('AUD')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('loads local currency from menu', () => {
|
it('loads local currency from menu', () => {
|
||||||
cy.visit('/', { featureFlags: [FeatureFlag.currencyConversion] })
|
cy.visit('/', { featureFlags: [{ name: FeatureFlag.currencyConversion, value: true }] })
|
||||||
cy.get(getTestSelector('web3-status-connected')).click()
|
cy.get(getTestSelector('web3-status-connected')).click()
|
||||||
cy.get(getTestSelector('wallet-settings')).click()
|
cy.get(getTestSelector('wallet-settings')).click()
|
||||||
cy.contains('USD')
|
cy.contains('USD')
|
||||||
|
@ -24,7 +24,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
interface VisitOptions {
|
interface VisitOptions {
|
||||||
serviceWorker?: true
|
serviceWorker?: true
|
||||||
featureFlags?: Array<FeatureFlag>
|
featureFlags?: Array<{ name: FeatureFlag; value: boolean }>
|
||||||
/**
|
/**
|
||||||
* Initial user state.
|
* Initial user state.
|
||||||
* @default {@type import('../utils/user-state').CONNECTED_WALLET_USER_STATE}
|
* @default {@type import('../utils/user-state').CONNECTED_WALLET_USER_STATE}
|
||||||
@ -59,7 +59,10 @@ Cypress.Commands.overwrite(
|
|||||||
|
|
||||||
// Set feature flags, if configured.
|
// Set feature flags, if configured.
|
||||||
if (options?.featureFlags) {
|
if (options?.featureFlags) {
|
||||||
const featureFlags = options.featureFlags.reduce((flags, flag) => ({ ...flags, [flag]: 'enabled' }), {})
|
const featureFlags = options.featureFlags.reduce(
|
||||||
|
(flags, flag) => ({ ...flags, [flag.name]: flag.value ? 'enabled' : 'control' }),
|
||||||
|
{}
|
||||||
|
)
|
||||||
win.localStorage.setItem('featureFlags', JSON.stringify(featureFlags))
|
win.localStorage.setItem('featureFlags', JSON.stringify(featureFlags))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user