Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Jan 7, 2025
1 parent 4142c80 commit 5e304be
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
9 changes: 7 additions & 2 deletions playwright/e2e/create-room/create-room.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import { test, expect } from "../../element-web-test";
test.describe("Create Room", () => {
test.use({ displayName: "Jim" });

test("should allow us to create a public room with name, topic & address set", async ({ page, user, app }) => {
test("should allow us to create a public room with name, topic & address set", async ({
credentials,
page,
user,
app,
}) => {
const name = "Test room 1";
const topic = "This room is dedicated to this test and this test only!";

Expand All @@ -27,7 +32,7 @@ test.describe("Create Room", () => {
// Submit
await dialog.getByRole("button", { name: "Create room" }).click();

await expect(page).toHaveURL(/\/#\/room\/#test-room-1:localhost/);
await expect(page).toHaveURL(new RegExp(`/#/room/#test-room-1:${credentials.homeServer}`));
const header = page.locator(".mx_RoomHeader");
await expect(header).toContainText(name);
});
Expand Down
3 changes: 3 additions & 0 deletions playwright/e2e/editing/editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { EventType, IContent, ISendEventResponse, MsgType, Visibility } fro
import { expect, test } from "../../element-web-test";
import { ElementAppPage } from "../../pages/ElementAppPage";
import { SettingLevel } from "../../../src/settings/SettingLevel";
import { isDendrite } from "../../plugins/homeserver/dendrite";

async function sendEvent(app: ElementAppPage, roomId: string): Promise<ISendEventResponse> {
return app.client.sendEvent(roomId, null, "m.room.message" as EventType, {
Expand All @@ -31,6 +32,8 @@ function mkPadding(n: number): IContent {
}

test.describe("Editing", () => {
test.skip(isDendrite, "due to a Dendrite bug https://github.com/element-hq/dendrite/issues/3123");

// Edit "Message"
const editLastMessage = async (page: Page, edit: string) => {
const eventTile = page.locator(".mx_RoomView_MessageList .mx_EventTile_last");
Expand Down
2 changes: 2 additions & 0 deletions playwright/e2e/knock/create-knock-room.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Please see LICENSE files in the repository root for full details.
import { test, expect } from "../../element-web-test";
import { waitForRoom } from "../utils";
import { Filter } from "../../pages/Spotlight";
import { isDendrite } from "../../plugins/homeserver/dendrite";

test.describe("Create Knock Room", () => {
test.skip(isDendrite, "Dendrite does not have support for knocking");
test.use({
displayName: "Alice",
labsFlags: ["feature_ask_to_join"],
Expand Down
3 changes: 3 additions & 0 deletions playwright/e2e/right-panel/file-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Download, type Page } from "@playwright/test";

import { test, expect } from "../../element-web-test";
import { viewRoomSummaryByName } from "./utils";
import { isDendrite } from "../../plugins/homeserver/dendrite";

const ROOM_NAME = "Test room";
const NAME = "Alice";
Expand Down Expand Up @@ -181,6 +182,8 @@ test.describe("FilePanel", () => {
});

test.describe("download", () => {
test.skip(isDendrite, "due to a Dendrite sending Content-Disposition inline");

test("should download an image via the link on the panel", async ({ page, context }) => {
// Upload an image file
await uploadFile(page, "playwright/sample-files/riot.png");
Expand Down
13 changes: 7 additions & 6 deletions playwright/e2e/widgets/stickers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function sendStickerFromPicker(page: Page) {
await expect(page.locator(".mx_AppTileFullWidth#stickers")).not.toBeVisible();
}

async function expectTimelineSticker(page: Page, roomId: string, contentUri: string) {
async function expectTimelineSticker(page: Page, serverName: string, roomId: string, contentUri: string) {
const contentId = contentUri.split("/").slice(-1)[0];
// Make sure it's in the right room
await expect(page.locator(".mx_EventTile_sticker > a")).toHaveAttribute("href", new RegExp(`/${roomId}/`));
Expand All @@ -98,7 +98,7 @@ async function expectTimelineSticker(page: Page, roomId: string, contentUri: str
// download URL.
await expect(page.locator(`img[alt="${STICKER_NAME}"]`)).toHaveAttribute(
"src",
new RegExp(`/localhost/${contentId}`),
new RegExp(`/${serverName}/${contentId}`),
);
}

Expand Down Expand Up @@ -145,7 +145,7 @@ test.describe("Stickers", { tag: ["@no-firefox", "@no-webkit"] }, () => {
// See sendStickerFromPicker() for more detail on iframe comms.
let stickerPickerUrl: string;

test("should send a sticker to multiple rooms", async ({ webserver, page, app, user, room }) => {
test("should send a sticker to multiple rooms", async ({ credentials, webserver, page, app, user, room }) => {
const roomId2 = await app.client.createRoom({ name: ROOM_NAME_2 });
const { content_uri: contentUri } = await app.client.uploadContent(STICKER_IMAGE, { type: "image/png" });
const widgetHtml = getWidgetHtml(contentUri, "image/png");
Expand All @@ -156,15 +156,15 @@ test.describe("Stickers", { tag: ["@no-firefox", "@no-webkit"] }, () => {
await expect(page).toHaveURL(`/#/room/${room.roomId}`);
await openStickerPicker(app);
await sendStickerFromPicker(page);
await expectTimelineSticker(page, room.roomId, contentUri);
await expectTimelineSticker(page, credentials.homeServer, room.roomId, contentUri);

// Ensure that when we switch to a different room that the sticker
// goes to the right place
await app.viewRoomByName(ROOM_NAME_2);
await expect(page).toHaveURL(`/#/room/${roomId2}`);
await openStickerPicker(app);
await sendStickerFromPicker(page);
await expectTimelineSticker(page, roomId2, contentUri);
await expectTimelineSticker(page, credentials.homeServer, roomId2, contentUri);
});

test("should handle a sticker picker widget missing creatorUserId", async ({
Expand All @@ -173,6 +173,7 @@ test.describe("Stickers", { tag: ["@no-firefox", "@no-webkit"] }, () => {
app,
user,
room,
credentials,
}) => {
const { content_uri: contentUri } = await app.client.uploadContent(STICKER_IMAGE, { type: "image/png" });
const widgetHtml = getWidgetHtml(contentUri, "image/png");
Expand All @@ -183,7 +184,7 @@ test.describe("Stickers", { tag: ["@no-firefox", "@no-webkit"] }, () => {
await expect(page).toHaveURL(`/#/room/${room.roomId}`);
await openStickerPicker(app);
await sendStickerFromPicker(page);
await expectTimelineSticker(page, room.roomId, contentUri);
await expectTimelineSticker(page, credentials.homeServer, room.roomId, contentUri);
});

test("should render invalid mimetype as a file", async ({ webserver, page, app, user, room }) => {
Expand Down
4 changes: 2 additions & 2 deletions playwright/testcontainers/synapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class StartedSynapseContainer extends AbstractStartedContainer implements

const data = await res.json();
return {
homeServer: data.home_server,
homeServer: data.home_server || data.user_id.split(":").slice(1).join(":"),
accessToken: data.access_token,
userId: data.user_id,
deviceId: data.device_id,
Expand Down Expand Up @@ -299,7 +299,7 @@ export class StartedSynapseContainer extends AbstractStartedContainer implements
accessToken: json.access_token,
userId: json.user_id,
deviceId: json.device_id,
homeServer: json.home_server,
homeServer: json.home_server || json.user_id.split(":").slice(1).join(":"),
};
}

Expand Down

0 comments on commit 5e304be

Please sign in to comment.