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
d6587205
Unverified
Commit
d6587205
authored
Dec 13, 2022
by
aballerr
Committed by
GitHub
Dec 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: initial set of cypress tests for nft (#5590)
* initial set of cypress tests for nft
parent
bba40846
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
62 additions
and
8 deletions
+62
-8
nfts.test.ts
cypress/e2e/nfts.test.ts
+35
-0
e2e.ts
cypress/support/e2e.ts
+11
-0
index.tsx
src/components/NavBar/index.tsx
+4
-2
EmptyContent.tsx
src/nft/components/bag/EmptyContent.tsx
+1
-1
Activity.tsx
src/nft/components/collection/Activity.tsx
+1
-1
ActivitySwitcher.tsx
src/nft/components/collection/ActivitySwitcher.tsx
+1
-0
CollectionAsset.tsx
src/nft/components/collection/CollectionAsset.tsx
+1
-1
CollectionNfts.tsx
src/nft/components/collection/CollectionNfts.tsx
+1
-0
FilterButton.tsx
src/nft/components/collection/FilterButton.tsx
+1
-0
Filters.tsx
src/nft/components/collection/Filters.tsx
+3
-1
Sweep.tsx
src/nft/components/collection/Sweep.tsx
+1
-1
Table.tsx
src/nft/components/explore/Table.tsx
+1
-0
WelcomeModal.tsx
src/nft/components/explore/WelcomeModal.tsx
+1
-1
No files found.
cypress/e2e/nfts.test.ts
0 → 100644
View file @
d6587205
import
{
getTestSelector
}
from
'
../utils
'
const
COLLECTION_ADDRESS
=
'
0xbd3531da5cf5857e7cfaa92426877b022e612cf8
'
describe
(
'
Testing nfts
'
,
()
=>
{
before
(()
=>
{
cy
.
visit
(
'
/
'
)
})
it
(
'
should load nft leaderboard
'
,
()
=>
{
cy
.
get
(
getTestSelector
(
'
nft-nav
'
)).
first
().
click
()
cy
.
get
(
getTestSelector
(
'
nft-nav
'
)).
first
().
should
(
'
exist
'
)
cy
.
get
(
getTestSelector
(
'
nft-nav
'
)).
first
().
click
()
cy
.
get
(
getTestSelector
(
'
nft-trending-collection
'
)).
its
(
'
length
'
).
should
(
'
be.gte
'
,
25
)
})
it
(
'
should load pudgy penguin collection page
'
,
()
=>
{
cy
.
visit
(
`/#/nfts/collection/
${
COLLECTION_ADDRESS
}
`
)
cy
.
get
(
getTestSelector
(
'
nft-collection-asset
'
)).
should
(
'
exist
'
)
cy
.
get
(
getTestSelector
(
'
nft-collection-filter-buy-now
'
)).
should
(
'
not.exist
'
)
cy
.
get
(
getTestSelector
(
'
nft-filter
'
)).
first
().
click
()
cy
.
get
(
getTestSelector
(
'
nft-collection-filter-buy-now
'
)).
should
(
'
exist
'
)
})
it
(
'
should be able to open bag and open sweep
'
,
()
=>
{
cy
.
get
(
getTestSelector
(
'
nft-sweep-button
'
)).
first
().
click
()
cy
.
get
(
getTestSelector
(
'
nft-empty-bag
'
)).
should
(
'
exist
'
)
cy
.
get
(
getTestSelector
(
'
nft-sweep-slider
'
)).
should
(
'
exist
'
)
})
it
(
'
should be able to navigate to activity
'
,
()
=>
{
cy
.
get
(
getTestSelector
(
'
nft-activity
'
)).
first
().
click
()
cy
.
get
(
getTestSelector
(
'
nft-activity-row
'
)).
should
(
'
exist
'
)
})
})
cypress/support/e2e.ts
View file @
d6587205
...
@@ -65,6 +65,17 @@ beforeEach(() => {
...
@@ -65,6 +65,17 @@ beforeEach(() => {
res
.
headers
[
'
origin
'
]
=
'
http://localhost:3000
'
res
.
headers
[
'
origin
'
]
=
'
http://localhost:3000
'
res
.
continue
()
res
.
continue
()
})
})
// Graphql security policies are based on Origin headers.
// These are stripped by cypress because chromeWebSecurity === false; this adds them back in.
cy
.
intercept
(
'
https://api.uniswap.org/v1/graphql
'
,
(
res
)
=>
{
res
.
headers
[
'
origin
'
]
=
'
https://app.uniswap.org
'
res
.
continue
()
})
cy
.
intercept
(
'
https://beta.api.uniswap.org/v1/graphql
'
,
(
res
)
=>
{
res
.
headers
[
'
origin
'
]
=
'
https://app.uniswap.org
'
res
.
continue
()
})
})
})
Cypress
.
on
(
'
uncaught:exception
'
,
(
_err
,
_runnable
)
=>
{
Cypress
.
on
(
'
uncaught:exception
'
,
(
_err
,
_runnable
)
=>
{
...
...
src/components/NavBar/index.tsx
View file @
d6587205
...
@@ -45,15 +45,17 @@ interface MenuItemProps {
...
@@ -45,15 +45,17 @@ interface MenuItemProps {
id
?:
NavLinkProps
[
'
id
'
]
id
?:
NavLinkProps
[
'
id
'
]
isActive
?:
boolean
isActive
?:
boolean
children
:
ReactNode
children
:
ReactNode
dataTestId
?:
string
}
}
const
MenuItem
=
({
href
,
id
,
isActive
,
children
}:
MenuItemProps
)
=>
{
const
MenuItem
=
({
href
,
dataTestId
,
id
,
isActive
,
children
}:
MenuItemProps
)
=>
{
return
(
return
(
<
NavLink
<
NavLink
to=
{
href
}
to=
{
href
}
className=
{
isActive
?
styles
.
activeMenuItem
:
styles
.
menuItem
}
className=
{
isActive
?
styles
.
activeMenuItem
:
styles
.
menuItem
}
id=
{
id
}
id=
{
id
}
style=
{
{
textDecoration
:
'
none
'
}
}
style=
{
{
textDecoration
:
'
none
'
}
}
data
-
testid=
{
dataTestId
}
>
>
{
children
}
{
children
}
</
NavLink
>
</
NavLink
>
...
@@ -82,7 +84,7 @@ const PageTabs = () => {
...
@@ -82,7 +84,7 @@ const PageTabs = () => {
<
MenuItem
href=
{
`/tokens/${chainName.toLowerCase()}`
}
isActive=
{
pathname
.
startsWith
(
'
/tokens
'
)
}
>
<
MenuItem
href=
{
`/tokens/${chainName.toLowerCase()}`
}
isActive=
{
pathname
.
startsWith
(
'
/tokens
'
)
}
>
<
Trans
>
Tokens
</
Trans
>
<
Trans
>
Tokens
</
Trans
>
</
MenuItem
>
</
MenuItem
>
<
MenuItem
href=
"/nfts"
isActive=
{
isNftPage
}
>
<
MenuItem
dataTestId=
"nft-nav"
href=
"/nfts"
isActive=
{
isNftPage
}
>
<
Trans
>
NFTs
</
Trans
>
<
Trans
>
NFTs
</
Trans
>
</
MenuItem
>
</
MenuItem
>
<
MenuItem
href=
"/pool"
id=
"pool-nav-link"
isActive=
{
isPoolActive
}
>
<
MenuItem
href=
"/pool"
id=
"pool-nav-link"
isActive=
{
isPoolActive
}
>
...
...
src/nft/components/bag/EmptyContent.tsx
View file @
d6587205
...
@@ -26,7 +26,7 @@ const EmptyState = () => {
...
@@ -26,7 +26,7 @@ const EmptyState = () => {
<
Center
className=
{
subhead
}
>
No NFTs selected
</
Center
>
<
Center
className=
{
subhead
}
>
No NFTs selected
</
Center
>
)
:
(
)
:
(
<
Column
gap=
"16"
>
<
Column
gap=
"16"
>
<
Center
className=
{
subhead
}
style=
{
{
lineHeight
:
'
24px
'
}
}
>
<
Center
data
-
testid=
"nft-empty-bag"
className=
{
subhead
}
style=
{
{
lineHeight
:
'
24px
'
}
}
>
Your bag is empty
Your bag is empty
</
Center
>
</
Center
>
<
Center
fontSize=
"12"
fontWeight=
"normal"
color=
"textSecondary"
style=
{
{
lineHeight
:
'
16px
'
}
}
>
<
Center
fontSize=
"12"
fontWeight=
"normal"
color=
"textSecondary"
style=
{
{
lineHeight
:
'
16px
'
}
}
>
...
...
src/nft/components/collection/Activity.tsx
View file @
d6587205
...
@@ -159,7 +159,7 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName, chai
...
@@ -159,7 +159,7 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName, chai
style=
{
{
overflow
:
'
unset
'
}
}
style=
{
{
overflow
:
'
unset
'
}
}
>
>
{
events
.
map
((
event
,
i
)
=>
(
{
events
.
map
((
event
,
i
)
=>
(
<
Box
as=
"a"
href=
{
baseHref
(
event
)
}
className=
{
styles
.
eventRow
}
key=
{
i
}
>
<
Box
as=
"a"
data
-
testid=
"nft-activity-row"
href=
{
baseHref
(
event
)
}
className=
{
styles
.
eventRow
}
key=
{
i
}
>
<
ItemCell
<
ItemCell
event=
{
event
}
event=
{
event
}
rarityVerified=
{
rarityVerified
}
rarityVerified=
{
rarityVerified
}
...
...
src/nft/components/collection/ActivitySwitcher.tsx
View file @
d6587205
...
@@ -48,6 +48,7 @@ export const ActivitySwitcher = ({
...
@@ -48,6 +48,7 @@ export const ActivitySwitcher = ({
as=
"button"
as=
"button"
className=
{
!
showActivity
?
styles
.
activitySwitcherToggle
:
styles
.
selectedActivitySwitcherToggle
}
className=
{
!
showActivity
?
styles
.
activitySwitcherToggle
:
styles
.
selectedActivitySwitcherToggle
}
onClick=
{
()
=>
!
showActivity
&&
toggleActivity
()
}
onClick=
{
()
=>
!
showActivity
&&
toggleActivity
()
}
data
-
testid=
"nft-activity"
>
>
Activity
Activity
</
Box
>
</
Box
>
...
...
src/nft/components/collection/CollectionAsset.tsx
View file @
d6587205
...
@@ -122,7 +122,7 @@ export const CollectionAsset = ({
...
@@ -122,7 +122,7 @@ export const CollectionAsset = ({
removeAssetFromBag=
{
handleRemoveAssetFromBag
}
removeAssetFromBag=
{
handleRemoveAssetFromBag
}
>
>
<
Card
.
ImageContainer
isDisabled=
{
asset
.
notForSale
}
>
<
Card
.
ImageContainer
isDisabled=
{
asset
.
notForSale
}
>
<
StyledContainer
>
<
StyledContainer
data
-
testid=
"nft-collection-asset"
>
<
Tooltip
<
Tooltip
text=
{
text=
{
<
Box
as=
"span"
className=
{
bodySmall
}
color=
"textPrimary"
>
<
Box
as=
"span"
className=
{
bodySmall
}
color=
"textPrimary"
>
...
...
src/nft/components/collection/CollectionNfts.tsx
View file @
d6587205
...
@@ -528,6 +528,7 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
...
@@ -528,6 +528,7 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
disabled=
{
hasErc1155s
}
disabled=
{
hasErc1155s
}
className=
{
buttonTextMedium
}
className=
{
buttonTextMedium
}
onClick=
{
handleSweepClick
}
onClick=
{
handleSweepClick
}
data
-
testid=
"nft-sweep-button"
>
>
<
SweepIcon
viewBox=
"0 0 24 24"
width=
"20px"
height=
"20px"
/>
<
SweepIcon
viewBox=
"0 0 24 24"
width=
"20px"
height=
"20px"
/>
<
SweepText
fontWeight=
{
600
}
color=
"currentColor"
lineHeight=
"20px"
>
<
SweepText
fontWeight=
{
600
}
color=
"currentColor"
lineHeight=
"20px"
>
...
...
src/nft/components/collection/FilterButton.tsx
View file @
d6587205
...
@@ -34,6 +34,7 @@ export const FilterButton = ({
...
@@ -34,6 +34,7 @@ export const FilterButton = ({
height=
"44"
height=
"44"
whiteSpace=
"nowrap"
whiteSpace=
"nowrap"
color=
"white"
color=
"white"
data
-
testid=
"nft-filter"
>
>
<
FilterIcon
/>
<
FilterIcon
/>
{
!
isMobile
?
(
{
!
isMobile
?
(
...
...
src/nft/components/collection/Filters.tsx
View file @
d6587205
...
@@ -53,7 +53,9 @@ export const Filters = ({ traitsByGroup }: { traitsByGroup: Record<string, Trait
...
@@ -53,7 +53,9 @@ export const Filters = ({ traitsByGroup }: { traitsByGroup: Record<string, Trait
onMouseEnter=
{
toggleBuyNowHover
}
onMouseEnter=
{
toggleBuyNowHover
}
onMouseLeave=
{
toggleBuyNowHover
}
onMouseLeave=
{
toggleBuyNowHover
}
>
>
<
Box
className=
{
subhead
}
>
Buy now
</
Box
>
<
Box
data
-
testid=
"nft-collection-filter-buy-now"
className=
{
subhead
}
>
Buy now
</
Box
>
<
Checkbox
hovered=
{
buyNowHovered
}
checked=
{
buyNow
}
onClick=
{
handleBuyNowToggle
}
>
<
Checkbox
hovered=
{
buyNowHovered
}
checked=
{
buyNow
}
onClick=
{
handleBuyNowToggle
}
>
<
span
/>
<
span
/>
</
Checkbox
>
</
Checkbox
>
...
...
src/nft/components/collection/Sweep.tsx
View file @
d6587205
...
@@ -363,7 +363,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
...
@@ -363,7 +363,7 @@ export const Sweep = ({ contractAddress, minPrice, maxPrice }: SweepProps) => {
}
}
return
(
return
(
<
SweepContainer
>
<
SweepContainer
data
-
testid=
"nft-sweep-slider"
>
<
SweepLeftmostContainer
>
<
SweepLeftmostContainer
>
<
SweepHeaderContainer
>
<
SweepHeaderContainer
>
<
ThemedText
.
SubHeader
color=
"textPrimary"
lineHeight=
"20px"
paddingTop=
"6px"
paddingBottom=
"6px"
>
<
ThemedText
.
SubHeader
color=
"textPrimary"
lineHeight=
"20px"
paddingTop=
"6px"
paddingBottom=
"6px"
>
...
...
src/nft/components/explore/Table.tsx
View file @
d6587205
...
@@ -198,6 +198,7 @@ export function Table<D extends Record<string, unknown>>({
...
@@ -198,6 +198,7 @@ export function Table<D extends Record<string, unknown>>({
{
...
row
.
getRowProps
()}
{
...
row
.
getRowProps
()}
key=
{
row
.
id
}
key=
{
row
.
id
}
onClick=
{
()
=>
navigate
(
`/nfts/collection/${row.original.collection.address}`
)
}
onClick=
{
()
=>
navigate
(
`/nfts/collection/${row.original.collection.address}`
)
}
data
-
testid=
"nft-trending-collection"
>
>
{
row
.
cells
.
map
((
cell
,
cellIndex
)
=>
{
{
row
.
cells
.
map
((
cell
,
cellIndex
)
=>
{
return
(
return
(
...
...
src/nft/components/explore/WelcomeModal.tsx
View file @
d6587205
...
@@ -112,7 +112,7 @@ export function WelcomeModal({ onDismissed }: { onDismissed: () => void }) {
...
@@ -112,7 +112,7 @@ export function WelcomeModal({ onDismissed }: { onDismissed: () => void }) {
Learn more.
Learn more.
</
Link
>
</
Link
>
</
Paragraph
>
</
Paragraph
>
<
CloseButton
size=
{
24
}
onClick=
{
dismiss
}
/>
<
CloseButton
data
-
testid=
"nft-intro-modal"
size=
{
24
}
onClick=
{
dismiss
}
/>
</
Content
>
</
Content
>
</
Container
>
</
Container
>
</
Modal
>
</
Modal
>
...
...
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