Skip to content

Commit

Permalink
Add a test to test a subset of sites from the coverage data
Browse files Browse the repository at this point in the history
  • Loading branch information
sammacbeth committed Dec 27, 2023
1 parent b3d2be6 commit 187a014
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"test:firefox": "playwright test --project firefox",
"test:chrome": "playwright test --project chrome",
"test:lib": "playwright test tests/rule-executors.spec.ts",
"test:sample": "playwright test tests/_sample-test.spec.ts --project chrome",
"fetch-fanboy-list": "wget https://www.fanboy.co.nz/fanboy-cookiemonster.txt",
"fetch-site-list": "curl https://s3.amazonaws.com/cdn.cliqz.com/re-consent/supported_sites.txt > sites.txt",
"build-rules": "node rules/build.mjs",
Expand Down
1 change: 1 addition & 0 deletions playwright/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { enableLogs } from "../lib/config";
import { AutoAction } from "../lib/types";

const testRegion = (process.env.REGION || "NA").trim();
test.describe.configure({ mode: 'parallel' });

type TestOptions = {
testOptOut: boolean;
Expand Down
15 changes: 15 additions & 0 deletions tests/_sample-test.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import coverageData from "../data/coverage.json";
import generateCMPTests from "../playwright/runner";

const region = (process.env.REGION || "US").trim();

Object.keys(coverageData).forEach((name) => {
if (!coverageData[name][region]) {
// no coverage in this region
return;
}
const siteList = coverageData[name][region].exampleSites.slice(0, 1);
generateCMPTests(name, siteList, {
testOptIn: false,
});
});

0 comments on commit 187a014

Please sign in to comment.