From 5aa2b8d00b39850190a5ba9cc8795e1dd6f29267 Mon Sep 17 00:00:00 2001 From: Nelito Junior Date: Thu, 12 Dec 2024 16:43:02 -0300 Subject: [PATCH] refactor(e2e-assets): update end-to-end test configurations and remove obsolete asset tests --- .github/workflows/pr-tests-e2e.yml | 1 - package.json | 1 + packages/app/playwright/crx/assets.test.ts | 45 ---------------------- packages/e2e-assets/package.json | 4 +- packages/e2e-assets/playwright.config.ts | 2 +- pnpm-lock.yaml | 42 ++++++++++++++++++-- 6 files changed, 42 insertions(+), 53 deletions(-) delete mode 100644 packages/app/playwright/crx/assets.test.ts diff --git a/.github/workflows/pr-tests-e2e.yml b/.github/workflows/pr-tests-e2e.yml index 26eb06eb3..bf5860c45 100644 --- a/.github/workflows/pr-tests-e2e.yml +++ b/.github/workflows/pr-tests-e2e.yml @@ -38,7 +38,6 @@ jobs: timeout-minutes: 15 env: NODE_ENV: test - READONLY_TESTNET_ASSETS_VIEW: ${{ secrets.READONLY_TESTNET_ASSETS_VIEW }} - uses: actions/upload-artifact@v4 if: always() diff --git a/package.json b/package.json index 78c41c891..e88a941ca 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "test:e2e": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.config.ts --project=chromium", "test:e2e:beta": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.config.ts --project=chrome-beta", "test:e2e:crx-lock": "NODE_ENV=test pnpm build:crx && playwright test --config=packages/app/playwright.crx-lock.config.ts", + "test:e2e:assets": "NODE_ENV=test pnpm playwright test --config=packages/e2e-assets/playwright.config.ts", "test:e2e:contracts": "NODE_ENV=test pnpm build:crx && pnpm --filter=@fuel-wallet/e2e-contract-tests test:e2e", "test:appfile": "pnpm --filter=fuels-wallet test --", "ts:check": "turbo run ts:check", diff --git a/packages/app/playwright/crx/assets.test.ts b/packages/app/playwright/crx/assets.test.ts deleted file mode 100644 index 46533b936..000000000 --- a/packages/app/playwright/crx/assets.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { expect, test } from '@playwright/test'; -import { hasText, waitAriaLabel } from '../commons'; - -test.describe('Check assets', () => { - test('should show valid asset values', async ({ page }) => { - await page.goto('http://localhost:3000'); - - await test.step('Import wallet', async () => { - await page.getByRole('heading', { name: 'Import seed phrase' }).click(); - await page.getByText('I Agree to the Terms Of Use').click(); - await page.getByRole('button', { name: 'Next: Seed Phrase' }).click(); - const mnemonic = process.env.READONLY_TESTNET_ASSETS_VIEW; - - const words = mnemonic.split(' '); - for (const [index, word] of words.entries()) { - await page - .locator('div') - .filter({ - hasText: new RegExp(`^${index + 1}$`), - }) - .getByLabel('Type your text') - .fill(word); - } - - await page.getByRole('button', { name: 'Next: Your password' }).click(); - await page.getByPlaceholder('Type your password').fill('qwe123QWE!@#'); - await page.getByPlaceholder('Confirm your password').fill('qwe123QWE!@#'); - await page.getByRole('button', { name: 'Next: Finish set-up' }).click(); - await hasText(page, /Wallet created successfully/i); - await page.goto('http://localhost:3000/#/wallet'); - await waitAriaLabel(page, 'Account 1 selected'); - await page.getByLabel('Selected Network').click(); - await page.getByText('Fuel Sepolia Testnet').click(); - await waitAriaLabel(page, 'Account 1 selected'); - expect( - await page.getByText('0.002000', { exact: true }).isVisible() - ).toBeTruthy(); - expect( - await page.getByText('USDCIcon AlertTriangle').isVisible() - ).toBeTruthy(); - expect(await page.getByText('1 SCAM').isVisible()).toBeTruthy(); - await page.close(); - }); - }); -}); diff --git a/packages/e2e-assets/package.json b/packages/e2e-assets/package.json index fff0d79d6..4cc1e1859 100644 --- a/packages/e2e-assets/package.json +++ b/packages/e2e-assets/package.json @@ -4,9 +4,7 @@ "version": "0.43.0", "type": "module", "database": "23", - "scripts": { - "dev:crx": "pnpm --workspace-root dev:crx" - }, + "scripts": {}, "dependencies": {}, "devDependencies": { "@playwright/test": "1.46.1" diff --git a/packages/e2e-assets/playwright.config.ts b/packages/e2e-assets/playwright.config.ts index 54b6d9b66..5533c3add 100644 --- a/packages/e2e-assets/playwright.config.ts +++ b/packages/e2e-assets/playwright.config.ts @@ -18,7 +18,7 @@ export default defineConfig({ ['html', { outputFolder: './playwright-html/' }], ], webServer: { - command: 'NODE_ENV=test pnpm dev:crx', + command: 'NODE_ENV=test pnpm -w run dev:crx', reuseExistingServer: true, timeout: 20000, url: `http://localhost:${PORT}`, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f51b32c6e..caf36f662 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -544,7 +544,7 @@ importers: version: 3.0.0 next: specifier: 14.2.12 - version: 14.2.12(@babel/core@7.23.2)(@playwright/test@1.46.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 14.2.12(@babel/core@7.23.2)(@playwright/test@1.49.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) next-mdx-remote: specifier: 4.4.1 version: 4.4.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -619,6 +619,12 @@ importers: specifier: 2.8.8 version: 2.8.8 + packages/e2e-assets: + devDependencies: + '@playwright/test': + specifier: 1.46.1 + version: 1.46.1 + packages/e2e-contract-tests: dependencies: '@fuels/connectors': @@ -3277,6 +3283,11 @@ packages: engines: {node: '>=18'} hasBin: true + '@playwright/test@1.49.1': + resolution: {integrity: sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==} + engines: {node: '>=18'} + hasBin: true + '@pmmmwh/react-refresh-webpack-plugin@0.5.10': resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} @@ -10953,11 +10964,21 @@ packages: engines: {node: '>=18'} hasBin: true + playwright-core@1.49.1: + resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} + engines: {node: '>=18'} + hasBin: true + playwright@1.46.1: resolution: {integrity: sha512-oPcr1yqoXLCkgKtD5eNUPLiN40rYEM39odNpIb6VE6S7/15gJmA1NzVv6zJYusV0e7tzvkU/utBFNa/Kpxmwng==} engines: {node: '>=18'} hasBin: true + playwright@1.49.1: + resolution: {integrity: sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==} + engines: {node: '>=18'} + hasBin: true + plyr-react@5.3.0: resolution: {integrity: sha512-m36/HrpHwg1N2rq3E31E8/kpAH55vk6qHUg17MG4uu9jbWYxnkN39lLmZQwxW7/qpDPfW5aGUJ6R3u23V0R3zA==} engines: {node: '>=16'} @@ -18927,6 +18948,11 @@ snapshots: dependencies: playwright: 1.46.1 + '@playwright/test@1.49.1': + dependencies: + playwright: 1.49.1 + optional: true + '@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.11.0)(type-fest@2.19.0)(webpack-hot-middleware@2.25.4)(webpack@5.88.2(@swc/core@1.3.92(@swc/helpers@0.5.11))(esbuild@0.18.20))': dependencies: ansi-html-community: 0.0.8 @@ -30238,7 +30264,7 @@ snapshots: transitivePeerDependencies: - supports-color - next@14.2.12(@babel/core@7.23.2)(@playwright/test@1.46.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.12(@babel/core@7.23.2)(@playwright/test@1.49.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 14.2.12 '@swc/helpers': 0.5.5 @@ -30259,7 +30285,7 @@ snapshots: '@next/swc-win32-arm64-msvc': 14.2.12 '@next/swc-win32-ia32-msvc': 14.2.12 '@next/swc-win32-x64-msvc': 14.2.12 - '@playwright/test': 1.46.1 + '@playwright/test': 1.49.1 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -30717,12 +30743,22 @@ snapshots: playwright-core@1.46.1: {} + playwright-core@1.49.1: + optional: true + playwright@1.46.1: dependencies: playwright-core: 1.46.1 optionalDependencies: fsevents: 2.3.2 + playwright@1.49.1: + dependencies: + playwright-core: 1.49.1 + optionalDependencies: + fsevents: 2.3.2 + optional: true + plyr-react@5.3.0(plyr@3.7.8)(react@18.3.1): dependencies: plyr: 3.7.8