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
19c83c92
Unverified
Commit
19c83c92
authored
Sep 19, 2023
by
Zach Pomerantz
Committed by
GitHub
Sep 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: spy only on portfolio balances (#7335)
parent
91c20135
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
accounts.test.ts
cypress/e2e/mini-portfolio/accounts.test.ts
+14
-9
No files found.
cypress/e2e/mini-portfolio/accounts.test.ts
View file @
19c83c92
...
...
@@ -2,43 +2,48 @@ import { getTestSelector } from '../../utils'
describe
(
'
Mini Portfolio account drawer
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
intercept
(
/api.uniswap.org
\/
v1
\/
graphql/
,
cy
.
spy
().
as
(
'
gqlSpy
'
))
const
portfolioSpy
=
cy
.
spy
().
as
(
'
portfolioSpy
'
)
cy
.
intercept
(
/api.uniswap.org
\/
v1
\/
graphql/
,
(
req
)
=>
{
if
(
req
.
body
.
operationName
===
'
PortfolioBalances
'
)
{
portfolioSpy
(
req
)
}
})
cy
.
visit
(
'
/swap
'
)
})
it
(
'
fetches balances when account button is first hovered
'
,
()
=>
{
// The balances should not be fetched before the account button is hovered
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
not.have.been.called
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
not.have.been.called
'
)
// Balances should have been fetched once after hover
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
trigger
(
'
mouseover
'
)
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
have.been.calledOnce
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
have.been.calledOnce
'
)
})
it
(
'
should not re-fetch balances on second hover
'
,
()
=>
{
// The balances should not be fetched before the account button is hovered
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
not.have.been.called
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
not.have.been.called
'
)
// Balances should have been fetched once after hover
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
trigger
(
'
mouseover
'
)
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
have.been.calledOnce
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
have.been.calledOnce
'
)
// Balances should not be refetched upon second hover
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
trigger
(
'
mouseover
'
)
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
have.been.calledOnce
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
have.been.calledOnce
'
)
})
it
(
'
should not re-fetch balances when the account drawer is opened
'
,
()
=>
{
// The balances should not be fetched before the account button is hovered
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
not.have.been.called
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
not.have.been.called
'
)
// Balances should have been fetched once after hover
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
trigger
(
'
mouseover
'
)
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
have.been.calledOnce
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
have.been.calledOnce
'
)
// Balances should not be refetched upon opening drawer
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
click
()
cy
.
get
(
'
@
gql
Spy
'
).
should
(
'
have.been.calledOnce
'
)
cy
.
get
(
'
@
portfolio
Spy
'
).
should
(
'
have.been.calledOnce
'
)
})
it
(
'
fetches account information
'
,
()
=>
{
...
...
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