Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0d617db

Browse files
Migrate presence.spec.ts from Cypress to Playwright (#12022)
* Fix bot MatrixClient being set up multiple times Signed-off-by: Michael Telatynski <[email protected]> * Migrate presence.spec.ts from Cypress to Playwright Signed-off-by: Michael Telatynski <[email protected]> * Apply suggestions from code review Co-authored-by: R Midhun Suresh <[email protected]> * Update presence.spec.ts --------- Signed-off-by: Michael Telatynski <[email protected]> Co-authored-by: R Midhun Suresh <[email protected]>
1 parent 99cb985 commit 0d617db

File tree

2 files changed

+66
-64
lines changed

2 files changed

+66
-64
lines changed

cypress/e2e/presence/presence.spec.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
Copyright 2023 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import { test, expect } from "../../element-web-test";
18+
19+
test.describe("Presence tests", () => {
20+
test.use({
21+
displayName: "Janet",
22+
botCreateOpts: { displayName: "Bob" },
23+
});
24+
25+
test.describe("bob unreachable", () => {
26+
test("renders unreachable presence state correctly", async ({ page, app, user, bot: bob }) => {
27+
await app.client.createRoom({ name: "My Room", invite: [bob.credentials.userId] });
28+
await app.viewRoomByName("My Room");
29+
30+
await bob.evaluate(async (client) => {
31+
client.stopClient();
32+
});
33+
34+
await page.route(
35+
`**/sync*`,
36+
async (route) => {
37+
const response = await route.fetch();
38+
await route.fulfill({
39+
json: {
40+
...(await response.json()),
41+
presence: {
42+
events: [
43+
{
44+
type: "m.presence",
45+
sender: bob.credentials.userId,
46+
content: {
47+
presence: "io.element.unreachable",
48+
currently_active: false,
49+
},
50+
},
51+
],
52+
},
53+
},
54+
});
55+
},
56+
{ times: 1 },
57+
);
58+
await app.client.createRoom({}); // trigger sync
59+
60+
await page.getByRole("button", { name: "Room info" }).click();
61+
await page.locator(".mx_RightPanel").getByText("People").click();
62+
await expect(page.locator(".mx_EntityTile_unreachable")).toContainText("Bob");
63+
await expect(page.locator(".mx_EntityTile_unreachable")).toContainText("User's server unreachable");
64+
});
65+
});
66+
});

0 commit comments

Comments
 (0)