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,11 +8,22 @@ 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>({ const ROOM_NAME = "Test room";
const NAME = "Alice";
function getMemberTileByName(page: Page, name: string): Locator {
return page.locator(`.mx_EntityTile, [title="${name}"]`);
}
test.describe("Dehydration", () => {
test.skip(isDendrite, "does not yet support dehydration v2");
test.use({
displayName: NAME,
synapseConfigOptions: { synapseConfigOptions: {
experimental_features: { experimental_features: {
msc2697_enabled: false, msc2697_enabled: false,
@ -35,20 +46,6 @@ const test = base.extend<Fixtures>({
default_server_config: wellKnown, default_server_config: wellKnown,
}); });
}, },
});
const ROOM_NAME = "Test room";
const NAME = "Alice";
function getMemberTileByName(page: Page, name: string): Locator {
return page.locator(`.mx_EntityTile, [title="${name}"]`);
}
test.describe("Dehydration", () => {
test.skip(isDendrite, "does not yet support dehydration v2");
test.use({
displayName: NAME,
}); });
test("Create dehydrated device", async ({ page, user, app }, workerInfo) => { test("Create dehydrated device", async ({ page, user, app }, workerInfo) => {

View File

@ -9,9 +9,12 @@ 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";
test.describe("migration", { tag: "@no-webkit" }, function () {
test.use({
displayName: "Alice",
const test = base.extend<Fixtures>({
// Replace the `user` fixture with one which populates the indexeddb data before starting the app. // Replace the `user` fixture with one which populates the indexeddb data before starting the app.
user: async ({ context, pageWithCredentials: page, credentials }, use) => { user: async ({ context, pageWithCredentials: page, credentials }, use) => {
await page.route(`/test_indexeddb_cryptostore_dump/*`, async (route, request) => { await page.route(`/test_indexeddb_cryptostore_dump/*`, async (route, request) => {
@ -23,10 +26,7 @@ const test = base.extend<Fixtures>({
await use(credentials); await use(credentials);
}, },
}); });
test.describe("migration", { tag: "@no-webkit" }, function () {
test.use({ displayName: "Alice" });
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();

View File

@ -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,
); );

View File

@ -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}/`;

View File

@ -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({