parent
edefe02174
commit
63e855e0c4
|
@ -8,35 +8,10 @@ Please see LICENSE files in the repository root for full details.
|
||||||
|
|
||||||
import { Locator, type Page } from "@playwright/test";
|
import { Locator, type Page } from "@playwright/test";
|
||||||
|
|
||||||
import { test as base, expect, Fixtures } from "../../element-web-test";
|
import { test, expect } from "../../element-web-test";
|
||||||
import { viewRoomSummaryByName } from "../right-panel/utils";
|
import { viewRoomSummaryByName } from "../right-panel/utils";
|
||||||
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
||||||
|
|
||||||
const test = base.extend<Fixtures>({
|
|
||||||
synapseConfigOptions: {
|
|
||||||
experimental_features: {
|
|
||||||
msc2697_enabled: false,
|
|
||||||
msc3814_enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config: async ({ homeserver, context }, use) => {
|
|
||||||
const wellKnown = {
|
|
||||||
"m.homeserver": {
|
|
||||||
base_url: homeserver.baseUrl,
|
|
||||||
},
|
|
||||||
"org.matrix.msc3814": true,
|
|
||||||
};
|
|
||||||
|
|
||||||
await context.route("https://localhost/.well-known/matrix/client", async (route) => {
|
|
||||||
await route.fulfill({ json: wellKnown });
|
|
||||||
});
|
|
||||||
|
|
||||||
await use({
|
|
||||||
default_server_config: wellKnown,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const ROOM_NAME = "Test room";
|
const ROOM_NAME = "Test room";
|
||||||
const NAME = "Alice";
|
const NAME = "Alice";
|
||||||
|
|
||||||
|
@ -49,6 +24,28 @@ test.describe("Dehydration", () => {
|
||||||
|
|
||||||
test.use({
|
test.use({
|
||||||
displayName: NAME,
|
displayName: NAME,
|
||||||
|
synapseConfigOptions: {
|
||||||
|
experimental_features: {
|
||||||
|
msc2697_enabled: false,
|
||||||
|
msc3814_enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config: async ({ homeserver, context }, use) => {
|
||||||
|
const wellKnown = {
|
||||||
|
"m.homeserver": {
|
||||||
|
base_url: homeserver.baseUrl,
|
||||||
|
},
|
||||||
|
"org.matrix.msc3814": true,
|
||||||
|
};
|
||||||
|
|
||||||
|
await context.route("https://localhost/.well-known/matrix/client", async (route) => {
|
||||||
|
await route.fulfill({ json: wellKnown });
|
||||||
|
});
|
||||||
|
|
||||||
|
await use({
|
||||||
|
default_server_config: wellKnown,
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Create dehydrated device", async ({ page, user, app }, workerInfo) => {
|
test("Create dehydrated device", async ({ page, user, app }, workerInfo) => {
|
||||||
|
|
|
@ -9,24 +9,24 @@ Please see LICENSE files in the repository root for full details.
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { readFile } from "node:fs/promises";
|
import { readFile } from "node:fs/promises";
|
||||||
|
|
||||||
import { expect, Fixtures, test as base } from "../../element-web-test";
|
import { expect, test } from "../../element-web-test";
|
||||||
|
|
||||||
const test = base.extend<Fixtures>({
|
|
||||||
// Replace the `user` fixture with one which populates the indexeddb data before starting the app.
|
|
||||||
user: async ({ context, pageWithCredentials: page, credentials }, use) => {
|
|
||||||
await page.route(`/test_indexeddb_cryptostore_dump/*`, async (route, request) => {
|
|
||||||
const resourcePath = path.join(__dirname, new URL(request.url()).pathname);
|
|
||||||
const body = await readFile(resourcePath, { encoding: "utf-8" });
|
|
||||||
await route.fulfill({ body });
|
|
||||||
});
|
|
||||||
await page.goto("/test_indexeddb_cryptostore_dump/index.html");
|
|
||||||
|
|
||||||
await use(credentials);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
test.describe("migration", { tag: "@no-webkit" }, function () {
|
test.describe("migration", { tag: "@no-webkit" }, function () {
|
||||||
test.use({ displayName: "Alice" });
|
test.use({
|
||||||
|
displayName: "Alice",
|
||||||
|
|
||||||
|
// Replace the `user` fixture with one which populates the indexeddb data before starting the app.
|
||||||
|
user: async ({ context, pageWithCredentials: page, credentials }, use) => {
|
||||||
|
await page.route(`/test_indexeddb_cryptostore_dump/*`, async (route, request) => {
|
||||||
|
const resourcePath = path.join(__dirname, new URL(request.url()).pathname);
|
||||||
|
const body = await readFile(resourcePath, { encoding: "utf-8" });
|
||||||
|
await route.fulfill({ body });
|
||||||
|
});
|
||||||
|
await page.goto("/test_indexeddb_cryptostore_dump/index.html");
|
||||||
|
|
||||||
|
await use(credentials);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
test("Should support migration from legacy crypto", async ({ context, user, page }, workerInfo) => {
|
test("Should support migration from legacy crypto", async ({ context, user, page }, workerInfo) => {
|
||||||
test.slow();
|
test.slow();
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { APIRequestContext } from "@playwright/test";
|
||||||
import * as YAML from "yaml";
|
import * as YAML from "yaml";
|
||||||
import { set } from "lodash";
|
import { set } from "lodash";
|
||||||
|
|
||||||
import { getFreePort } from "../plugins/utils/port.ts";
|
|
||||||
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
import { randB64Bytes } from "../plugins/utils/rand.ts";
|
||||||
import { StartedSynapseContainer } from "./synapse.ts";
|
import { StartedSynapseContainer } from "./synapse.ts";
|
||||||
import { deepCopy } from "../plugins/utils/object.ts";
|
import { deepCopy } from "../plugins/utils/object.ts";
|
||||||
|
@ -223,6 +222,7 @@ export class DendriteContainer extends GenericContainer {
|
||||||
"-c",
|
"-c",
|
||||||
`/usr/bin/generate-keys -private-key /etc/dendrite/matrix_key.pem && ${binary} --config /etc/dendrite/dendrite.yaml --really-enable-open-registration true run`,
|
`/usr/bin/generate-keys -private-key /etc/dendrite/matrix_key.pem && ${binary} --config /etc/dendrite/dendrite.yaml --really-enable-open-registration true run`,
|
||||||
])
|
])
|
||||||
|
.withExposedPorts(8008)
|
||||||
.withWaitStrategy(Wait.forHttp("/_matrix/client/versions", 8008));
|
.withWaitStrategy(Wait.forHttp("/_matrix/client/versions", 8008));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,22 +240,18 @@ export class DendriteContainer extends GenericContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async start(): Promise<StartedSynapseContainer> {
|
public override async start(): Promise<StartedSynapseContainer> {
|
||||||
const port = await getFreePort();
|
this.withCopyContentToContainer([
|
||||||
|
|
||||||
this.withExposedPorts({
|
|
||||||
container: 8008,
|
|
||||||
host: port,
|
|
||||||
}).withCopyContentToContainer([
|
|
||||||
{
|
{
|
||||||
target: "/etc/dendrite/dendrite.yaml",
|
target: "/etc/dendrite/dendrite.yaml",
|
||||||
content: YAML.stringify(this.config),
|
content: YAML.stringify(this.config),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const container = await super.start();
|
||||||
// Surprisingly, Dendrite implements the same register user Admin API Synapse, so we can just extend it
|
// Surprisingly, Dendrite implements the same register user Admin API Synapse, so we can just extend it
|
||||||
return new StartedSynapseContainer(
|
return new StartedSynapseContainer(
|
||||||
await super.start(),
|
container,
|
||||||
`http://localhost:${port}`,
|
`http://${container.getHost()}:${container.getMappedPort(8008)}`,
|
||||||
this.config.client_api.registration_shared_secret,
|
this.config.client_api.registration_shared_secret,
|
||||||
this.request,
|
this.request,
|
||||||
);
|
);
|
||||||
|
|
|
@ -194,6 +194,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async start(): Promise<StartedMatrixAuthenticationServiceContainer> {
|
public override async start(): Promise<StartedMatrixAuthenticationServiceContainer> {
|
||||||
|
// MAS config issuer needs to know what URL it'll be accessed from, so we have to map the port manually
|
||||||
const port = await getFreePort();
|
const port = await getFreePort();
|
||||||
|
|
||||||
this.config.http.public_base = `http://localhost:${port}/`;
|
this.config.http.public_base = `http://localhost:${port}/`;
|
||||||
|
|
|
@ -199,6 +199,7 @@ export class SynapseContainer extends GenericContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async start(): Promise<StartedSynapseContainer> {
|
public override async start(): Promise<StartedSynapseContainer> {
|
||||||
|
// Synapse config public_baseurl needs to know what URL it'll be accessed from, so we have to map the port manually
|
||||||
const port = await getFreePort();
|
const port = await getFreePort();
|
||||||
|
|
||||||
this.withExposedPorts({
|
this.withExposedPorts({
|
||||||
|
|
Loading…
Reference in New Issue