-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test configuration and structure:
- Updated ESLint configuration to include e2e tests. - Changed Playwright test directory from './tests' to './e2e'. - Adjusted TypeScript configuration to include e2e files. - Removed obsolete test files: example.spec.ts and wallet.spec.ts. Closes #243
- Loading branch information
1 parent
cd399ca
commit e96e175
Showing
7 changed files
with
126 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main, develop] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
flow-emulator: | ||
image: gcr.io/flow-container-registry/emulator:latest | ||
ports: | ||
- 3569:3569 | ||
options: >- | ||
--health-cmd "curl -f http://localhost:3569/v1/blocks/latest" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
|
||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: '9' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build test version | ||
run: pnpm run build:test | ||
env: | ||
NODE_ENV: test | ||
|
||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install --with-deps chromium | ||
|
||
- name: Run Playwright tests | ||
run: pnpm run test:e2e | ||
env: | ||
NODE_ENV: test | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
|
||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: '9' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run ESLint | ||
run: pnpm run lint | ||
|
||
- name: Check formatting | ||
run: pnpm run format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import path from 'path'; | ||
|
||
import { test, expect, chromium } from '@playwright/test'; | ||
|
||
test('Load extension', async () => { | ||
Check failure on line 5 in e2e/wallet.test.ts GitHub Actions / build (22.x)e2e/wallet.test.ts
|
||
// Get path to extension | ||
const pathToExtension = path.join(__dirname, '../dist'); | ||
|
||
// Launch browser with extension | ||
const context = await chromium.launchPersistentContext('/tmp/test-user-data-dir', { | ||
headless: false, | ||
args: [`--disable-extensions-except=${pathToExtension}`, `--load-extension=${pathToExtension}`], | ||
}); | ||
|
||
// for manifest v3: | ||
let [background] = context.serviceWorkers(); | ||
if (!background) background = await context.waitForEvent('serviceworker'); | ||
|
||
// Get extension ID from service worker URL | ||
const extensionId = background.url().split('/')[2]; | ||
|
||
// Create a new page and navigate to extension | ||
const page = await context.newPage(); | ||
|
||
// Navigate and wait for network to be idle | ||
await page.goto(`chrome-extension://${extensionId}/index.html#/welcome`); | ||
|
||
// Wait for the welcome page to be fully loaded | ||
await page.waitForSelector('.welcomeBox', { state: 'visible' }); | ||
|
||
// Cleanup | ||
await context.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters