Skip to content

Commit

Permalink
test(e2e): add asset validation tests and update workflow environment
Browse files Browse the repository at this point in the history
  • Loading branch information
nelitow committed Dec 12, 2024
1 parent 501896f commit 14eef3a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr-tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
timeout-minutes: 15
env:
NODE_ENV: test
READONLY_TESTNET_ASSETS_VIEW: ${{ secrets.READONLY_TESTNET_ASSETS_VIEW }}

- uses: actions/upload-artifact@v4
if: always()
Expand Down Expand Up @@ -94,6 +95,7 @@ jobs:
timeout-minutes: 15
env:
NODE_ENV: test
READONLY_TESTNET_ASSETS_VIEW: ${{ secrets.READONLY_TESTNET_ASSETS_VIEW }}

- uses: actions/upload-artifact@v4
if: always()
Expand Down
45 changes: 45 additions & 0 deletions packages/app/playwright/crx/assets.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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();
});
});
});

0 comments on commit 14eef3a

Please sign in to comment.