Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
53f0ca9b
Unverified
Commit
53f0ca9b
authored
Oct 05, 2023
by
eddie
Committed by
GitHub
Oct 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: disable UniswapX opt-out in e2e tests (#7423)
parent
0381200f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
uniswapx.test.ts
cypress/e2e/swap/uniswapx.test.ts
+13
-4
wallet-dropdown.test.ts
cypress/e2e/wallet-dropdown.test.ts
+4
-4
commands.ts
cypress/support/commands.ts
+5
-2
No files found.
cypress/e2e/swap/uniswapx.test.ts
View file @
53f0ca9b
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() {
...
@@ -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', () => {
...
@@ -76,7 +79,9 @@ describe('UniswapX Orders', () => {
stubSwapTxReceipt
()
stubSwapTxReceipt
()
cy
.
hardhat
().
then
((
hardhat
)
=>
hardhat
.
fund
(
hardhat
.
wallet
,
CurrencyAmount
.
fromRawAmount
(
USDC_MAINNET
,
3
e8
)))
cy
.
hardhat
().
then
((
hardhat
)
=>
hardhat
.
fund
(
hardhat
.
wallet
,
CurrencyAmount
.
fromRawAmount
(
USDC_MAINNET
,
3
e8
)))
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', () => {
...
@@ -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', () => {
...
@@ -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
,
3
e8
))
await
hardhat
.
fund
(
hardhat
.
wallet
,
CurrencyAmount
.
fromRawAmount
(
USDC_MAINNET
,
3
e8
))
})
})
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
'
,
()
=>
{
...
...
cypress/e2e/wallet-dropdown.test.ts
View file @
53f0ca9b
...
@@ -53,7 +53,7 @@ describe('Wallet Dropdown', () => {
...
@@ -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', () => {
...
@@ -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
'
)
...
...
cypress/support/commands.ts
View file @
53f0ca9b
...
@@ -24,7 +24,7 @@ declare global {
...
@@ -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(
...
@@ -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
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment