Skip to content

Commit adf7ee8

Browse files
Initial setup
1 parent 54e30f9 commit adf7ee8

File tree

7 files changed

+2216
-6
lines changed

7 files changed

+2216
-6
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v2
14+
with:
15+
node-version: '14.x'
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v2
23+
if: always()
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

package-lock.json

Lines changed: 1631 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"sorttable": "^1.0.2"
2121
},
2222
"devDependencies": {
23+
"@playwright/test": "^1.20.0",
2324
"gulp": "^4.0.2",
2425
"gulp-cli": "^2.3.0",
2526
"gulp-concat": "^2.6.1",

playwright.config.js

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// @ts-check
2+
const { devices } = require('@playwright/test');
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// require('dotenv').config();
9+
10+
11+
/**
12+
* @see https://playwright.dev/docs/test-configuration
13+
* @type {import('@playwright/test').PlaywrightTestConfig}
14+
*/
15+
const config = {
16+
testDir: './ynr/apps/frontend/tests/playwright/',
17+
/* Maximum time one test can run for. */
18+
timeout: 30 * 1000,
19+
expect: {
20+
/**
21+
* Maximum time expect() should wait for the condition to be met.
22+
* For example in `await expect(locator).toHaveText();`
23+
*/
24+
timeout: 5000
25+
},
26+
/* Fail the build on CI if you accidentally left test.only in the source code. */
27+
forbidOnly: !!process.env.CI,
28+
/* Retry on CI only */
29+
retries: process.env.CI ? 2 : 0,
30+
/* Opt out of parallel tests on CI. */
31+
workers: process.env.CI ? 1 : undefined,
32+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
33+
reporter: 'html',
34+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
35+
use: {
36+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
37+
actionTimeout: 0,
38+
/* Base URL to use in actions like `await page.goto('/')`. */
39+
baseURL: 'http://localhost:8000/',
40+
41+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
42+
trace: 'on-first-retry',
43+
},
44+
45+
/* Configure projects for major browsers */
46+
projects: [
47+
{
48+
name: 'chromium',
49+
use: {
50+
...devices['Desktop Chrome'],
51+
},
52+
},
53+
54+
{
55+
name: 'firefox',
56+
use: {
57+
...devices['Desktop Firefox'],
58+
},
59+
},
60+
61+
{
62+
name: 'webkit',
63+
use: {
64+
...devices['Desktop Safari'],
65+
},
66+
},
67+
{
68+
name: 'ie11',
69+
use: {
70+
...devices['Internet Explorer 11'],
71+
},
72+
},
73+
74+
/* Test against mobile viewports. */
75+
{
76+
name: 'Mobile Chrome',
77+
use: {
78+
...devices['Pixel 5'],
79+
},
80+
},
81+
{
82+
name: 'Mobile Safari',
83+
use: {
84+
...devices['iPhone 12'],
85+
},
86+
},
87+
88+
/* Test against branded browsers. */
89+
// {
90+
// name: 'Microsoft Edge',
91+
// use: {
92+
// channel: 'msedge',
93+
// },
94+
// },
95+
{
96+
name: 'Google Chrome',
97+
use: {
98+
channel: 'chrome',
99+
},
100+
},
101+
],
102+
103+
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
104+
// outputDir: 'test-results/',
105+
106+
/* Run your local dev server before starting the tests */
107+
// webServer: {
108+
// command: 'npm run start',
109+
// port: 3000,
110+
// },
111+
};
112+
113+
module.exports = config;

0 commit comments

Comments
 (0)