diff --git a/packages/app/features/leaderboard/__snapshots__/screen.test.tsx.snap b/packages/app/features/leaderboard/__snapshots__/screen.test.tsx.snap new file mode 100644 index 000000000..249bcc88a --- /dev/null +++ b/packages/app/features/leaderboard/__snapshots__/screen.test.tsx.snap @@ -0,0 +1,5007 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`LeaderboardScreen renders leaderboard screen: LeaderboardScreen 1`] = ` + + + + Best in Class + + + Register a Sendtag, maintain the minimum balance, and refer others to rise in the ranks. + + + + + + + + Referrals + + + + + # + + + Sendtag + + + + Referrals + + + + + + 1 + + + + + + + + + + / + 0xUser + + + + + + 100 + + + 1500 USDC + + + + + + + 2 + + + + + + + + + + / + 0xUser1 + + + + + + 90 + + + 1500 USDC + + + + + + + 3 + + + + + + + + + + / + 0xUser2 + + + + + + 80 + + + 1500 USDC + + + + + + + 4 + + + + + + + + + + / + 0xUser3 + + + + + + 70 + + + 1500 USDC + + + + + + + 5 + + + + + + + + + + / + 0xUser4 + + + + + + 60 + + + 1500 USDC + + + + + + + 6 + + + + + + + + + + / + 0xUser5 + + + + + + 50 + + + 1500 USDC + + + + + + + 7 + + + + + + + + + + / + 0xUser6 + + + + + + 40 + + + 1500 USDC + + + + + + + 8 + + + + + + + + + + / + 0xUser7 + + + + + + 30 + + + 1500 USDC + + + + + + + 9 + + + + + + + + + + / + 0xUser8 + + + + + + 20 + + + 1500 USDC + + + + + + + 10 + + + + + + + + + + / + 0xUser9 + + + + + + 10 + + + 1500 USDC + + + + + + + 11 + + + + + + + + + + / + 0xUser10 + + + + + + 5 + + + 1500 USDC + + + + + + + 12 + + + + + + + + + + / + 0xUser11 + + + + + + 5 + + + 1500 USDC + + + + + + + 13 + + + + + + + + + + / + 0xUser12 + + + + + + 5 + + + 1500 USDC + + + + + + + + + + + + + + Send + + + + + # + + + Sendtag + + + + Total $SEND spent + + + + + + 1 + + + + + + + + + + / + 0xUser + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 2 + + + + + + + + + + / + 0xUser1 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 3 + + + + + + + + + + / + 0xUser2 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 4 + + + + + + + + + + / + 0xUser3 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 5 + + + + + + + + + + / + 0xUser4 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 6 + + + + + + + + + + / + 0xUser5 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 7 + + + + + + + + + + / + 0xUser6 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 8 + + + + + + + + + + / + 0xUser7 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 9 + + + + + + + + + + / + 0xUser8 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 10 + + + + + + + + + + / + 0xUser9 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 11 + + + + + + + + + + / + 0xUser10 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 12 + + + + + + + + + + / + 0xUser11 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + 13 + + + + + + + + + + / + 0xUser12 + + + + + + 1m 12s + + + 1500 USDC + + + + + + + + + + + +`; diff --git a/packages/app/features/leaderboard/screen.test.tsx b/packages/app/features/leaderboard/screen.test.tsx new file mode 100644 index 000000000..1b636cebd --- /dev/null +++ b/packages/app/features/leaderboard/screen.test.tsx @@ -0,0 +1,22 @@ +import { expect } from '@jest/globals' +import { Provider } from 'app/__mocks__/app/provider' +import { act, render, screen } from '@testing-library/react-native' +import { LeaderboardScreen } from './screen' + +describe('LeaderboardScreen', () => { + it('renders leaderboard screen', async () => { + jest.useFakeTimers() + render( + + + + ) + await act(async () => { + jest.runAllTimers() + }) + + const title = await screen.findByTestId('mainTitle') + expect(title).toHaveTextContent('Best in Class') + expect(screen.toJSON()).toMatchSnapshot('LeaderboardScreen') + }) +}) diff --git a/packages/app/features/leaderboard/screen.tsx b/packages/app/features/leaderboard/screen.tsx index 0b83ccdae..1f2ae4e66 100644 --- a/packages/app/features/leaderboard/screen.tsx +++ b/packages/app/features/leaderboard/screen.tsx @@ -112,7 +112,7 @@ export function LeaderboardScreen() { return ( -

+

Best in Class

@@ -133,7 +133,7 @@ function Leaderboard({ title, list }) { -

+

{title}

diff --git a/packages/playwright/tests/leaderboard.logged-in.spec.ts b/packages/playwright/tests/leaderboard.logged-in.spec.ts new file mode 100644 index 000000000..92465ce1b --- /dev/null +++ b/packages/playwright/tests/leaderboard.logged-in.spec.ts @@ -0,0 +1,22 @@ +import { assert } from 'app/utils/assert' +import { expect, test } from './fixtures/send-accounts' +import { debug } from 'debug' + +let log: debug.Debugger + +test.beforeEach(async ({ page, user: { user } }) => { + log = debug(`test:leaderboard:logged-in:${user.id}:${test.info().parallelIndex}`) + await page.goto('/leaderboard') + await page.waitForURL('/leaderboard') +}) + +test('can visit leaderboard page', async ({ page }) => { + await expect(page).toHaveURL('/leaderboard') + + await expect(page.getByText('Best in class')).toBeVisible() + await expect(page.getByTestId('titleReferrals')).toBeVisible() + await expect(page.getByTestId('titleSend')).toBeVisible() + + const elements = page.locator('text=Sendtag') + await expect(elements).toHaveCount(3) +})