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

Commit

Permalink
Merge branch 'develop' into toger5/call-default-power-levels
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 authored Nov 28, 2023
2 parents 600eff0 + e49a866 commit 28167d8
Show file tree
Hide file tree
Showing 38 changed files with 872 additions and 171 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/end-to-end-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ jobs:
name: Report results
needs: tests
runs-on: ubuntu-latest
environment: Netlify
if: always()
permissions:
statuses: write
deployments: write
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -146,3 +148,15 @@ jobs:
context: ${{ github.workflow }} / end-to-end-tests
sha: ${{ github.event.workflow_run.head_sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: 📤 Deploy to Netlify
uses: matrix-org/netlify-pr-preview@v2
with:
path: playwright-report
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
branch: ${{ github.event.workflow_run.head_branch }}
revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
site_id: ${{ secrets.NETLIFY_SITE_ID }}
desc: Playwright Report
deployment_env: EndToEndTests
60 changes: 0 additions & 60 deletions cypress/e2e/create-room/create-room.spec.ts

This file was deleted.

74 changes: 0 additions & 74 deletions cypress/e2e/location/location.spec.ts

This file was deleted.

43 changes: 43 additions & 0 deletions playwright/e2e/create-room/create-room.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright 2022-2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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 }) => {
const name = "Test room 1";
const topic = "This room is dedicated to this test and this test only!";

const dialog = await app.openCreateRoomDialog();
// Fill name & topic
await dialog.getByRole("textbox", { name: "Name" }).fill(name);
await dialog.getByRole("textbox", { name: "Topic" }).fill(topic);
// Change room to public
await dialog.getByRole("button", { name: "Room visibility" }).click();
await dialog.getByRole("option", { name: "Public room" }).click();
// Fill room address
await dialog.getByRole("textbox", { name: "Room address" }).fill("test-room-1");
// Submit
await dialog.getByRole("button", { name: "Create room" }).click();

await expect(page).toHaveURL(/\/#\/room\/#test-room-1:localhost/);
const header = page.locator(".mx_LegacyRoomHeader");
await expect(header).toContainText(name);
await expect(header).toContainText(topic);
});
});
67 changes: 67 additions & 0 deletions playwright/e2e/location/location.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { Locator, Page } from "@playwright/test";

import { test, expect } from "../../element-web-test";

test.describe("Location sharing", () => {
const selectLocationShareTypeOption = (page: Page, shareType: string): Locator => {
return page.getByTestId(`share-location-option-${shareType}`);
};

const submitShareLocation = (page: Page): Promise<void> => {
return page.getByRole("button", { name: "Share location" }).click();
};

test.use({
displayName: "Tom",
});

test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
window.localStorage.setItem("mx_lhs_size", "0");
});
});

test("sends and displays pin drop location message successfully", async ({ page, user, app }) => {
const roomId = await app.createRoom({});
await page.goto(`/#/room/${roomId}`);

const composerOptions = await app.openMessageComposerOptions();
await composerOptions.getByRole("menuitem", { name: "Location", exact: true }).click();

await selectLocationShareTypeOption(page, "Pin").click();

await page.locator("#mx_LocationPicker_map").click();

await submitShareLocation(page);

await page.locator(".mx_RoomView_body .mx_EventTile .mx_MLocationBody").click({
position: {
x: 225,
y: 150,
},
});

// clicking location tile opens maximised map
await expect(page.getByRole("dialog")).toBeVisible();

await app.closeDialog();

await expect(page.locator(".mx_Marker")).toBeVisible();
});
});
3 changes: 3 additions & 0 deletions playwright/e2e/login/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

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

test.describe("Login", () => {
test.describe("m.login.password", () => {
Expand Down Expand Up @@ -79,6 +80,8 @@ test.describe("Login", () => {

// tests for old-style SSO login, in which we exchange tokens with Synapse, and Synapse talks to an auth server
test.describe("SSO login", () => {
test.skip(isDendrite, "does not yet support SSO");

test.use({
startHomeserverOpts: ({ oAuthServer }, use) =>
use({
Expand Down
5 changes: 4 additions & 1 deletion playwright/e2e/login/soft_logout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { Page } from "@playwright/test";

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

test.describe("Soft logout", () => {
test.use({
Expand Down Expand Up @@ -54,6 +55,8 @@ test.describe("Soft logout", () => {
});

test.describe("with SSO user", () => {
test.skip(isDendrite, "does not yet support SSO");

test.use({
user: async ({ page, homeserver }, use) => {
const user = await doTokenRegistration(page, homeserver);
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/login/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

import { Page, expect } from "@playwright/test";

import { Credentials, HomeserverInstance } from "../../plugins/utils/homeserver";
import { Credentials, HomeserverInstance } from "../../plugins/homeserver";

/** Visit the login page, choose to log in with "OAuth test", register a new account, and redirect back to Element
*/
Expand Down
3 changes: 3 additions & 0 deletions playwright/e2e/register/email.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ limitations under the License.

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

test.describe("Email Registration", async () => {
test.skip(isDendrite, "not yet wired up");

test.use({
// eslint-disable-next-line no-empty-pattern
mailhog: async ({}, use) => {
Expand Down
19 changes: 16 additions & 3 deletions playwright/element-web-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import _ from "lodash";

import type mailhog from "mailhog";
import type { IConfigOptions } from "../src/IConfigOptions";
import { Credentials, HomeserverInstance, StartHomeserverOpts } from "./plugins/utils/homeserver";
import { Synapse } from "./plugins/synapse";
import { Credentials, Homeserver, HomeserverInstance, StartHomeserverOpts } from "./plugins/homeserver";
import { Synapse } from "./plugins/homeserver/synapse";
import { Dendrite, Pinecone } from "./plugins/homeserver/dendrite";
import { Instance } from "./plugins/mailhog";
import { ElementAppPage } from "./pages/ElementAppPage";
import { OAuthServer } from "./plugins/oauth_server";
Expand Down Expand Up @@ -89,7 +90,19 @@ export const test = base.extend<
opts = { template: opts };
}

const server = new Synapse(request);
let server: Homeserver;
const homeserverName = process.env["PLAYWRIGHT_HOMESERVER"];
switch (homeserverName) {
case "dendrite":
server = new Dendrite(request);
break;
case "pinecone":
server = new Pinecone(request);
break;
default:
server = new Synapse(request);
}

await use(await server.start(opts));
await server.stop();
},
Expand Down
Loading

0 comments on commit 28167d8

Please sign in to comment.