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
f6c393b0
Unverified
Commit
f6c393b0
authored
May 17, 2023
by
Zach Pomerantz
Committed by
GitHub
May 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(e2e): de-flake activity-history (#6583)
parent
15f8d343
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
42 deletions
+33
-42
activity-history.test.ts
cypress/e2e/mini-portfolio/activity-history.test.ts
+33
-42
No files found.
cypress/e2e/mini-portfolio/activity-history.test.ts
View file @
f6c393b0
import
{
getTestSelector
}
from
'
../../utils
'
describe
(
'
mini-portfolio activity history
'
,
()
=>
{
afterEach
(()
=>
{
cy
.
intercept
(
{
method
:
'
POST
'
,
url
:
'
https://beta.api.uniswap.org/v1/graphql
'
,
},
// Pass an empty object to allow the original behavior
{}
).
as
(
'
restoreOriginalBehavior
'
)
})
it
(
'
should deduplicate activity history by nonce
'
,
()
=>
{
cy
.
visit
(
'
/swap
'
,
{
ethereum
:
'
hardhat
'
})
.
hardhat
({
automine
:
false
})
beforeEach
(()
=>
{
cy
.
hardhat
()
.
then
((
hardhat
)
=>
hardhat
.
wallet
.
getTransactionCount
())
.
then
((
currentNonce
)
=>
{
const
nextNonce
=
currentNonce
+
1
// Mock graphql response to include a specific nonce.
.
then
((
nonce
)
=>
{
// Mock graphql response to include specific nonces.
cy
.
intercept
(
{
method
:
'
POST
'
,
...
...
@@ -43,7 +30,7 @@ describe('mini-portfolio activity history', () => {
status
:
'
CONFIRMED
'
,
to
:
'
0x034a40764485f7e08ca16366e503491a6af7850d
'
,
from
:
'
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
'
,
nonce
:
currentNonce
,
nonce
,
__typename
:
'
Transaction
'
,
},
assetChanges
:
[],
...
...
@@ -61,7 +48,7 @@ describe('mini-portfolio activity history', () => {
status
:
'
CONFIRMED
'
,
to
:
'
0x1b5154aa4b8f027b9fd19341132fc9dae10f7359
'
,
from
:
'
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
'
,
nonce
:
n
extNonce
,
nonce
:
n
once
+
1
,
__typename
:
'
Transaction
'
,
},
assetChanges
:
[
...
...
@@ -101,33 +88,37 @@ describe('mini-portfolio activity history', () => {
},
},
}
).
as
(
'
graphqlMock
'
)
).
as
(
'
graphql
'
)
})
})
it
(
'
should deduplicate activity history by nonce
'
,
()
=>
{
cy
.
visit
(
'
/swap
'
,
{
ethereum
:
'
hardhat
'
}).
hardhat
({
automine
:
false
})
// Input swap info.
cy
.
get
(
'
#swap-currency-input .token-amount-input
'
).
clear
().
type
(
'
1
'
)
cy
.
get
(
'
#swap-currency-output .open-currency-select-button
'
).
click
()
cy
.
contains
(
'
USDC
'
).
click
()
cy
.
get
(
'
#swap-currency-output .token-amount-input
'
).
should
(
'
not.equal
'
,
''
)
// Input swap info.
cy
.
get
(
'
#swap-currency-input .token-amount-input
'
).
clear
().
type
(
'
1
'
)
cy
.
get
(
'
#swap-currency-output .open-currency-select-button
'
).
click
()
cy
.
contains
(
'
USDC
'
).
click
()
cy
.
get
(
'
#swap-currency-output .token-amount-input
'
).
should
(
'
not.equal
'
,
''
)
// Set slippage to a high value.
cy
.
get
(
getTestSelector
(
'
open-settings-dialog-button
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
max-slippage-settings
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
slippage-input
'
)).
clear
().
type
(
'
5
'
)
cy
.
get
(
'
body
'
).
click
(
'
topRight
'
)
cy
.
get
(
getTestSelector
(
'
slippage-input
'
)).
should
(
'
not.exist
'
)
// Set slippage to a high value.
cy
.
get
(
getTestSelector
(
'
open-settings-dialog-button
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
max-slippage-settings
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
slippage-input
'
)).
clear
().
type
(
'
5
'
)
cy
.
get
(
'
body
'
).
click
(
'
topRight
'
)
cy
.
get
(
getTestSelector
(
'
slippage-input
'
)).
should
(
'
not.exist
'
)
// Click swap button.
cy
.
contains
(
'
1 USDC =
'
).
should
(
'
exist
'
)
cy
.
get
(
'
#swap-button
'
).
should
(
'
not.be
'
,
'
disabled
'
).
click
()
cy
.
get
(
'
#confirm-swap-or-send
'
).
click
()
cy
.
get
(
getTestSelector
(
'
dismiss-tx-confirmation
'
)).
click
()
// Click swap button.
cy
.
contains
(
'
1 USDC =
'
).
should
(
'
exist
'
)
cy
.
get
(
'
#swap-button
'
).
should
(
'
not.be
'
,
'
disabled
'
).
click
()
cy
.
get
(
'
#confirm-swap-or-send
'
).
click
()
cy
.
get
(
getTestSelector
(
'
dismiss-tx-confirmation
'
)).
click
()
// Check activity history tab.
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
mini-portfolio-nav-activity
'
)).
click
()
// Check activity history tab.
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
mini-portfolio-nav-activity
'
)).
click
()
// Assert that the local pending transaction is replaced by a remote transaction with the same nonce.
cy
.
contains
(
'
Swapping
'
).
should
(
'
not.exist
'
)
})
// Assert that the local pending transaction is replaced by a remote transaction with the same nonce.
cy
.
contains
(
'
Swapping
'
).
should
(
'
not.exist
'
)
})
})
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