-
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.
Added basic check to check the extension loads and welcome is shown
- Loading branch information
1 parent
ba78dd6
commit cd399ca
Showing
3 changed files
with
54 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import path from 'path'; | ||
|
||
import { test, expect, chromium } from '@playwright/test'; | ||
|
||
test.describe('Extension Tests', () => { | ||
Check failure on line 5 in tests/wallet.spec.ts GitHub Actions / build (22.x)tests/wallet.spec.ts
|
||
test('extension is loaded', async () => { | ||
// 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' }); | ||
|
||
// Check for welcome page elements | ||
await expect(page.getByText('Welcome to Flow Wallet')).toBeVisible(); | ||
await expect(page.getByText('Create a new wallet')).toBeVisible(); | ||
await expect(page.getByText('Sync with Mobile App')).toBeVisible(); | ||
|
||
// Cleanup | ||
await context.close(); | ||
}); | ||
}); |