-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use playwright for e2e testing in event schedule app (#1412)
- Loading branch information
1 parent
78bf820
commit 5035cd2
Showing
70 changed files
with
848 additions
and
623 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 |
---|---|---|
|
@@ -95,12 +95,9 @@ jobs: | |
# determine the unique run id necessary to re-run the checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
cypress-run-event-schedule-app: | ||
e2e-event-schedule-app: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
container: | ||
image: cypress/browsers:node-20.14.0-chrome-126.0.6478.114-1-ff-127.0.1-edge-126.0.2592.61-1 | ||
options: --user 1001 | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
|
@@ -117,14 +114,12 @@ jobs: | |
cache: 'yarn' | ||
cache-dependency-path: yarn.lock | ||
|
||
# Set up GitHub Actions caching for Wireit. | ||
# - uses: google/wireit@setup-github-actions-caching/v1.0.2 | ||
|
||
# - run: echo '${{ toJSON(steps.setup_node_id.outputs) }}' | ||
# - if: ${{ steps.setup_node_id.outputs.cache-hit != 'true' }} | ||
- name: yarn install | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
|
||
- name: Build dependencies | ||
run: yarn zz:wsrun-stages --recursive -p @noshiro/event-schedule-app -c build | ||
|
||
|
@@ -134,26 +129,12 @@ jobs: | |
# - name: create runtimeconfig | ||
# run: yarn workspace @noshiro/event-schedule-app z:setup:fb:emulators:gen-dummy-runtimeconfig | ||
|
||
- name: Cypress run on Chrome | ||
uses: cypress-io/[email protected] | ||
- name: Run Playwright tests | ||
run: yarn workspace @noshiro/event-schedule-app e2e | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
# group: 'UI - Chrome' | ||
browser: chrome | ||
install: false | ||
working-directory: packages/apps/event-schedule-app/cypress | ||
# spec: cypress/e2e/**/*.cy.ts | ||
spec: cypress/e2e/display-create-event-page.cy.ts | ||
start: | | ||
yarn start:emulators:e2e | ||
yarn start:dev-server | ||
# wait-on: 'http://localhost:8080, http://localhost:8081, http://localhost:5001' | ||
wait-on: 'http://[::1]:5180' | ||
wait-on-timeout: 120 | ||
# headless: true | ||
# record: true | ||
# parallel: true | ||
env: | ||
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY_FOR_EVENT_SCHEDULE_APP }} | ||
# Recommended: pass the GitHub token lets this action correctly | ||
# determine the unique run id necessary to re-run the checks | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
name: playwright-report | ||
path: packages/apps/event-schedule-app/playwright-report/ | ||
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
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,89 @@ | ||
import { castMutable } from '@noshiro/mono-utils'; | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** Read environment variables from file. https://github.com/motdotla/dotenv */ | ||
// import dotenv from 'dotenv'; | ||
// import path from 'path'; | ||
// dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
|
||
/** See https://playwright.dev/docs/test-configuration. */ | ||
export const definePlaywrightConfig = ({ | ||
baseURL, | ||
testDir, | ||
webServer, | ||
}: Readonly<{ | ||
baseURL: string; | ||
testDir: string; | ||
// webServer?: readonly PlaywrightTestConfig['webServer'][]; | ||
webServer?: readonly Readonly<{ command: string; url: string }>[]; | ||
}>) => | ||
defineConfig({ | ||
testDir, | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: process.env['CI'] !== undefined, | ||
/* Retry on CI only */ | ||
retries: process.env['CI'] !== undefined ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env['CI'] !== undefined ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL, | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
|
||
testIdAttribute: 'data-e2e', | ||
}, | ||
|
||
/* 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: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: castMutable( | ||
webServer?.map(({ url, command }) => ({ | ||
url, | ||
command, | ||
reuseExistingServer: process.env['CI'] === undefined, | ||
})) ?? [], | ||
), | ||
}); |
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
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
Oops, something went wrong.