@atomicsmash/test-utils 1.2.0 → 1.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -20,12 +20,15 @@ export declare const playwrightConfig: {
20
20
  forbidOnly: boolean;
21
21
  retries: number;
22
22
  workers: number | undefined;
23
- reporter: "html";
23
+ reporter: "dot";
24
24
  projects: import("@playwright/test").Project<import("@playwright/test").PlaywrightTestOptions & {}, import("@playwright/test").PlaywrightWorkerOptions & {}>[];
25
25
  use: {
26
26
  actionTimeout: number;
27
27
  trace: "on-first-retry";
28
28
  };
29
+ webServer: {
30
+ command: string;
31
+ };
29
32
  };
30
33
  export declare const getLighthouseTest: (logInUser: AuthenticatePageFunction) => import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
31
34
  authenticatedPage: Page;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,IAAI,EACJ,cAAc,EACd,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAapD,MAAM,MAAM,QAAQ,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B,EAAE,CAAC;AAEJ,MAAM,MAAM,wBAAwB,GAAG,CACtC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,EACxB,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,KAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,eAAO,MAAM,wBAAwB,EAAE,oBAAoB,CAAC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,EACxB,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,KAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,eAAO,MAAM,wBAAwB,EAAE,oBAAoB,CAAC,UAAU,CA2BrE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAoBG,CAAC;AAEjC,eAAO,MAAM,iBAAiB,cAAe,wBAAwB;uBAE9C,IAAI;aAAW,cAAc;;UAC1C,MAAM;EA2Bf,CAAC;AAEF,KAAK,sBAAsB,GAAG,UAAU,CACvC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CACpC,CAAC,CAAC,CAAC,CAAC;AAEL,eAAO,MAAM,gBAAgB,EAAE,CAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,IAAI,EAAE,SAAS,GAAG,QAAQ,EAC1B,gBAAgB,CAAC,EAAE,OAAO,KACtB,sBA+BH,CAAC;AAEH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,IAAI,EACV,EACC,QAAQ,EACR,QAAQ,GACR,GAAE;IACF,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC5B,iBAiCN;AAED,eAAO,MAAM,oBAAoB;UAEP,IAAI;mBAS5B,CAAC;AACH,eAAO,MAAM,kBAAkB;uBAEqB,IAAI;mBAStD,CAAC"}
package/dist/index.js CHANGED
@@ -45,13 +45,16 @@ export const playwrightConfig = {
45
45
  forbidOnly: !!process.env.CI,
46
46
  retries: process.env.CI ? 2 : 0,
47
47
  workers: process.env.CI ? 1 : undefined,
48
- reporter: "html",
48
+ reporter: "dot",
49
49
  /* Configure projects for major browsers */
50
50
  projects: playwrightProjectsConfig,
51
51
  use: {
52
52
  actionTimeout: 0,
53
53
  trace: "on-first-retry",
54
54
  },
55
+ webServer: {
56
+ command: `cross-env NO_LOGS=true MOCKS=true npm run dev`,
57
+ },
55
58
  };
56
59
  export const getLighthouseTest = (logInUser) => {
57
60
  const lighthouseTest = base.extend({
@@ -83,6 +86,7 @@ export const getLighthouseTest = (logInUser) => {
83
86
  export const doLighthouseTest = (pageToTest, type, disableAuditLogs = false) => async function ({ port, authenticatedPage }) {
84
87
  await authenticatedPage.goto(pageToTest.url);
85
88
  await playAudit({
89
+ // TODO: Wait for playwright-lighthouse to update dependency constraint, then remove this "as" declaration.
86
90
  page: authenticatedPage,
87
91
  thresholds: {
88
92
  performance: 85,
@@ -108,6 +112,7 @@ export const doLighthouseTest = (pageToTest, type, disableAuditLogs = false) =>
108
112
  };
109
113
  export async function checkAccessibility(page, { includes, excludes, } = {}) {
110
114
  let builder;
115
+ // TODO: Wait for @wordpress/scripts to update dependency constraint, then remove this "as" declaration.
111
116
  builder = new AxeBuilder({ page });
112
117
  if (includes) {
113
118
  for (const include of includes) {
@@ -123,6 +128,7 @@ export async function checkAccessibility(page, { includes, excludes, } = {}) {
123
128
  const accessibilityScanResults = await builder.analyze();
124
129
  expect(accessibilityScanResults.violations.filter((violation) => {
125
130
  if (violation.id === "aria-allowed-attr" &&
131
+ violation.nodes[0] &&
126
132
  violation.nodes[0].html.startsWith("<button") &&
127
133
  violation.nodes[0].html.includes(`role="switch"`)) {
128
134
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicsmash/test-utils",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-beta.0",
4
4
  "type": "module",
5
5
  "description": "A collection of helper functions for automated testing with Playwright.",
6
6
  "keywords": [
@@ -42,12 +42,12 @@
42
42
  "lint:types": "tsc"
43
43
  },
44
44
  "peerDependencies": {
45
- "@playwright/test": "^1.35.1"
45
+ "@playwright/test": "^1.35.1",
46
+ "cross-env": "^7.0.3"
46
47
  },
47
48
  "dependencies": {
48
- "@axe-core/playwright": "^4.7.3",
49
+ "@axe-core/playwright": "^4.8.2",
49
50
  "get-port": "^7.0.0",
50
- "playwright-lighthouse": "^3.1.0",
51
- "lighthouse": "^11.0.0"
51
+ "playwright-lighthouse": "^3.2.5"
52
52
  }
53
53
  }