@element-hq/element-web-playwright-common 2.0.0 → 2.1.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/user.d.ts +1 -1
- package/lib/fixtures/user.d.ts.map +1 -1
- package/lib/testcontainers/HomeserverContainer.d.ts +2 -2
- package/lib/testcontainers/HomeserverContainer.d.ts.map +1 -1
- package/lib/testcontainers/synapse.d.ts +1 -1
- package/lib/testcontainers/synapse.d.ts.map +1 -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/user.ts +1 -1
- package/src/testcontainers/HomeserverContainer.ts +2 -2
- package/src/testcontainers/synapse.ts +1 -1
- 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/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;iLA2BnB,CAAC"}
|
|
@@ -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,wB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,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"}
|
|
@@ -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;
|
|
@@ -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,OA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AG,OAAO,CAAC,WAAW,CAAC;IAKzG;;;;;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
|
-
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.1.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": "^11.0
|
|
34
|
+
"glob": "^11.1.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/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) {
|
|
@@ -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;
|
|
@@ -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",
|
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
|
|