From 778ea8ee4233c06fa05effbec67424512d87f3a3 Mon Sep 17 00:00:00 2001 From: aballerr Date: Thu, 15 Dec 2022 10:16:15 -0500 Subject: [PATCH] test: adding in some basic token tests (#5686) * adding in some basic token tests --- cypress/e2e/token.test.ts | 20 +++++++++++++++++++ cypress/utils/index.ts | 2 ++ .../Tokens/TokenDetails/StatsSection.tsx | 2 +- src/components/Tokens/TokenDetails/index.tsx | 2 +- src/components/Tokens/TokenTable/TokenRow.tsx | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/token.test.ts diff --git a/cypress/e2e/token.test.ts b/cypress/e2e/token.test.ts new file mode 100644 index 0000000000..49ed2d5030 --- /dev/null +++ b/cypress/e2e/token.test.ts @@ -0,0 +1,20 @@ +import { getTestSelector, getTestSelectorStartsWith } from '../utils' + +describe('Testing tokens on uniswap page', () => { + before(() => { + cy.visit('/') + }) + + it('should load token leaderboard', () => { + cy.visit('/tokens/ethereum') + cy.get(getTestSelectorStartsWith('token-table')).its('length').should('be.gte', 25) + }) + + it('should load go to ethereum token and return to token list page', () => { + cy.visit('/tokens/ethereum') + cy.get(getTestSelector('token-table-row-Ether')).click() + cy.get(getTestSelector('token-details-stats')).should('exist') + cy.get(getTestSelector('token-details-return-button')).click() + cy.get(getTestSelectorStartsWith('token-table')).its('length').should('be.gte', 25) + }) +}) diff --git a/cypress/utils/index.ts b/cypress/utils/index.ts index 3a111e9f26..cf4e53960f 100644 --- a/cypress/utils/index.ts +++ b/cypress/utils/index.ts @@ -1 +1,3 @@ export const getTestSelector = (selectorId: string) => `[data-testid=${selectorId}]` + +export const getTestSelectorStartsWith = (selectorId: string) => `[data-testid^=${selectorId}]` diff --git a/src/components/Tokens/TokenDetails/StatsSection.tsx b/src/components/Tokens/TokenDetails/StatsSection.tsx index b2c1c26414..ee78e8e03b 100644 --- a/src/components/Tokens/TokenDetails/StatsSection.tsx +++ b/src/components/Tokens/TokenDetails/StatsSection.tsx @@ -84,7 +84,7 @@ export default function StatsSection(props: StatsSectionProps) { const { priceLow52W, priceHigh52W, TVL, volume24H } = props if (TVL || volume24H || priceLow52W || priceHigh52W) { return ( - +
Stats
diff --git a/src/components/Tokens/TokenDetails/index.tsx b/src/components/Tokens/TokenDetails/index.tsx index b51991b24d..a30e16998d 100644 --- a/src/components/Tokens/TokenDetails/index.tsx +++ b/src/components/Tokens/TokenDetails/index.tsx @@ -185,7 +185,7 @@ export default function TokenDetails({ {token && !isPending ? ( - Tokens + Tokens diff --git a/src/components/Tokens/TokenTable/TokenRow.tsx b/src/components/Tokens/TokenTable/TokenRow.tsx index 512ef0ff45..f96175d70a 100644 --- a/src/components/Tokens/TokenTable/TokenRow.tsx +++ b/src/components/Tokens/TokenTable/TokenRow.tsx @@ -457,7 +457,7 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef +
sendAnalyticsEvent(EventName.EXPLORE_TOKEN_ROW_CLICKED, exploreTokenSelectedEventProperties)}