@element-hq/element-web-playwright-common 1.0.0 → 1.1.5
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/lib/expect/screenshot.d.ts +1 -2
- package/lib/expect/screenshot.d.ts.map +1 -1
- package/lib/fixtures/user.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -3
- package/lib/testcontainers/synapse.d.ts +1 -1
- package/lib/testcontainers/synapse.d.ts.map +1 -1
- package/lib/testcontainers/synapse.js +3 -4
- package/package.json +16 -5
- package/src/expect/screenshot.ts +1 -1
- package/src/fixtures/user.ts +1 -1
- package/src/index.ts +12 -3
- package/src/testcontainers/synapse.ts +3 -5
- package/lib/element-web-test.d.ts +0 -26
- package/lib/element-web-test.d.ts.map +0 -1
- package/lib/element-web-test.js +0 -54
- package/lib/expect/toHaveNoViolations.d.ts +0 -11
- package/lib/expect/toHaveNoViolations.d.ts.map +0 -1
- package/lib/expect/toHaveNoViolations.js +0 -22
- package/lib/expect/toMatchScreenshot.d.ts +0 -13
- package/lib/expect/toMatchScreenshot.d.ts.map +0 -1
- package/lib/expect/toMatchScreenshot.js +0 -44
- package/lib/expect/toPassAxeCheck.d.ts +0 -7
- package/lib/expect/toPassAxeCheck.d.ts.map +0 -1
- package/lib/expect/toPassAxeCheck.js +0 -22
- package/lib/logger.d.ts +0 -10
- package/lib/logger.d.ts.map +0 -1
- package/lib/logger.js +0 -59
- package/lib/playwright.d.ts +0 -2
- package/lib/playwright.d.ts.map +0 -1
- package/lib/playwright.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type ExpectMatcherState, type Locator, type Page, type PageAssertionsToHaveScreenshotOptions } from "@playwright/test";
|
|
2
|
-
import { type MatcherReturnType } from "playwright/types/test";
|
|
1
|
+
import { type ExpectMatcherState, type Locator, type Page, type PageAssertionsToHaveScreenshotOptions, type MatcherReturnType } from "@playwright/test";
|
|
3
2
|
export interface ToMatchScreenshotOptions extends PageAssertionsToHaveScreenshotOptions {
|
|
4
3
|
css?: string;
|
|
5
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/expect/screenshot.ts"],"names":[],"mappings":"AAQA,OAAO,EAIH,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,qCAAqC,
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/expect/screenshot.ts"],"names":[],"mappings":"AAQA,OAAO,EAIH,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,qCAAqC,EAC1C,KAAK,iBAAiB,EACzB,MAAM,kBAAkB,CAAC;AAW1B,MAAM,WAAW,wBAAyB,SAAQ,qCAAqC;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,iBAAiB,EAAE,CACf,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,IAAI,GAAG,OAAO,EACxB,IAAI,EAAE,GAAG,MAAM,MAAM,EACrB,OAAO,CAAC,EAAE,wBAAwB,KACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,gDAiCjB,CAAC"}
|
package/lib/fixtures/user.js
CHANGED
|
@@ -32,7 +32,7 @@ export const test = base.extend({
|
|
|
32
32
|
window.localStorage.setItem("mx_has_access_token", "true");
|
|
33
33
|
window.localStorage.setItem("mx_local_settings", JSON.stringify({
|
|
34
34
|
// Retain any other settings which may have already been set
|
|
35
|
-
...JSON.parse(window.localStorage.getItem("mx_local_settings")
|
|
35
|
+
...JSON.parse(window.localStorage.getItem("mx_local_settings") ?? "{}"),
|
|
36
36
|
// Ensure the language is set to a consistent value
|
|
37
37
|
language: "en",
|
|
38
38
|
}));
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface Config extends BaseConfig {
|
|
|
10
10
|
server_name?: string;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
enable_presence_by_hs_url?: Record<string, boolean>;
|
|
13
14
|
setting_defaults: Record<string, unknown>;
|
|
14
15
|
map_style_url?: string;
|
|
15
16
|
features: Record<string, boolean>;
|
|
@@ -22,6 +23,7 @@ export interface TestFixtures {
|
|
|
22
23
|
*/
|
|
23
24
|
config: Partial<typeof CONFIG_JSON>;
|
|
24
25
|
labsFlags: string[];
|
|
26
|
+
disablePresence: boolean;
|
|
25
27
|
}
|
|
26
28
|
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & {
|
|
27
29
|
axe: import("@axe-core/playwright").AxeBuilder;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAU/E,MAAM,WAAW,MAAO,SAAQ,UAAU;IACtC,qBAAqB,EAAE;QACnB,cAAc,CAAC,EAAE;YACb,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,mBAAmB,CAAC,EAAE;YAClB,QAAQ,EAAE,MAAM,CAAC;YACjB,WAAW,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;KACL,CAAC;IACF,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAGD,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,MAAM,C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= {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
export const test = base.extend({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
// We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier
|
|
28
|
+
config: async ({}, use) => use({}),
|
|
29
|
+
labsFlags: async ({}, use) => use([]),
|
|
30
|
+
disablePresence: async ({}, use) => use(false),
|
|
31
|
+
page: async ({ homeserver, context, page, config, labsFlags, disablePresence }, use) => {
|
|
30
32
|
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
|
31
33
|
const json = {
|
|
32
34
|
...CONFIG_JSON,
|
|
@@ -46,6 +48,11 @@ export const test = base.extend({
|
|
|
46
48
|
return obj;
|
|
47
49
|
}, {}),
|
|
48
50
|
};
|
|
51
|
+
if (disablePresence) {
|
|
52
|
+
json["enable_presence_by_hs_url"] = {
|
|
53
|
+
[homeserver.baseUrl]: false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
49
56
|
await route.fulfill({ json });
|
|
50
57
|
});
|
|
51
58
|
await use(page);
|
|
@@ -153,7 +153,7 @@ export type SynapseConfig = typeof DEFAULT_CONFIG;
|
|
|
153
153
|
export declare class SynapseContainer extends GenericContainer implements HomeserverContainer<SynapseConfig> {
|
|
154
154
|
private config;
|
|
155
155
|
private mas?;
|
|
156
|
-
constructor();
|
|
156
|
+
constructor(image?: string);
|
|
157
157
|
withConfigField(key: string, value: unknown): this;
|
|
158
158
|
withConfig(config: Partial<SynapseConfig>): this;
|
|
159
159
|
withSmtpServer(mailpit: StartedMailpitContainer): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synapse.d.ts","sourceRoot":"","sources":["../../src/testcontainers/synapse.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAE5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK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OAKG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAInG;;;;;OAKG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
2
|
+
Copyright 2024-2025 New Vector Ltd.
|
|
3
3
|
|
|
4
4
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
@@ -12,7 +12,6 @@ import { getFreePort } from "../utils/port.js";
|
|
|
12
12
|
import { randB64Bytes } from "../utils/rand.js";
|
|
13
13
|
import { deepCopy } from "../utils/object.js";
|
|
14
14
|
import { Api, ClientServerApi } from "../utils/api.js";
|
|
15
|
-
const TAG = "develop@sha256:8d0049e8e0524ad6817cf7737453fe47de1ed3b8d04704f0c2fd6c136414c9d7";
|
|
16
15
|
const DEFAULT_CONFIG = {
|
|
17
16
|
server_name: "localhost",
|
|
18
17
|
public_baseurl: "", // set by start method
|
|
@@ -141,8 +140,8 @@ const DEFAULT_CONFIG = {
|
|
|
141
140
|
export class SynapseContainer extends GenericContainer {
|
|
142
141
|
config;
|
|
143
142
|
mas;
|
|
144
|
-
constructor() {
|
|
145
|
-
super(
|
|
143
|
+
constructor(image = "ghcr.io/element-hq/synapse:develop") {
|
|
144
|
+
super(image);
|
|
146
145
|
this.config = deepCopy(DEFAULT_CONFIG);
|
|
147
146
|
this.config.registration_shared_secret = randB64Bytes(16);
|
|
148
147
|
this.config.macaroon_secret_key = randB64Bytes(16);
|
package/package.json
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@element-hq/element-web-playwright-common",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.5",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/element-hq/element-modules.git",
|
|
9
|
+
"directory": "packages/element-web-playwright-common"
|
|
10
|
+
},
|
|
11
|
+
"author": "element-hq",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20.0.0"
|
|
14
|
+
},
|
|
6
15
|
"main": "lib/index.js",
|
|
7
16
|
"bin": {
|
|
8
|
-
"playwright-screenshots": "
|
|
17
|
+
"playwright-screenshots": "playwright-screenshots.sh"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepare": "tsc",
|
|
21
|
+
"test": "echo No tests for @element-hq/element-web-playwright-common"
|
|
9
22
|
},
|
|
10
23
|
"devDependencies": {
|
|
11
24
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -21,10 +34,8 @@
|
|
|
21
34
|
"yaml": "^2.7.0"
|
|
22
35
|
},
|
|
23
36
|
"peerDependencies": {
|
|
37
|
+
"@element-hq/element-web-module-api": "*",
|
|
24
38
|
"@playwright/test": "^1.51.0",
|
|
25
39
|
"playwright-core": "^1.51.0"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"prepare": "tsc"
|
|
29
40
|
}
|
|
30
41
|
}
|
package/src/expect/screenshot.ts
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
type Locator,
|
|
15
15
|
type Page,
|
|
16
16
|
type PageAssertionsToHaveScreenshotOptions,
|
|
17
|
+
type MatcherReturnType,
|
|
17
18
|
} from "@playwright/test";
|
|
18
|
-
import { type MatcherReturnType } from "playwright/types/test";
|
|
19
19
|
import { sanitizeForFilePath } from "playwright-core/lib/utils";
|
|
20
20
|
import { extname } from "node:path";
|
|
21
21
|
|
package/src/fixtures/user.ts
CHANGED
|
@@ -74,7 +74,7 @@ export const test = base.extend<{
|
|
|
74
74
|
"mx_local_settings",
|
|
75
75
|
JSON.stringify({
|
|
76
76
|
// Retain any other settings which may have already been set
|
|
77
|
-
...JSON.parse(window.localStorage.getItem("mx_local_settings")
|
|
77
|
+
...JSON.parse(window.localStorage.getItem("mx_local_settings") ?? "{}"),
|
|
78
78
|
// Ensure the language is set to a consistent value
|
|
79
79
|
language: "en",
|
|
80
80
|
}),
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface Config extends BaseConfig {
|
|
|
27
27
|
server_name?: string;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
+
enable_presence_by_hs_url?: Record<string, boolean>;
|
|
30
31
|
setting_defaults: Record<string, unknown>;
|
|
31
32
|
map_style_url?: string;
|
|
32
33
|
features: Record<string, boolean>;
|
|
@@ -58,12 +59,15 @@ export interface TestFixtures {
|
|
|
58
59
|
config: Partial<typeof CONFIG_JSON>;
|
|
59
60
|
|
|
60
61
|
labsFlags: string[];
|
|
62
|
+
disablePresence: boolean;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export const test = base.extend<TestFixtures>({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
// We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier
|
|
67
|
+
config: async ({}, use) => use({}),
|
|
68
|
+
labsFlags: async ({}, use) => use([]),
|
|
69
|
+
disablePresence: async ({}, use) => use(false),
|
|
70
|
+
page: async ({ homeserver, context, page, config, labsFlags, disablePresence }, use) => {
|
|
67
71
|
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
|
68
72
|
const json = {
|
|
69
73
|
...CONFIG_JSON,
|
|
@@ -83,6 +87,11 @@ export const test = base.extend<TestFixtures>({
|
|
|
83
87
|
return obj;
|
|
84
88
|
}, {}),
|
|
85
89
|
};
|
|
90
|
+
if (disablePresence) {
|
|
91
|
+
json["enable_presence_by_hs_url"] = {
|
|
92
|
+
[homeserver.baseUrl]: false,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
86
95
|
await route.fulfill({ json });
|
|
87
96
|
});
|
|
88
97
|
await use(page);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
2
|
+
Copyright 2024-2025 New Vector Ltd.
|
|
3
3
|
|
|
4
4
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
@@ -25,8 +25,6 @@ import { type StartedMatrixAuthenticationServiceContainer } from "./mas.js";
|
|
|
25
25
|
import { Api, ClientServerApi, type Verb, type Credentials } from "../utils/api.js";
|
|
26
26
|
import { StartedMailpitContainer } from "./mailpit.js";
|
|
27
27
|
|
|
28
|
-
const TAG = "develop@sha256:8d0049e8e0524ad6817cf7737453fe47de1ed3b8d04704f0c2fd6c136414c9d7";
|
|
29
|
-
|
|
30
28
|
const DEFAULT_CONFIG = {
|
|
31
29
|
server_name: "localhost",
|
|
32
30
|
public_baseurl: "", // set by start method
|
|
@@ -193,8 +191,8 @@ export class SynapseContainer extends GenericContainer implements HomeserverCont
|
|
|
193
191
|
private config: SynapseConfig;
|
|
194
192
|
private mas?: StartedMatrixAuthenticationServiceContainer;
|
|
195
193
|
|
|
196
|
-
public constructor() {
|
|
197
|
-
super(
|
|
194
|
+
public constructor(image = "ghcr.io/element-hq/synapse:develop") {
|
|
195
|
+
super(image);
|
|
198
196
|
|
|
199
197
|
this.config = deepCopy(DEFAULT_CONFIG);
|
|
200
198
|
this.config.registration_shared_secret = randB64Bytes(16);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
declare const CONFIG_JSON: {
|
|
2
|
-
default_server_config: {};
|
|
3
|
-
setting_defaults: {
|
|
4
|
-
language: string;
|
|
5
|
-
};
|
|
6
|
-
map_style_url: string;
|
|
7
|
-
features: Record<string, boolean>;
|
|
8
|
-
};
|
|
9
|
-
export interface TestFixtures {
|
|
10
|
-
/**
|
|
11
|
-
* The contents of the config.json to send when the client requests it.
|
|
12
|
-
*/
|
|
13
|
-
config: Partial<typeof CONFIG_JSON>;
|
|
14
|
-
labsFlags: string[];
|
|
15
|
-
}
|
|
16
|
-
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & {
|
|
17
|
-
axe: import("@axe-core/playwright").AxeBuilder;
|
|
18
|
-
checkA11y: () => Promise<void>;
|
|
19
|
-
} & import("./fixtures/services").TestFixtures & {
|
|
20
|
-
displayName?: string;
|
|
21
|
-
credentials: import("./utils/api").Credentials;
|
|
22
|
-
pageWithCredentials: import("playwright-core").Page;
|
|
23
|
-
user: import("./utils/api").Credentials;
|
|
24
|
-
} & TestFixtures, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions & import("./fixtures/services").Services>;
|
|
25
|
-
export { expect } from "./expect";
|
|
26
|
-
//# sourceMappingURL=element-web-test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"element-web-test.d.ts","sourceRoot":"","sources":["../src/element-web-test.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,WAAW;;;;;;cAcR,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;IAEpC,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,IAAI;;;;;;;;8JA2Bf,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/lib/element-web-test.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
3
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
4
|
-
|
|
5
|
-
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
6
|
-
Please see LICENSE files in the repository root for full details.
|
|
7
|
-
*/
|
|
8
|
-
import { test as base } from "./fixtures";
|
|
9
|
-
// Enable experimental service worker support
|
|
10
|
-
// See https://playwright.dev/docs/service-workers-experimental#how-to-enable
|
|
11
|
-
process.env["PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS"] = "1";
|
|
12
|
-
// This is deliberately quite a minimal config.json, so that we can test that the default settings actually work.
|
|
13
|
-
const CONFIG_JSON = {
|
|
14
|
-
default_server_config: {},
|
|
15
|
-
// The default language is set here for test consistency
|
|
16
|
-
setting_defaults: {
|
|
17
|
-
language: "en-GB",
|
|
18
|
-
},
|
|
19
|
-
// the location tests want a map style url.
|
|
20
|
-
map_style_url: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
|
|
21
|
-
features: {
|
|
22
|
-
// We don't want to go through the feature announcement during the e2e test
|
|
23
|
-
feature_release_announcement: false,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
export const test = base.extend({
|
|
27
|
-
config: {}, // We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier
|
|
28
|
-
labsFlags: [],
|
|
29
|
-
page: async ({ homeserver, context, page, config, labsFlags }, use) => {
|
|
30
|
-
await context.route(`http://localhost:8080/config.json*`, async (route) => {
|
|
31
|
-
const json = {
|
|
32
|
-
...CONFIG_JSON,
|
|
33
|
-
...config,
|
|
34
|
-
default_server_config: {
|
|
35
|
-
"m.homeserver": {
|
|
36
|
-
base_url: homeserver.baseUrl,
|
|
37
|
-
},
|
|
38
|
-
...config.default_server_config,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
json["features"] = {
|
|
42
|
-
...json["features"],
|
|
43
|
-
// Enable the lab features
|
|
44
|
-
...labsFlags.reduce((obj, flag) => {
|
|
45
|
-
obj[flag] = true;
|
|
46
|
-
return obj;
|
|
47
|
-
}, {}),
|
|
48
|
-
};
|
|
49
|
-
await route.fulfill({ json });
|
|
50
|
-
});
|
|
51
|
-
await use(page);
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
export { expect } from "./expect";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ExpectMatcherState, type MatcherReturnType } from "@playwright/test";
|
|
2
|
-
import type AxeBuilder from "@axe-core/playwright";
|
|
3
|
-
export type Expectations = {
|
|
4
|
-
/**
|
|
5
|
-
* Assert that the given AxeBuilder instance has no violations.
|
|
6
|
-
* @param receiver - The AxeBuilder instance to check.
|
|
7
|
-
*/
|
|
8
|
-
toHaveNoViolations: (this: ExpectMatcherState, receiver: AxeBuilder) => Promise<MatcherReturnType>;
|
|
9
|
-
};
|
|
10
|
-
export declare const expect: import("playwright/test").Expect<Expectations>;
|
|
11
|
-
//# sourceMappingURL=toHaveNoViolations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toHaveNoViolations.d.ts","sourceRoot":"","sources":["../../src/expect/toHaveNoViolations.ts"],"names":[],"mappings":"AAQA,OAAO,EAA8B,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE/G,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG;IACvB;;;OAGG;IACH,kBAAkB,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACtG,CAAC;AAEF,eAAO,MAAM,MAAM,gDAgBjB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
3
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
4
|
-
|
|
5
|
-
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
6
|
-
Please see LICENSE files in the repository root for full details.
|
|
7
|
-
*/
|
|
8
|
-
import { test, expect as baseExpect } from "@playwright/test";
|
|
9
|
-
export const expect = baseExpect.extend({
|
|
10
|
-
async toHaveNoViolations(receiver) {
|
|
11
|
-
const testInfo = test.info();
|
|
12
|
-
if (!testInfo)
|
|
13
|
-
throw new Error(`toHaveNoViolations() must be called during the test`);
|
|
14
|
-
const results = await receiver.analyze();
|
|
15
|
-
await testInfo.attach("accessibility-scan-results", {
|
|
16
|
-
body: JSON.stringify(results, null, 2),
|
|
17
|
-
contentType: "application/json",
|
|
18
|
-
});
|
|
19
|
-
baseExpect(results.violations).toEqual([]);
|
|
20
|
-
return { pass: true, message: () => "", name: "toHaveNoViolations" };
|
|
21
|
-
},
|
|
22
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type ExpectMatcherState, type Locator, type Page } from "@playwright/test";
|
|
2
|
-
import { type MatcherReturnType } from "playwright/types/test";
|
|
3
|
-
export type Expectations = {
|
|
4
|
-
toMatchScreenshot: (this: ExpectMatcherState, receiver: Page | Locator, name: `${string}.png`, options?: {
|
|
5
|
-
mask?: Array<Locator>;
|
|
6
|
-
includeDialogBackground?: boolean;
|
|
7
|
-
showTooltips?: boolean;
|
|
8
|
-
timeout?: number;
|
|
9
|
-
css?: string;
|
|
10
|
-
}) => Promise<MatcherReturnType>;
|
|
11
|
-
};
|
|
12
|
-
export declare const expect: import("playwright/test").Expect<Expectations>;
|
|
13
|
-
//# sourceMappingURL=toMatchScreenshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toMatchScreenshot.d.ts","sourceRoot":"","sources":["../../src/expect/toMatchScreenshot.ts"],"names":[],"mappings":"AAQA,OAAO,EAIH,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,IAAI,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAW/D,MAAM,MAAM,YAAY,GAAG;IACvB,iBAAiB,EAAE,CACf,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,IAAI,GAAG,OAAO,EACxB,IAAI,EAAE,GAAG,MAAM,MAAM,EACrB,OAAO,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,KACA,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,MAAM,gDAkCjB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
3
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
4
|
-
|
|
5
|
-
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
6
|
-
Please see LICENSE files in the repository root for full details.
|
|
7
|
-
*/
|
|
8
|
-
import { test, expect as baseExpect, } from "@playwright/test";
|
|
9
|
-
import { sanitizeForFilePath } from "playwright-core/lib/utils";
|
|
10
|
-
import { extname } from "node:path";
|
|
11
|
-
// Based on https://github.com/microsoft/playwright/blob/2b77ed4d7aafa85a600caa0b0d101b72c8437eeb/packages/playwright/src/util.ts#L206C8-L210C2
|
|
12
|
-
function sanitizeFilePathBeforeExtension(filePath) {
|
|
13
|
-
const ext = extname(filePath);
|
|
14
|
-
const base = filePath.substring(0, filePath.length - ext.length);
|
|
15
|
-
return sanitizeForFilePath(base) + ext;
|
|
16
|
-
}
|
|
17
|
-
export const expect = baseExpect.extend({
|
|
18
|
-
async toMatchScreenshot(receiver, name, options) {
|
|
19
|
-
const testInfo = test.info();
|
|
20
|
-
if (!testInfo)
|
|
21
|
-
throw new Error(`toMatchScreenshot() must be called during the test`);
|
|
22
|
-
if (!testInfo.tags.includes("@screenshot")) {
|
|
23
|
-
throw new Error("toMatchScreenshot() must be used in a test tagged with @screenshot");
|
|
24
|
-
}
|
|
25
|
-
const page = "page" in receiver ? receiver.page() : receiver;
|
|
26
|
-
let style;
|
|
27
|
-
if (options?.css) {
|
|
28
|
-
// We add a custom style tag before taking screenshots
|
|
29
|
-
style = (await page.addStyleTag({
|
|
30
|
-
content: options.css,
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
const screenshotName = sanitizeFilePathBeforeExtension(name);
|
|
34
|
-
await baseExpect(receiver).toHaveScreenshot(screenshotName, options);
|
|
35
|
-
await style?.evaluate((tag) => tag.remove());
|
|
36
|
-
testInfo.annotations.push({
|
|
37
|
-
// `_` prefix hides it from the HTML reporter
|
|
38
|
-
type: "_screenshot",
|
|
39
|
-
// include a path relative to `playwright/snapshots/`
|
|
40
|
-
description: testInfo.snapshotPath(screenshotName).split("/playwright/snapshots/", 2)[1],
|
|
41
|
-
});
|
|
42
|
-
return { pass: true, message: () => "", name: "toMatchScreenshot" };
|
|
43
|
-
},
|
|
44
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type ExpectMatcherState, type MatcherReturnType } from "@playwright/test";
|
|
2
|
-
import type AxeBuilder from "@axe-core/playwright";
|
|
3
|
-
export type Expectations = {
|
|
4
|
-
toPassAxeCheck: (this: ExpectMatcherState, receiver: AxeBuilder) => Promise<MatcherReturnType>;
|
|
5
|
-
};
|
|
6
|
-
export declare const expect: import("playwright/test").Expect<Expectations>;
|
|
7
|
-
//# sourceMappingURL=toPassAxeCheck.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toPassAxeCheck.d.ts","sourceRoot":"","sources":["../../src/expect/toPassAxeCheck.ts"],"names":[],"mappings":"AAQA,OAAO,EAA8B,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE/G,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG;IACvB,cAAc,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClG,CAAC;AAEF,eAAO,MAAM,MAAM,gDAgBjB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
3
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
4
|
-
|
|
5
|
-
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
6
|
-
Please see LICENSE files in the repository root for full details.
|
|
7
|
-
*/
|
|
8
|
-
import { test, expect as baseExpect } from "@playwright/test";
|
|
9
|
-
export const expect = baseExpect.extend({
|
|
10
|
-
async toPassAxeCheck(receiver) {
|
|
11
|
-
const testInfo = test.info();
|
|
12
|
-
if (!testInfo)
|
|
13
|
-
throw new Error(`toPassAxeCheck() must be called during the test`);
|
|
14
|
-
const results = await receiver.analyze();
|
|
15
|
-
await testInfo.attach("accessibility-scan-results", {
|
|
16
|
-
body: JSON.stringify(results, null, 2),
|
|
17
|
-
contentType: "application/json",
|
|
18
|
-
});
|
|
19
|
-
baseExpect(results.violations).toEqual([]);
|
|
20
|
-
return { pass: true, message: () => "", name: "toPassAxeCheck" };
|
|
21
|
-
},
|
|
22
|
-
});
|
package/lib/logger.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type BrowserContext, type TestInfo } from "@playwright/test";
|
|
2
|
-
import { type Readable } from "stream";
|
|
3
|
-
export declare class Logger {
|
|
4
|
-
private pages;
|
|
5
|
-
private logs;
|
|
6
|
-
getConsumer(container: string): (stream: Readable) => void;
|
|
7
|
-
onTestStarted(context: BrowserContext): Promise<void>;
|
|
8
|
-
onTestFinished(testInfo: TestInfo): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/lib/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAa,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC,qBAAa,MAAM;IACf,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,IAAI,CAA8B;IAEnC,WAAW,CAAC,SAAS,EAAE,MAAM,IAExB,QAAQ,QAAQ;IAUf,aAAa,CAAC,OAAO,EAAE,cAAc;IAyBrC,cAAc,CAAC,QAAQ,EAAE,QAAQ;CAWjD"}
|
package/lib/logger.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2024 New Vector Ltd.
|
|
3
|
-
|
|
4
|
-
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
5
|
-
Please see LICENSE files in the repository root for full details.
|
|
6
|
-
*/
|
|
7
|
-
import stripAnsi from "strip-ansi";
|
|
8
|
-
export class Logger {
|
|
9
|
-
pages = [];
|
|
10
|
-
logs = {};
|
|
11
|
-
getConsumer(container) {
|
|
12
|
-
this.logs[container] = "";
|
|
13
|
-
return (stream) => {
|
|
14
|
-
stream.on("data", (chunk) => {
|
|
15
|
-
this.logs[container] += chunk.toString();
|
|
16
|
-
});
|
|
17
|
-
stream.on("err", (chunk) => {
|
|
18
|
-
this.logs[container] += "ERR " + chunk.toString();
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
async onTestStarted(context) {
|
|
23
|
-
this.pages = [];
|
|
24
|
-
for (const id in this.logs) {
|
|
25
|
-
if (id.startsWith("page-")) {
|
|
26
|
-
delete this.logs[id];
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.logs[id] = "";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
context.on("console", (msg) => {
|
|
33
|
-
const page = msg.page();
|
|
34
|
-
if (!page)
|
|
35
|
-
return;
|
|
36
|
-
let pageIdx = this.pages.indexOf(page);
|
|
37
|
-
if (pageIdx === -1) {
|
|
38
|
-
this.pages.push(page);
|
|
39
|
-
pageIdx = this.pages.length - 1;
|
|
40
|
-
this.logs[`page-${pageIdx}`] = `Console logs for page with URL: ${page.url()}\n\n`;
|
|
41
|
-
}
|
|
42
|
-
const type = msg.type();
|
|
43
|
-
const text = msg.text();
|
|
44
|
-
this.logs[`page-${pageIdx}`] += `${type}: ${text}\n`;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
async onTestFinished(testInfo) {
|
|
48
|
-
if (testInfo.status !== "passed") {
|
|
49
|
-
for (const id in this.logs) {
|
|
50
|
-
if (!this.logs[id])
|
|
51
|
-
continue;
|
|
52
|
-
await testInfo.attach(id, {
|
|
53
|
-
body: stripAnsi(this.logs[id]),
|
|
54
|
-
contentType: "text/plain",
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
package/lib/playwright.d.ts
DELETED
package/lib/playwright.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/lib/playwright.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@playwright/test";
|