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
1feeaea1
Unverified
Commit
1feeaea1
authored
Nov 14, 2023
by
eddie
Committed by
GitHub
Nov 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: update e2e tests after X rollout (#7583)
test: updatea e2e tests after X rollout
parent
7b10c94e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
49 deletions
+4
-49
uniswapx.test.ts
cypress/e2e/swap/uniswapx.test.ts
+4
-49
No files found.
cypress/e2e/swap/uniswapx.test.ts
View file @
1feeaea1
...
@@ -46,7 +46,7 @@ describe('UniswapX Toggle', () => {
...
@@ -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
:
fals
e
}],
featureFlags
:
[{
name
:
FeatureFlag
.
uniswapXDefaultEnabled
,
value
:
tru
e
}],
})
})
})
})
...
@@ -55,39 +55,9 @@ describe('UniswapX Toggle', () => {
...
@@ -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', () => {
...
@@ -100,7 +70,7 @@ describe('UniswapX Orders', () => {
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
:
fals
e
}],
featureFlags
:
[{
name
:
FeatureFlag
.
uniswapXDefaultEnabled
,
value
:
tru
e
}],
})
})
})
})
...
@@ -109,8 +79,6 @@ describe('UniswapX Orders', () => {
...
@@ -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', () => {
...
@@ -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', () => {
...
@@ -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', () => {
...
@@ -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', () => {
...
@@ -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
:
fals
e
}],
featureFlags
:
[{
name
:
FeatureFlag
.
uniswapXDefaultEnabled
,
value
:
tru
e
}],
})
})
})
})
...
@@ -207,7 +169,6 @@ describe('UniswapX Eth Input', () => {
...
@@ -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', () => {
...
@@ -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', () => {
...
@@ -289,14 +248,13 @@ describe('UniswapX activity history', () => {
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
:
fals
e
}],
featureFlags
:
[{
name
:
FeatureFlag
.
uniswapXDefaultEnabled
,
value
:
tru
e
}],
})
})
})
})
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', () => {
...
@@ -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', () => {
...
@@ -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', () => {
...
@@ -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
)
=>
{
...
...
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