Remove use of KnownMembership from playwright tests
This commit is contained in:
parent
d3c0435446
commit
5cd7743fcb
5 changed files with 10 additions and 17 deletions
|
@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
|
||||||
|
|
||||||
import type { Page } from "@playwright/test";
|
import type { Page } from "@playwright/test";
|
||||||
import { test, expect } from "../../element-web-test";
|
import { test, expect } from "../../element-web-test";
|
||||||
import {
|
import {
|
||||||
|
@ -89,7 +87,7 @@ const bobJoin = async (page: Page, bob: Bot) => {
|
||||||
async function autoJoin(client: Client) {
|
async function autoJoin(client: Client) {
|
||||||
await client.evaluate((cli) => {
|
await client.evaluate((cli) => {
|
||||||
cli.on(window.matrixcs.RoomMemberEvent.Membership, (event, member) => {
|
cli.on(window.matrixcs.RoomMemberEvent.Membership, (event, member) => {
|
||||||
if (member.membership === KnownMembership.Invite && member.userId === cli.getUserId()) {
|
if (member.membership === "invite" && member.userId === cli.getUserId()) {
|
||||||
cli.joinRoom(member.roomId);
|
cli.joinRoom(member.roomId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||||
|
|
||||||
import jsQR from "jsqr";
|
import jsQR from "jsqr";
|
||||||
import { type Preset, type Visibility } from "matrix-js-sdk/src/matrix";
|
import { type Preset, type Visibility } from "matrix-js-sdk/src/matrix";
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
|
||||||
|
|
||||||
import type { JSHandle, Locator, Page } from "@playwright/test";
|
import type { JSHandle, Locator, Page } from "@playwright/test";
|
||||||
import type { VerificationRequest, Verifier } from "matrix-js-sdk/src/crypto-api";
|
import type { VerificationRequest, Verifier } from "matrix-js-sdk/src/crypto-api";
|
||||||
|
@ -263,7 +262,7 @@ test.describe("User verification", () => {
|
||||||
const bobVerificationRequest = await bob.evaluateHandle(
|
const bobVerificationRequest = await bob.evaluateHandle(
|
||||||
async (client, { dmRoomId, aliceCredentials }) => {
|
async (client, { dmRoomId, aliceCredentials }) => {
|
||||||
const room = client.getRoom(dmRoomId);
|
const room = client.getRoom(dmRoomId);
|
||||||
while (room.getMember(aliceCredentials.userId)?.membership !== KnownMembership.Join) {
|
while (room.getMember(aliceCredentials.userId)?.membership !== "join") {
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
room.once(window.matrixcs.RoomStateEvent.Members, resolve);
|
room.once(window.matrixcs.RoomStateEvent.Members, resolve);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { type Visibility } from "matrix-js-sdk/src/matrix";
|
import { type Visibility } from "matrix-js-sdk/src/matrix";
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
|
||||||
|
|
||||||
import { test, expect } from "../../element-web-test";
|
import { test, expect } from "../../element-web-test";
|
||||||
import { waitForRoom } from "../utils";
|
import { waitForRoom } from "../utils";
|
||||||
|
@ -75,7 +74,7 @@ test.describe("Knock Into Room", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Knock &&
|
e.getContent()?.membership === "knock" &&
|
||||||
e.getContent()?.displayname === "Alice",
|
e.getContent()?.displayname === "Alice",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -110,7 +109,7 @@ test.describe("Knock Into Room", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Knock &&
|
e.getContent()?.membership === "knock" &&
|
||||||
e.getContent()?.displayname === "Alice",
|
e.getContent()?.displayname === "Alice",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -152,7 +151,7 @@ test.describe("Knock Into Room", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Knock &&
|
e.getContent()?.membership === "knock" &&
|
||||||
e.getContent()?.displayname === "Alice",
|
e.getContent()?.displayname === "Alice",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -194,7 +193,7 @@ test.describe("Knock Into Room", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Knock &&
|
e.getContent()?.membership === "knock" &&
|
||||||
e.getContent()?.displayname === "Alice",
|
e.getContent()?.displayname === "Alice",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -260,7 +259,7 @@ test.describe("Knock Into Room", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Knock &&
|
e.getContent()?.membership === "knock" &&
|
||||||
e.getContent()?.displayname === "Alice",
|
e.getContent()?.displayname === "Alice",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,8 +16,6 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
|
||||||
|
|
||||||
import { test, expect } from "../../element-web-test";
|
import { test, expect } from "../../element-web-test";
|
||||||
import { waitForRoom } from "../utils";
|
import { waitForRoom } from "../utils";
|
||||||
|
|
||||||
|
@ -75,7 +73,7 @@ test.describe("Manage Knocks", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Leave &&
|
e.getContent()?.membership === "leave" &&
|
||||||
e.getContent()?.displayname === "Bob",
|
e.getContent()?.displayname === "Bob",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -112,7 +110,7 @@ test.describe("Manage Knocks", () => {
|
||||||
return events.some(
|
return events.some(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.getType() === "m.room.member" &&
|
e.getType() === "m.room.member" &&
|
||||||
e.getContent()?.membership === KnownMembership.Leave &&
|
e.getContent()?.membership === "leave" &&
|
||||||
e.getContent()?.displayname === "Bob",
|
e.getContent()?.displayname === "Bob",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||||
import { JSHandle, Page } from "@playwright/test";
|
import { JSHandle, Page } from "@playwright/test";
|
||||||
import { uniqueId } from "lodash";
|
import { uniqueId } from "lodash";
|
||||||
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
|
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
|
||||||
|
|
||||||
import type { Logger } from "matrix-js-sdk/src/logger";
|
import type { Logger } from "matrix-js-sdk/src/logger";
|
||||||
import type { SecretStorageKeyDescription } from "matrix-js-sdk/src/secret-storage";
|
import type { SecretStorageKeyDescription } from "matrix-js-sdk/src/secret-storage";
|
||||||
|
@ -179,7 +178,7 @@ export class Bot extends Client {
|
||||||
|
|
||||||
if (opts.autoAcceptInvites) {
|
if (opts.autoAcceptInvites) {
|
||||||
cli.on(window.matrixcs.RoomMemberEvent.Membership, (event, member) => {
|
cli.on(window.matrixcs.RoomMemberEvent.Membership, (event, member) => {
|
||||||
if (member.membership === KnownMembership.Invite && member.userId === cli.getUserId()) {
|
if (member.membership === "invite" && member.userId === cli.getUserId()) {
|
||||||
cli.joinRoom(member.roomId);
|
cli.joinRoom(member.roomId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue