@element-hq/element-web-playwright-common 2.0.0 → 2.2.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/lib/expect/index.d.ts +2 -2
- package/lib/expect/index.d.ts.map +1 -1
- package/lib/fixtures/axe.d.ts +7 -2
- package/lib/fixtures/axe.d.ts.map +1 -1
- package/lib/fixtures/axe.js +3 -1
- package/lib/fixtures/index.d.ts +1 -8
- package/lib/fixtures/index.d.ts.map +1 -1
- package/lib/fixtures/index.js +3 -4
- package/lib/fixtures/user.d.ts +1 -1
- package/lib/fixtures/user.d.ts.map +1 -1
- package/lib/fixtures/user.js +4 -1
- package/lib/index.d.ts +3 -3
- package/lib/testcontainers/HomeserverContainer.d.ts +2 -2
- package/lib/testcontainers/HomeserverContainer.d.ts.map +1 -1
- package/lib/testcontainers/index.d.ts +1 -1
- package/lib/testcontainers/index.d.ts.map +1 -1
- package/lib/testcontainers/synapse.d.ts +43 -2
- package/lib/testcontainers/synapse.d.ts.map +1 -1
- package/lib/testcontainers/synapse.js +9 -1
- package/lib/utils/config_json.d.ts +2 -2
- package/lib/utils/config_json.d.ts.map +1 -1
- package/lib/utils/context.d.ts +4 -4
- package/lib/utils/context.d.ts.map +1 -1
- package/package.json +2 -2
- package/playwright-screenshots.sh +57 -14
- package/src/expect/index.ts +3 -3
- package/src/expect/screenshot.ts +1 -1
- package/src/fixtures/axe.ts +4 -1
- package/src/fixtures/index.ts +3 -6
- package/src/fixtures/user.ts +6 -2
- package/src/testcontainers/HomeserverContainer.ts +2 -2
- package/src/testcontainers/index.ts +1 -1
- package/src/testcontainers/synapse.ts +10 -2
- package/src/utils/config_json.ts +2 -2
- package/src/utils/context.ts +4 -4
package/lib/expect/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Expect } from "@playwright/test";
|
|
2
|
-
import { Expectations as ScreenshotExpectations, ToMatchScreenshotOptions } from "./screenshot.js";
|
|
3
|
-
import { Expectations as AxeExpectations } from "./axe.js";
|
|
2
|
+
import { type Expectations as ScreenshotExpectations, type ToMatchScreenshotOptions } from "./screenshot.js";
|
|
3
|
+
import { type Expectations as AxeExpectations } from "./axe.js";
|
|
4
4
|
export declare const expect: Expect<ScreenshotExpectations & AxeExpectations>;
|
|
5
5
|
export type { ToMatchScreenshotOptions };
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAEH,YAAY,IAAI,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAEH,KAAK,YAAY,IAAI,sBAAsB,EAC3C,KAAK,wBAAwB,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA6B,KAAK,YAAY,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3F,eAAO,MAAM,MAAM,EAA4D,MAAM,CACjF,sBAAsB,GAAG,eAAe,CAC3C,CAAC;AAEF,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|
package/lib/fixtures/axe.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import AxeBuilder from "@axe-core/playwright";
|
|
2
|
-
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & {
|
|
2
|
+
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("./services").TestFixtures & {
|
|
3
|
+
displayName?: string;
|
|
4
|
+
credentials: import("../utils/api").Credentials;
|
|
5
|
+
pageWithCredentials: import("playwright-core").Page;
|
|
6
|
+
user: import("../utils/api").Credentials;
|
|
7
|
+
} & {
|
|
3
8
|
/**
|
|
4
9
|
* AxeBuilder instance for the current page
|
|
5
10
|
*/
|
|
6
11
|
axe: AxeBuilder;
|
|
7
|
-
}, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions>;
|
|
12
|
+
}, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions & import("./services").WorkerOptions & import("./services").Services>;
|
|
8
13
|
//# sourceMappingURL=axe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axe.d.ts","sourceRoot":"","sources":["../../src/fixtures/axe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"axe.d.ts","sourceRoot":"","sources":["../../src/fixtures/axe.ts"],"names":[],"mappings":"AAQA,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAM9C,eAAO,MAAM,IAAI;;;;;;IACb;;OAEG;SACE,UAAU;2KAMjB,CAAC"}
|
package/lib/fixtures/axe.js
CHANGED
|
@@ -5,8 +5,10 @@ Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
|
5
5
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
6
6
|
Please see LICENSE files in the repository root for full details.
|
|
7
7
|
*/
|
|
8
|
-
import { test as base } from "@playwright/test";
|
|
9
8
|
import AxeBuilder from "@axe-core/playwright";
|
|
9
|
+
import { test as base } from "./user";
|
|
10
|
+
// We want to avoid using `mergeTests` because it drops useful type information about the fixtures. Instead, we extend
|
|
11
|
+
// the definition of `test` from `user.ts`, so that there is a linear hierarchy.
|
|
10
12
|
export const test = base.extend({
|
|
11
13
|
axe: async ({ page }, use) => {
|
|
12
14
|
const builder = new AxeBuilder({ page });
|
package/lib/fixtures/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
export { type Services, type WorkerOptions } from "./services.js";
|
|
2
|
-
export
|
|
3
|
-
axe: import("@axe-core/playwright").AxeBuilder;
|
|
4
|
-
} & import("./services.js").TestFixtures & {
|
|
5
|
-
displayName?: string;
|
|
6
|
-
credentials: import("../utils/api.js").Credentials;
|
|
7
|
-
pageWithCredentials: import("playwright-core").Page;
|
|
8
|
-
user: import("../utils/api.js").Credentials;
|
|
9
|
-
}, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions & import("./services.js").WorkerOptions & import("./services.js").Services>;
|
|
2
|
+
export { test } from "./axe";
|
|
10
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAIlE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
|
package/lib/fixtures/index.js
CHANGED
|
@@ -4,7 +4,6 @@ Copyright 2025 New Vector Ltd.
|
|
|
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.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const test = mergeTests(axe, user);
|
|
7
|
+
// We avoid using `mergeTests` because it drops useful type information about the fixtures.
|
|
8
|
+
// `axe` is the top of our stack of extensions (it extends `user`, etc), so it's the one we want to use.
|
|
9
|
+
export { test } from "./axe";
|
package/lib/fixtures/user.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Page } from "@playwright/test";
|
|
2
|
-
import { Credentials } from "../utils/api.js";
|
|
2
|
+
import { type Credentials } from "../utils/api.js";
|
|
3
3
|
/** Adds an initScript to the given page which will populate localStorage appropriately so that Element will use the given credentials. */
|
|
4
4
|
export declare function populateLocalStorageWithCredentials(page: Page, credentials: Credentials): Promise<void>;
|
|
5
5
|
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("./services.js").TestFixtures & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/fixtures/user.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/fixtures/user.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,0IAA0I;AAC1I,wBAAsB,mCAAmC,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,iBAuB7F;AAED,eAAO,MAAM,IAAI;IACb;;;;;OAKG;kBACW,MAAM;IAEpB;;;OAGG;iBACU,WAAW;IAExB;;;;;;OAMG;yBACkB,IAAI;IAEzB;;;;OAIG;UACG,WAAW;iLA+BnB,CAAC"}
|
package/lib/fixtures/user.js
CHANGED
|
@@ -27,7 +27,10 @@ export async function populateLocalStorageWithCredentials(page, credentials) {
|
|
|
27
27
|
}
|
|
28
28
|
export const test = base.extend({
|
|
29
29
|
displayName: undefined,
|
|
30
|
-
|
|
30
|
+
// We don't directly depend upon the `context` fixture, but we do need to make sure that it has been run
|
|
31
|
+
// before this fixture, since it is responsible for configuring the APIRequestContext on the homeserver, so
|
|
32
|
+
// without it we cannot register the user.
|
|
33
|
+
credentials: async ({ context, homeserver, displayName: testDisplayName }, use, testInfo) => {
|
|
31
34
|
const names = ["Alice", "Bob", "Charlie", "Daniel", "Eve", "Frank", "Grace", "Hannah", "Isaac", "Judy"];
|
|
32
35
|
const password = uniqueId("password_");
|
|
33
36
|
const displayName = testDisplayName ?? sample(names);
|
package/lib/index.d.ts
CHANGED
|
@@ -28,13 +28,13 @@ export interface TestFixtures {
|
|
|
28
28
|
labsFlags: string[];
|
|
29
29
|
disablePresence: boolean;
|
|
30
30
|
}
|
|
31
|
-
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & {
|
|
32
|
-
axe: import("@axe-core/playwright").AxeBuilder;
|
|
33
|
-
} & import("./fixtures/services.js").TestFixtures & {
|
|
31
|
+
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("./fixtures/services.js").TestFixtures & {
|
|
34
32
|
displayName?: string;
|
|
35
33
|
credentials: import("./utils/api.js").Credentials;
|
|
36
34
|
pageWithCredentials: import("playwright-core").Page;
|
|
37
35
|
user: import("./utils/api.js").Credentials;
|
|
36
|
+
} & {
|
|
37
|
+
axe: import("@axe-core/playwright").AxeBuilder;
|
|
38
38
|
} & TestFixtures, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions & import("./fixtures/services.js").WorkerOptions & import("./fixtures/services.js").Services>;
|
|
39
39
|
export { expect, type ToMatchScreenshotOptions } from "./expect/index.js";
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AbstractStartedContainer, type GenericContainer } from "testcontainers";
|
|
2
2
|
import { type APIRequestContext, type TestInfo } from "@playwright/test";
|
|
3
3
|
import { type StartedMatrixAuthenticationServiceContainer } from "./mas";
|
|
4
|
-
import { ClientServerApi, Credentials } from "../utils/api";
|
|
5
|
-
import { StartedMailpitContainer } from "./mailpit";
|
|
4
|
+
import { type ClientServerApi, type Credentials } from "../utils/api";
|
|
5
|
+
import { type StartedMailpitContainer } from "./mailpit";
|
|
6
6
|
export interface HomeserverInstance {
|
|
7
7
|
readonly baseUrl: string;
|
|
8
8
|
readonly csApi: ClientServerApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeserverContainer.d.ts","sourceRoot":"","sources":["../../src/testcontainers/HomeserverContainer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,KAAK,2CAA2C,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"HomeserverContainer.d.ts","sourceRoot":"","sources":["../../src/testcontainers/HomeserverContainer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,KAAK,2CAA2C,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAEhC;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7F;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAElE;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,CAAE,SAAQ,gBAAgB;IACjE;;;;OAIG;IACH,eAAe,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAE9E;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACvD;;;OAGG;IACH,+BAA+B,CAAC,GAAG,CAAC,EAAE,2CAA2C,GAAG,IAAI,CAAC;IAEzF;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,0BAA2B,SAAQ,wBAAwB,EAAE,kBAAkB;IAC5F;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE7C;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD"}
|
|
@@ -2,5 +2,5 @@ export { PostgreSqlContainer, StartedPostgreSqlContainer } from "@testcontainers
|
|
|
2
2
|
export type { HomeserverInstance, HomeserverContainer, StartedHomeserverContainer } from "./HomeserverContainer.js";
|
|
3
3
|
export { type SynapseConfig, SynapseContainer, StartedSynapseContainer } from "./synapse.js";
|
|
4
4
|
export { type MasConfig, MatrixAuthenticationServiceContainer, StartedMatrixAuthenticationServiceContainer, } from "./mas.js";
|
|
5
|
-
export { MailpitClient, MailpitContainer, StartedMailpitContainer } from "./mailpit.js";
|
|
5
|
+
export { type MailpitClient, MailpitContainer, StartedMailpitContainer } from "./mailpit.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testcontainers/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7F,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EACH,KAAK,SAAS,EACd,oCAAoC,EACpC,2CAA2C,GAC9C,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testcontainers/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7F,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EACH,KAAK,SAAS,EACd,oCAAoC,EACpC,2CAA2C,GAC9C,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { type APIRequestContext, type TestInfo } from "@playwright/test";
|
|
|
3
3
|
import { type HomeserverContainer, type StartedHomeserverContainer } from "./HomeserverContainer.js";
|
|
4
4
|
import { type StartedMatrixAuthenticationServiceContainer } from "./mas.js";
|
|
5
5
|
import { Api, ClientServerApi, type Credentials } from "../utils/api.js";
|
|
6
|
-
import { StartedMailpitContainer } from "./mailpit.js";
|
|
6
|
+
import { type StartedMailpitContainer } from "./mailpit.js";
|
|
7
7
|
declare const DEFAULT_CONFIG: {
|
|
8
8
|
server_name: string;
|
|
9
9
|
public_baseurl: string;
|
|
@@ -133,7 +133,48 @@ declare const DEFAULT_CONFIG: {
|
|
|
133
133
|
room_name: string;
|
|
134
134
|
};
|
|
135
135
|
allow_guest_access: boolean;
|
|
136
|
-
experimental_features: {
|
|
136
|
+
experimental_features: {
|
|
137
|
+
/**
|
|
138
|
+
* MSC4143 Matrix RTC: Required for `matrix_rtc` configuration.
|
|
139
|
+
*/
|
|
140
|
+
msc4143_enabled: boolean;
|
|
141
|
+
};
|
|
142
|
+
matrix_rtc: {
|
|
143
|
+
transports: {
|
|
144
|
+
(arrayLength: number): {
|
|
145
|
+
[field: string]: string;
|
|
146
|
+
type: string;
|
|
147
|
+
}[];
|
|
148
|
+
(...items: {
|
|
149
|
+
[field: string]: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}[]): {
|
|
152
|
+
[field: string]: string;
|
|
153
|
+
type: string;
|
|
154
|
+
}[];
|
|
155
|
+
new (arrayLength: number): {
|
|
156
|
+
[field: string]: string;
|
|
157
|
+
type: string;
|
|
158
|
+
}[];
|
|
159
|
+
new (...items: {
|
|
160
|
+
[field: string]: string;
|
|
161
|
+
type: string;
|
|
162
|
+
}[]): {
|
|
163
|
+
[field: string]: string;
|
|
164
|
+
type: string;
|
|
165
|
+
}[];
|
|
166
|
+
isArray(arg: any): arg is any[];
|
|
167
|
+
readonly prototype: any[];
|
|
168
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
169
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
170
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
171
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
172
|
+
of<T>(...items: T[]): T[];
|
|
173
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
174
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
175
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
137
178
|
oidc_providers: never[];
|
|
138
179
|
serve_server_wellknown: boolean;
|
|
139
180
|
presence: {
|
|
@@ -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,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQzE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,KAAK,2CAA2C,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,eAAe,EAAa,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;
|
|
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,oBAAo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,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3F"}
|
|
@@ -126,7 +126,15 @@ const DEFAULT_CONFIG = {
|
|
|
126
126
|
user_consent: undefined,
|
|
127
127
|
server_notices: undefined,
|
|
128
128
|
allow_guest_access: false,
|
|
129
|
-
experimental_features: {
|
|
129
|
+
experimental_features: {
|
|
130
|
+
/**
|
|
131
|
+
* MSC4143 Matrix RTC: Required for `matrix_rtc` configuration.
|
|
132
|
+
*/
|
|
133
|
+
msc4143_enabled: false,
|
|
134
|
+
},
|
|
135
|
+
matrix_rtc: {
|
|
136
|
+
transports: (Array),
|
|
137
|
+
},
|
|
130
138
|
oidc_providers: [],
|
|
131
139
|
serve_server_wellknown: true,
|
|
132
140
|
presence: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BrowserContext, Page } from "@playwright/test";
|
|
2
|
-
import { Config } from "../index.js";
|
|
1
|
+
import { type BrowserContext, type Page } from "@playwright/test";
|
|
2
|
+
import { type Config } from "../index.js";
|
|
3
3
|
/** Construct a suitable config.json for the given homeserver
|
|
4
4
|
*
|
|
5
5
|
* @param homeserverBaseUrl - The `baseUrl` of the homeserver that the client should be configured to connect to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config_json.d.ts","sourceRoot":"","sources":["../../src/utils/config_json.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"config_json.d.ts","sourceRoot":"","sources":["../../src/utils/config_json.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,aAAa,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,iBAAiB,EAAE,MAAM,EACzB,gBAAgB,GAAE,OAAO,CAAC,MAAM,CAAM,EACtC,SAAS,GAAE,MAAM,EAAO,EACxB,eAAe,GAAE,OAAe,GACjC,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACjC,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,iBAAiB,EAAE,MAAM,EACzB,gBAAgB,GAAE,OAAO,CAAC,MAAM,CAAM,EACtC,SAAS,GAAE,MAAM,EAAO,EACxB,eAAe,GAAE,OAAe,GACjC,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
package/lib/utils/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Browser } from "playwright-core";
|
|
2
|
-
import { Page } from "@playwright/test";
|
|
3
|
-
import { Credentials } from "./api.js";
|
|
4
|
-
import { Config } from "../index.js";
|
|
1
|
+
import { type Browser } from "playwright-core";
|
|
2
|
+
import { type Page } from "@playwright/test";
|
|
3
|
+
import { type Credentials } from "./api.js";
|
|
4
|
+
import { type Config } from "../index.js";
|
|
5
5
|
/** Create a new instance of the application, in a separate browser context, using the given credentials.
|
|
6
6
|
*
|
|
7
7
|
* @param browser - the browser to use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,gBAAgB,GAAE,OAAO,CAAC,MAAM,CAAM,EACtC,SAAS,GAAE,MAAM,EAAO,EACxB,eAAe,GAAE,OAAe,GACjC,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@element-hq/element-web-playwright-common",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@axe-core/playwright": "^4.10.1",
|
|
33
33
|
"@testcontainers/postgresql": "^11.0.0",
|
|
34
|
-
"glob": "^
|
|
34
|
+
"glob": "^13.0.0",
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
36
|
"mailpit-api": "^1.2.0",
|
|
37
37
|
"strip-ansi": "^7.1.0",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
+
set -e
|
|
4
|
+
|
|
3
5
|
# Handle symlinks here as we tend to be executed as an npm binary
|
|
4
6
|
SCRIPT_PATH=$(readlink -f "$0")
|
|
5
7
|
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
|
|
@@ -9,21 +11,30 @@ IMAGE_NAME="element-web-playwright-common"
|
|
|
9
11
|
build_image() {
|
|
10
12
|
echo "Building $IMAGE_NAME image in $SCRIPT_DIR"
|
|
11
13
|
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
--depth=0 \
|
|
17
|
-
--json \
|
|
18
|
-
--non-interactive \
|
|
19
|
-
--no-progress | \
|
|
20
|
-
jq -r '.data.trees[].name | split("@")[2]' \
|
|
21
|
-
)
|
|
14
|
+
# Fetch the playwright version
|
|
15
|
+
# .data.version is for yarn classic
|
|
16
|
+
# .children.Version is for yarn berry
|
|
17
|
+
PW_VERSION=$(yarn info --manifest --json @playwright/test | jq -r '.data.version // .children.Version')
|
|
22
18
|
echo "with Playwright version $PW_VERSION"
|
|
23
19
|
|
|
20
|
+
# Build image
|
|
24
21
|
docker build -t "$IMAGE_NAME" --build-arg "PLAYWRIGHT_VERSION=$PW_VERSION" "$SCRIPT_DIR"
|
|
25
22
|
}
|
|
26
23
|
|
|
24
|
+
# Find the docker socket on the host
|
|
25
|
+
case "$DOCKER_HOST" in
|
|
26
|
+
unix://*)
|
|
27
|
+
docker_sock="${DOCKER_HOST:7}"
|
|
28
|
+
;;
|
|
29
|
+
"")
|
|
30
|
+
docker_sock="/var/run/docker.sock"
|
|
31
|
+
;;
|
|
32
|
+
*)
|
|
33
|
+
echo "$0: unsupported DOCKER_HOST setting '${DOCKER_HOST}'" >&2
|
|
34
|
+
exit 1;
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
|
|
27
38
|
RUN_ARGS=(
|
|
28
39
|
--rm
|
|
29
40
|
--network host
|
|
@@ -33,7 +44,7 @@ RUN_ARGS=(
|
|
|
33
44
|
# Bind mount the working directory into the container
|
|
34
45
|
-v $(pwd):/work/
|
|
35
46
|
# Bind mount the docker socket so we can run docker commands from the container
|
|
36
|
-
-v
|
|
47
|
+
-v "${docker_sock}":/var/run/docker.sock
|
|
37
48
|
# Bind mount /tmp so we can store temporary files
|
|
38
49
|
-v /tmp/:/tmp/
|
|
39
50
|
-it
|
|
@@ -69,15 +80,47 @@ done
|
|
|
69
80
|
build_image
|
|
70
81
|
|
|
71
82
|
# Ensure we pass all symlinked node_modules to the container
|
|
72
|
-
pushd node_modules
|
|
83
|
+
pushd node_modules > /dev/null
|
|
73
84
|
SYMLINKS=$(find . -maxdepth 2 -type l -not -path "./.bin/*")
|
|
74
|
-
popd
|
|
85
|
+
popd > /dev/null
|
|
75
86
|
for LINK in $SYMLINKS; do
|
|
76
|
-
TARGET=$(readlink -f "node_modules/$LINK")
|
|
87
|
+
TARGET=$(readlink -f "node_modules/$LINK") || true
|
|
77
88
|
if [ -d "$TARGET" ]; then
|
|
89
|
+
if docker --version | grep -q podman; then
|
|
90
|
+
echo -e "\033[31m" >&2
|
|
91
|
+
cat <<'EOF' >&2
|
|
92
|
+
WARNING: `node_modules` contains symlinks, and the support for this in
|
|
93
|
+
`playwright-screenshots.sh` is broken under podman due to
|
|
94
|
+
https://github.com/containers/podman/issues/25947.
|
|
95
|
+
|
|
96
|
+
If you get errors such as 'Error: crun: creating `<path>`', then retry this
|
|
97
|
+
having `yarn unlink`ed the relevant node modules.
|
|
98
|
+
EOF
|
|
99
|
+
echo -e "\033[0m" >&2
|
|
100
|
+
fi
|
|
78
101
|
echo "mounting linked package ${LINK:2} in container"
|
|
79
102
|
RUN_ARGS+=( "-v" "$TARGET:/work/node_modules/${LINK:2}" )
|
|
80
103
|
fi
|
|
81
104
|
done
|
|
82
105
|
|
|
106
|
+
# Our Playwright fixtures use Testcontainers [1], which uses a docker image
|
|
107
|
+
# called Ryuk [2], which will clean up any dangling containers/networks/etc
|
|
108
|
+
# after a timeout, if the parent process dies unexpectedly.
|
|
109
|
+
#
|
|
110
|
+
# To do this, Ryuk requires access to the docker socket, so Testcontainers
|
|
111
|
+
# starts the Ryuk container with a bind-mount of `/var/run/docker.sock`.
|
|
112
|
+
# However, we're going to be running Playwright (and hence Testcontainers)
|
|
113
|
+
# itself in a container, but talking to the Docker daemon on the *host*, which
|
|
114
|
+
# means that bind mounts will be relative to the *host* filesystem. In short,
|
|
115
|
+
# it will try to bind-mount the *host's* `/var/run/docker.sock` rather than
|
|
116
|
+
# that from inside the element-web-playwright-common container.
|
|
117
|
+
#
|
|
118
|
+
# To solve this problem, we start Ryuk ourselves (with the correct docker
|
|
119
|
+
# socket) rather than waiting for Testcontainers to do so. Testcontainers will
|
|
120
|
+
# find the running Ryuk instance and connect to it rather than start a new one.
|
|
121
|
+
#
|
|
122
|
+
# [1] https://testcontainers.com/
|
|
123
|
+
# [2] https://github.com/testcontainers/moby-ryuk
|
|
124
|
+
docker run -d --rm --label org.testcontainers.ryuk=true -v "${docker_sock}":/var/run/docker.sock -p 8080 --name="playwright-ryuk" testcontainers/ryuk:0.14.0
|
|
125
|
+
|
|
83
126
|
docker run "${RUN_ARGS[@]}" "$IMAGE_NAME" "${DEFAULT_ARGS[@]}" "$@"
|
package/src/expect/index.ts
CHANGED
|
@@ -9,10 +9,10 @@ import { mergeExpects, type Expect } from "@playwright/test";
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
expect as screenshotExpectations,
|
|
12
|
-
Expectations as ScreenshotExpectations,
|
|
13
|
-
ToMatchScreenshotOptions,
|
|
12
|
+
type Expectations as ScreenshotExpectations,
|
|
13
|
+
type ToMatchScreenshotOptions,
|
|
14
14
|
} from "./screenshot.js";
|
|
15
|
-
import { expect as axeExpectations, Expectations as AxeExpectations } from "./axe.js";
|
|
15
|
+
import { expect as axeExpectations, type Expectations as AxeExpectations } from "./axe.js";
|
|
16
16
|
|
|
17
17
|
export const expect = mergeExpects(screenshotExpectations, axeExpectations) as Expect<
|
|
18
18
|
ScreenshotExpectations & AxeExpectations
|
package/src/expect/screenshot.ts
CHANGED
package/src/fixtures/axe.ts
CHANGED
|
@@ -6,9 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
6
6
|
Please see LICENSE files in the repository root for full details.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { test as base } from "@playwright/test";
|
|
10
9
|
import AxeBuilder from "@axe-core/playwright";
|
|
11
10
|
|
|
11
|
+
import { test as base } from "./user";
|
|
12
|
+
|
|
13
|
+
// We want to avoid using `mergeTests` because it drops useful type information about the fixtures. Instead, we extend
|
|
14
|
+
// the definition of `test` from `user.ts`, so that there is a linear hierarchy.
|
|
12
15
|
export const test = base.extend<{
|
|
13
16
|
/**
|
|
14
17
|
* AxeBuilder instance for the current page
|
package/src/fixtures/index.ts
CHANGED
|
@@ -5,11 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { mergeTests } from "@playwright/test";
|
|
9
|
-
|
|
10
|
-
import { test as axe } from "./axe.js";
|
|
11
|
-
import { test as user } from "./user.js";
|
|
12
|
-
|
|
13
8
|
export { type Services, type WorkerOptions } from "./services.js";
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
// We avoid using `mergeTests` because it drops useful type information about the fixtures.
|
|
11
|
+
// `axe` is the top of our stack of extensions (it extends `user`, etc), so it's the one we want to use.
|
|
12
|
+
export { test } from "./axe";
|
package/src/fixtures/user.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type Page } from "@playwright/test";
|
|
|
10
10
|
import { sample, uniqueId } from "lodash-es";
|
|
11
11
|
|
|
12
12
|
import { test as base } from "./services.js";
|
|
13
|
-
import { Credentials } from "../utils/api.js";
|
|
13
|
+
import { type Credentials } from "../utils/api.js";
|
|
14
14
|
|
|
15
15
|
/** Adds an initScript to the given page which will populate localStorage appropriately so that Element will use the given credentials. */
|
|
16
16
|
export async function populateLocalStorageWithCredentials(page: Page, credentials: Credentials) {
|
|
@@ -70,7 +70,11 @@ export const test = base.extend<{
|
|
|
70
70
|
user: Credentials;
|
|
71
71
|
}>({
|
|
72
72
|
displayName: undefined,
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
// We don't directly depend upon the `context` fixture, but we do need to make sure that it has been run
|
|
75
|
+
// before this fixture, since it is responsible for configuring the APIRequestContext on the homeserver, so
|
|
76
|
+
// without it we cannot register the user.
|
|
77
|
+
credentials: async ({ context, homeserver, displayName: testDisplayName }, use, testInfo) => {
|
|
74
78
|
const names = ["Alice", "Bob", "Charlie", "Daniel", "Eve", "Frank", "Grace", "Hannah", "Isaac", "Judy"];
|
|
75
79
|
const password = uniqueId("password_");
|
|
76
80
|
const displayName = testDisplayName ?? sample(names)!;
|
|
@@ -9,8 +9,8 @@ import { type AbstractStartedContainer, type GenericContainer } from "testcontai
|
|
|
9
9
|
import { type APIRequestContext, type TestInfo } from "@playwright/test";
|
|
10
10
|
|
|
11
11
|
import { type StartedMatrixAuthenticationServiceContainer } from "./mas";
|
|
12
|
-
import { ClientServerApi, Credentials } from "../utils/api";
|
|
13
|
-
import { StartedMailpitContainer } from "./mailpit";
|
|
12
|
+
import { type ClientServerApi, type Credentials } from "../utils/api";
|
|
13
|
+
import { type StartedMailpitContainer } from "./mailpit";
|
|
14
14
|
|
|
15
15
|
export interface HomeserverInstance {
|
|
16
16
|
readonly baseUrl: string;
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
MatrixAuthenticationServiceContainer,
|
|
14
14
|
StartedMatrixAuthenticationServiceContainer,
|
|
15
15
|
} from "./mas.js";
|
|
16
|
-
export { MailpitClient, MailpitContainer, StartedMailpitContainer } from "./mailpit.js";
|
|
16
|
+
export { type MailpitClient, MailpitContainer, StartedMailpitContainer } from "./mailpit.js";
|
|
@@ -23,7 +23,7 @@ import { deepCopy } from "../utils/object.js";
|
|
|
23
23
|
import { type HomeserverContainer, type StartedHomeserverContainer } from "./HomeserverContainer.js";
|
|
24
24
|
import { type StartedMatrixAuthenticationServiceContainer } from "./mas.js";
|
|
25
25
|
import { Api, ClientServerApi, type Verb, type Credentials } from "../utils/api.js";
|
|
26
|
-
import { StartedMailpitContainer } from "./mailpit.js";
|
|
26
|
+
import { type StartedMailpitContainer } from "./mailpit.js";
|
|
27
27
|
|
|
28
28
|
const DEFAULT_CONFIG = {
|
|
29
29
|
server_name: "localhost",
|
|
@@ -170,7 +170,15 @@ const DEFAULT_CONFIG = {
|
|
|
170
170
|
room_name: string;
|
|
171
171
|
},
|
|
172
172
|
allow_guest_access: false,
|
|
173
|
-
experimental_features: {
|
|
173
|
+
experimental_features: {
|
|
174
|
+
/**
|
|
175
|
+
* MSC4143 Matrix RTC: Required for `matrix_rtc` configuration.
|
|
176
|
+
*/
|
|
177
|
+
msc4143_enabled: false,
|
|
178
|
+
},
|
|
179
|
+
matrix_rtc: {
|
|
180
|
+
transports: Array<{ type: string; [field: string]: string }>,
|
|
181
|
+
},
|
|
174
182
|
oidc_providers: [],
|
|
175
183
|
serve_server_wellknown: true,
|
|
176
184
|
presence: {
|
package/src/utils/config_json.ts
CHANGED
|
@@ -5,9 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { BrowserContext, Page } from "@playwright/test";
|
|
8
|
+
import { type BrowserContext, type Page } from "@playwright/test";
|
|
9
9
|
|
|
10
|
-
import { Config, CONFIG_JSON } from "../index.js";
|
|
10
|
+
import { type Config, CONFIG_JSON } from "../index.js";
|
|
11
11
|
|
|
12
12
|
/** Construct a suitable config.json for the given homeserver
|
|
13
13
|
*
|
package/src/utils/context.ts
CHANGED
|
@@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
5
5
|
Please see LICENSE files in the repository root for full details.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { Browser } from "playwright-core";
|
|
9
|
-
import { Page } from "@playwright/test";
|
|
8
|
+
import { type Browser } from "playwright-core";
|
|
9
|
+
import { type Page } from "@playwright/test";
|
|
10
10
|
|
|
11
|
-
import { Credentials } from "./api.js";
|
|
12
|
-
import { Config } from "../index.js";
|
|
11
|
+
import { type Credentials } from "./api.js";
|
|
12
|
+
import { type Config } from "../index.js";
|
|
13
13
|
import { routeConfigJson } from "./config_json.js";
|
|
14
14
|
import { populateLocalStorageWithCredentials } from "../fixtures/user.js";
|
|
15
15
|
|