[e2e] Update Playwright config to include MMOC and Ipad (#4717)

Co-authored-by: unlikelyzero <jchill2@gmail.com>
This commit is contained in:
John Hill 2022-01-14 14:47:35 -08:00 committed by GitHub
parent c39593b065
commit 19b3be7ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 4 deletions

View File

@ -23,6 +23,7 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- run: npx playwright install-deps
- run: npm install - run: npm install
- run: npm run test:e2e:full - run: npm run test:e2e:full
- name: Archive test results - name: Archive test results

View File

@ -16,6 +16,7 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: '14'
- run: npx playwright install-deps
- run: npm install - run: npm install
- name: Run the e2e visual tests - name: Run the e2e visual tests
run: npm run test:e2e:visual run: npm run test:e2e:visual

5
e2e/.percy.yml Normal file
View File

@ -0,0 +1,5 @@
version: 2
snapshot:
widths: [1024, 2000]
min-height: 1440 # px

View File

@ -2,6 +2,8 @@
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
const { devices } = require('@playwright/test');
/** @type {import('@playwright/test').PlaywrightTestConfig} */ /** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = { const config = {
retries: 2, retries: 2,
@ -15,7 +17,6 @@ const config = {
}, },
workers: 2, //Limit to 2 for CircleCI Agent workers: 2, //Limit to 2 for CircleCI Agent
use: { use: {
browserName: "chromium",
baseURL: 'http://localhost:8080/', baseURL: 'http://localhost:8080/',
headless: true, headless: true,
ignoreHTTPSErrors: true, ignoreHTTPSErrors: true,
@ -23,10 +24,37 @@ const config = {
trace: 'on', trace: 'on',
video: 'on' video: 'on'
}, },
projects: [
{
name: 'chrome',
use: {
browserName: 'chromium',
...devices['Desktop Chrome']
}
},
{
name: 'MMOC',
use: {
browserName: 'chromium',
viewport: {
width: 2560,
height: 1440
}
}
},
{
name: 'ipad',
use: {
browserName: 'webkit',
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
}
}
],
reporter: [ reporter: [
['list'], ['list'],
['junit', { outputFile: 'test-results/results.xml' }], ['junit', { outputFile: 'test-results/results.xml' }],
['allure-playwright'] ['allure-playwright'],
['github']
] ]
}; };

View File

@ -13,6 +13,7 @@ const config = {
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI reuseExistingServer: !process.env.CI
}, },
workers: 1,
use: { use: {
browserName: "chromium", browserName: "chromium",
baseURL: 'http://localhost:8080/', baseURL: 'http://localhost:8080/',

View File

@ -96,9 +96,9 @@
"test:debug": "cross-env NODE_ENV=debug karma start --no-single-run", "test:debug": "cross-env NODE_ENV=debug karma start --no-single-run",
"test:coverage": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" COVERAGE=true karma start --single-run", "test:coverage": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" COVERAGE=true karma start --single-run",
"test:coverage:firefox": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run --browsers=FirefoxHeadless", "test:coverage:firefox": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run --browsers=FirefoxHeadless",
"test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js smoke default condition.e2e", "test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome smoke default condition.e2e",
"test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js", "test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js",
"test:e2e:visual": "percy exec -- npx playwright test --config=e2e/playwright-visual.config.js default", "test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js default",
"test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js", "test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js",
"test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run", "test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run",
"verify": "concurrently 'npm:test' 'npm:lint'", "verify": "concurrently 'npm:test' 'npm:lint'",