-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add integration tests using Playwright and Puppeteer (#627)
* feat: add integration tests * fix: add readme test instructions * fix: add jest types * fix: normalize await calls * fix: development readme instructions * fix: use getByLabel instead of ids * fix: remove try/catch * feat: add playwright testing tool * fix: update readme test command * fix: removing args from Puppeteer launch fix: removing setViewport * fix: puppeteer args tags * fix: yarn installation at playwright gh workflow * fix: playwright commands * fix: playwright headfull image * docs: formatting #556 * test: change default wallet create url * chore: remove conflicts * chore: exclude playwright tests from default jest run * chore: adjusted playwirght setup - reduced to one browser and one test for now to first make it run again - adjusted readme - minor changes * test: update to match current UI * chore(ci): run playwright tests on open PRs * chore(deps): minor deps * chore: comment out tests for now * chore(playwright): get extension-id via test #556 * test(e2e): add exec path accpring to mujo-code/puppeteer-headful docs #556 * test(e2e): switch path to use prod #556 * test(alby): adjust create wallet test #556 * chore(e2e): adjust playwright setup #556 * test(albywallet): simplify test for now #556 also adjust extension path for CI * chore: split up test scripts #556 * docs: add tool links and chrome-only info #556 * chore: add info why on-fail screenshots etc are not working #556 * chore: cleanup #556 * chore(e2e): move extension-load code to helpers #556 * chore(e2e): make page var more descriptive #556 * test(albywallet): reduce test for now #556 * chore: fix test commands #556 Co-authored-by: escapedcat <[email protected]> Co-authored-by: kiwiidb <[email protected]>
- Loading branch information
1 parent
b230f21
commit 49ebeca
Showing
12 changed files
with
620 additions
and
53 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,48 @@ | ||
name: E2E Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
e2e-tests: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
env: | ||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" | ||
with: | ||
node-version: "14.x" | ||
args: install | ||
|
||
- name: Install dependencies | ||
uses: borales/[email protected] | ||
with: | ||
cmd: install # will run `yarn install` command | ||
|
||
- name: Build | ||
uses: borales/[email protected] | ||
with: | ||
cmd: build:chrome # will run `yarn build` command | ||
|
||
- name: Test Code | ||
uses: mujo-code/puppeteer-headful@v2 | ||
env: | ||
CI: "true" | ||
with: | ||
args: npx playwright test | ||
|
||
- name: Artifact | ||
uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: playwright-artifcats | ||
path: | | ||
playwright-report/ | ||
test-results/ | ||
retention-days: 30 |
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 |
---|---|---|
|
@@ -21,4 +21,4 @@ jobs: | |
- run: yarn install | ||
|
||
- name: Testing | ||
run: yarn test | ||
run: yarn test:unit |
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
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,112 @@ | ||
import type { PlaywrightTestConfig } from "@playwright/test"; | ||
import { devices } from "@playwright/test"; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
const config: PlaywrightTestConfig = { | ||
testDir: "./tests/e2e", | ||
/* Maximum time one test can run for. */ | ||
timeout: 30 * 1000, | ||
expect: { | ||
/** | ||
* Maximum time expect() should wait for the condition to be met. | ||
* For example in `await expect(locator).toHaveText();` | ||
*/ | ||
timeout: 5000, | ||
}, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? "github" : "list", | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ | ||
// actionTimeout: 0, | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
// baseURL: 'http://localhost:3000', | ||
// | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
// Not working because (electron relate dbut same issue): | ||
// - https://github.com/microsoft/playwright/issues/8208 | ||
// - https://github.com/microsoft/playwright/issues/12774 | ||
// - https://github.com/microsoft/playwright/issues/12125 | ||
// | ||
// trace: "on", | ||
// video: "on", | ||
// screenshot: "on", | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { | ||
...devices["Desktop Chrome"], | ||
}, | ||
}, | ||
|
||
// { | ||
// name: "firefox", | ||
// use: { | ||
// ...devices["Desktop Firefox"], | ||
// }, | ||
// }, | ||
|
||
// { | ||
// name: "webkit", | ||
// use: { | ||
// ...devices["Desktop Safari"], | ||
// }, | ||
// }, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { | ||
// ...devices['Pixel 5'], | ||
// }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { | ||
// ...devices['iPhone 12'], | ||
// }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: "Microsoft Edge", | ||
// use: { | ||
// channel: "msedge", | ||
// }, | ||
// }, | ||
// { | ||
// name: "Google Chrome", | ||
// use: { | ||
// channel: "chrome", | ||
// }, | ||
// }, | ||
], | ||
|
||
/* Folder for test artifacts such as screenshots, videos, traces, etc. */ | ||
outputDir: "test-results/", | ||
|
||
/* Run your local dev server before starting the tests */ | ||
// webServer: { | ||
// command: 'npm run start', | ||
// port: 3000, | ||
// }, | ||
}; | ||
|
||
export default config; |
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
Oops, something went wrong.