Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,25 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: E2E Tests
run: . ./build_and_run_e2e.sh

- name: Upload e2e VRT baseline
- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v6
with:
name: vrt-baseline
path: test/e2e/vrt/baseline
name: playwright-report
path: playwright-report/

- name: Upload e2e VRT report
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v6
with:
name: vrt-report
path: vrt-report
name: test-results
path: test-results/

e2e-with-all-experiments-enabled:
runs-on: ubuntu-latest
Expand All @@ -72,22 +75,25 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: E2E Tests with all experiments enabled
run: . ./build_and_run_e2e.sh all_experiments_enabled

- name: Upload e2e with all experiments VRT baseline
- name: Upload Playwright Report
if: always()
uses: actions/upload-artifact@v6
with:
name: all-experiments-vrt-baseline
path: test/e2e/vrt/baseline
name: all-experiments-playwright-report
path: playwright-report/

- name: Upload e2e with all experiments VRT report
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v6
with:
name: all-experiments-vrt-report
path: vrt-report
name: all-experiments-test-results
path: test-results/

binaries:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ node_modules
.tm_properties
.settings
.vscode
tests_output
playwright-report/
test-results/
typings
typings.json
build-system/runner/TESTS-TestSuites.xml
test/coverage
vrt-report
yarn.lock
6 changes: 6 additions & 0 deletions build-system/tasks/check-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ function normalizeRelativePath(path) {
* false otherwise
*/
function matchTerms(file, terms) {
if (!file.contents) {
return false;
}
const contents = stripComments(file.contents.toString());
const relative = normalizeRelativePath(file.relative);
return Object.keys(terms)
Expand Down Expand Up @@ -325,6 +328,9 @@ function hasAnyTerms(file) {
* content, false otherwise
*/
function isMissingTerms(file) {
if (!file.contents) {
return false;
}
const contents = file.contents.toString();
return Object.keys(requiredTerms)
.map((term) => {
Expand Down
39 changes: 26 additions & 13 deletions build-system/tasks/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,44 @@
*/
'use strict';

const args = require('./args');
const {execOrDie} = require('../exec');

async function e2e() {
// Load this on-demand to support optional dependencies.
const nightwatch = require('nightwatch');
nightwatch.cli(async (argv) => {
argv.config = 'test/e2e/nightwatch.conf.js';
const env = args.env || '';
const updateSnapshots =
args['update-screenshots'] || args['update-snapshots']
? '--update-snapshots'
: '';

const grep = args.tag ? `--grep "@${args.tag}"` : '';
const grepInvert = args.skiptags
? `--grep-invert "@${args.skiptags.split(',').join('|@')}"`
: '';

const runner = nightwatch.CliRunner(argv);
runner.setup();
if (env === 'all_experiments_enabled') {
process.env.SWG_EXPERIMENTS = [
'logging-audience-activity',
'disable-desktop-miniprompt',
'background_click_behavior_experiment',
].join(',');
}

try {
await runner.runTests();
} catch (err) {
console.error('An error occurred:', err);
}
});
const cmd = `npx playwright test ${updateSnapshots} ${grep} ${grepInvert}`;
console.log('Running e2e command:', cmd);
execOrDie(cmd);
}

module.exports = {
e2e,
};
e2e.description = 'Run e2e tests';
e2e.description = 'Run e2e tests via Playwright';
e2e.flags = {
'tag':
' Filter test modules by tags. Only tests that have the specified will be' +
' loaded',
'skiptags':
' Skips tests that have the specified tag or tags (comma separated).',
'update-screenshots':
'Updates VRT snapshots using playwright --update-snapshots',
};
Loading
Loading