Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28860/head
Michael Telatynski 2025-01-06 15:25:40 +00:00
parent edefe02174
commit 63e855e0c4
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
5 changed files with 46 additions and 51 deletions

View File

@ -8,35 +8,10 @@ Please see LICENSE files in the repository root for full details.
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 { 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 NAME = "Alice";
@ -49,6 +24,28 @@ test.describe("Dehydration", () => {
test.use({
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) => {

View File

@ -9,24 +9,24 @@ Please see LICENSE files in the repository root for full details.
import path from "path";
import { readFile } from "node:fs/promises";
import { expect, Fixtures, test as base } 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);
},
});
import { expect, test } from "../../element-web-test";
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.slow();

View File

@ -10,7 +10,6 @@ import { APIRequestContext } from "@playwright/test";
import * as YAML from "yaml";
import { set } from "lodash";
import { getFreePort } from "../plugins/utils/port.ts";
import { randB64Bytes } from "../plugins/utils/rand.ts";
import { StartedSynapseContainer } from "./synapse.ts";
import { deepCopy } from "../plugins/utils/object.ts";
@ -223,6 +222,7 @@ export class DendriteContainer extends GenericContainer {
"-c",
`/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));
}
@ -240,22 +240,18 @@ export class DendriteContainer extends GenericContainer {
}
public override async start(): Promise<StartedSynapseContainer> {
const port = await getFreePort();
this.withExposedPorts({
container: 8008,
host: port,
}).withCopyContentToContainer([
this.withCopyContentToContainer([
{
target: "/etc/dendrite/dendrite.yaml",
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
return new StartedSynapseContainer(
await super.start(),
`http://localhost:${port}`,
container,
`http://${container.getHost()}:${container.getMappedPort(8008)}`,
this.config.client_api.registration_shared_secret,
this.request,
);

View File

@ -194,6 +194,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer {
}
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();
this.config.http.public_base = `http://localhost:${port}/`;

View File

@ -199,6 +199,7 @@ export class SynapseContainer extends GenericContainer {
}
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();
this.withExposedPorts({