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

Commit

Permalink
Merge branch 'develop' into unverified_user_identity_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
uhoreg committed Oct 16, 2024
2 parents 3859137 + 950ab19 commit b45ad1e
Show file tree
Hide file tree
Showing 706 changed files with 6,085 additions and 4,281 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ module.exports = {

"import/no-duplicates": ["error"],
// Ban matrix-js-sdk/src imports in favour of matrix-js-sdk/src/matrix imports to prevent unleashing hell.
// Ban compound-design-tokens raw svg imports in favour of their React component counterparts
"no-restricted-imports": [
"error",
{
paths: [
{
name: "@testing-library/react",
message: "Please use jest-matrix-react instead",
},
{
name: "matrix-js-sdk",
message: "Please use matrix-js-sdk/src/matrix instead",
Expand Down Expand Up @@ -150,6 +155,10 @@ module.exports = {
message:
"This regex doesn't actually test for emoji. See the docs at https://emojibase.dev/docs/regex/ and prefer our own EMOJI_REGEX from HtmlUtils.",
},
{
group: ["@vector-im/compound-design-tokens/icons/*"],
message: "Please use @vector-im/compound-design-tokens/assets/web/icons/* instead",
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
backport:
name: Backport
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/end-to-end-tests-netlify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
report:
if: github.event.workflow_run.conclusion != 'cancelled'
name: Report results
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment: Netlify
permissions:
statuses: write
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/end-to-end-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ env:
jobs:
build:
name: "Build Element-Web"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: inputs.skip != true
steps:
- name: Checkout code
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
name: "Run Tests ${{ matrix.runner }}/${{ strategy.job-total }}"
needs: build
if: inputs.skip != true
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
actions: read
issues: read
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
name: end-to-end-tests
needs: playwright
if: always()
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
if: inputs.skip != true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/netlify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
deploy:
if: github.event.workflow_run.conclusion != 'cancelled' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
environment: Netlify
steps:
- name: 📝 Create Deployment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notify-element-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
notify-element-web:
name: "Notify Element Web"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# Only respect triggers from our develop branch, ignore that of forks
if: github.repository == 'element-hq/matrix-react-sdk'
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright-image-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- cron: "0 6 * * *" # Every day at 6am UTC
jobs:
update:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_base_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
check_base_branch:
name: Check PR base branch
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/github-script@v7
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/static_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
ts_lint:
name: "Typescript Syntax Check"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
rethemendex_lint:
name: "Rethemendex Check"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand All @@ -77,7 +77,7 @@ jobs:

js_lint:
name: "ESLint"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand All @@ -95,7 +95,7 @@ jobs:

style_lint:
name: "Style Lint"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand All @@ -113,7 +113,7 @@ jobs:

workflow_lint:
name: "Workflow Lint"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand All @@ -131,7 +131,7 @@ jobs:

analyse_dead_code:
name: "Analyse Dead Code"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
jobs:
jest:
name: Jest
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
name: jest-tests
needs: jest
if: always()
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- if: needs.jest.result != 'skipped' && needs.jest.result != 'success'
run: exit 1
Expand All @@ -111,7 +111,7 @@ jobs:

app-tests:
name: Element Web Integration Tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const config: Config = {
coverageReporters: ["text-summary", "lcov"],
testResultsProcessor: "@casualbot/jest-sonar-reporter",
prettierPath: null,
moduleDirectories: ["node_modules", "test/test-utils"],
};

// if we're running under GHA, enable the GHA reporter
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@
"jwt-decode": "4.0.0",
"@floating-ui/react": "0.26.11",
"@radix-ui/react-id": "1.1.0",
"caniuse-lite": "1.0.30001655"
"caniuse-lite": "1.0.30001655",
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0",
"wrap-ansi": "npm:wrap-ansi@^7.0.0"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@matrix-org/analytics-events": "^0.25.0",
"@matrix-org/emojibase-bindings": "^1.1.2",
"@matrix-org/matrix-wysiwyg": "2.37.9",
"@matrix-org/analytics-events": "^0.26.0",
"@matrix-org/emojibase-bindings": "^1.3.3",
"@vector-im/matrix-wysiwyg": "2.37.13",
"@matrix-org/react-sdk-module-api": "^2.4.0",
"@matrix-org/spec": "^1.7.0",
"@sentry/browser": "^8.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@vector-im/compound-design-tokens": "^1.8.0",
"@vector-im/compound-web": "^5.5.0",
"@vector-im/compound-web": "^7.0.0",
"@zxcvbn-ts/core": "^3.0.4",
"@zxcvbn-ts/language-common": "^3.0.4",
"@zxcvbn-ts/language-en": "^3.0.2",
Expand Down Expand Up @@ -198,6 +200,7 @@
"axe-core": "4.10.0",
"babel-jest": "^29.0.0",
"blob-polyfill": "^9.0.0",
"core-js": "^3.38.1",
"eslint": "8.57.1",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
11 changes: 8 additions & 3 deletions playwright/e2e/crypto/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const testMessages = async (page: Page, bob: Bot, bobRoomId: string) => {
};

const bobJoin = async (page: Page, bob: Bot) => {
// Wait for Bob to get the invite
await bob.evaluate(async (cli) => {
const bobRooms = cli.getRooms();
if (!bobRooms.length) {
Expand All @@ -55,9 +56,13 @@ const bobJoin = async (page: Page, bob: Bot) => {
});
}
});
const roomId = await bob.joinRoomByName("Alice");

const roomId = await bob.joinRoomByName("Alice");
await expect(page.getByText("Bob joined the room")).toBeVisible();

// Even though Alice has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
await bob.awaitRoomMembership(roomId);

return roomId;
};

Expand Down Expand Up @@ -220,8 +225,8 @@ test.describe("Cryptography", function () {

// Assert that verified icon is rendered
await page.getByTestId("base-card-back-button").click();
await page.locator(".mx_RightPanelTabs").getByText("Info").click();
await expect(page.locator('.mx_RoomSummaryCard_badges [data-kind="success"]')).toContainText("Encrypted");
await page.getByLabel("Room info").nth(1).click();
await expect(page.locator('.mx_RoomSummaryCard_badges [data-kind="green"]')).toContainText("Encrypted");

// Take a snapshot of RoomSummaryCard with a verified E2EE icon
await expect(page.locator(".mx_RightPanel")).toMatchScreenshot("RoomSummaryCard-with-verified-e2ee.png");
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/crypto/dehydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test.describe("Dehydration", () => {

await viewRoomSummaryByName(page, app, ROOM_NAME);

await page.locator(".mx_RightPanelTabs").getByText("People").click();
await page.locator(".mx_RightPanel").getByRole("menuitem", { name: "People" }).click();
await expect(page.locator(".mx_MemberList")).toBeVisible();

await getMemberTileByName(page, NAME).click();
Expand Down
27 changes: 18 additions & 9 deletions playwright/e2e/crypto/event-shields.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.describe("Cryptography", function () {
await app.client.bootstrapCrossSigning(aliceCredentials);
await autoJoin(bob);

// create an encrypted room
// create an encrypted room, and wait for Bob to join it.
testRoomId = await createSharedRoomWithUser(app, bob.credentials.userId, {
name: "TestRoom",
initial_state: [
Expand All @@ -46,6 +46,9 @@ test.describe("Cryptography", function () {
},
],
});

// Even though Alice has seen Bob's join event, Bob may not have done so yet. Wait for the sync to arrive.
await bob.awaitRoomMembership(testRoomId);
});

test("should show the correct shield on e2e events", async ({
Expand All @@ -67,7 +70,9 @@ test.describe("Cryptography", function () {
const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_decryption_failure/);
await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("This message could not be decrypted");
await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
"This message could not be decrypted",
);

/* Should show a red padlock for an unencrypted message in an e2e room */
await bob.evaluate(
Expand All @@ -87,7 +92,7 @@ test.describe("Cryptography", function () {
await expect(last).toContainText("test unencrypted");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Not encrypted");
await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText("Not encrypted");

/* Should show no padlock for an unverified user */
// bob sends a valid event
Expand Down Expand Up @@ -120,7 +125,9 @@ test.describe("Cryptography", function () {
await expect(lastTile).toContainText("test encrypted from unverified");
await expect(lastTileE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastTileE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Encrypted by a device not verified by its owner.");
await expect(await app.getTooltipForElement(lastTileE2eIcon)).toContainText(
"Encrypted by a device not verified by its owner.",
);

/* In legacy crypto: should show a grey padlock for a message from a deleted device.
* In rust crypto: should show a red padlock for a message from an unverified device.
Expand Down Expand Up @@ -156,7 +163,7 @@ test.describe("Cryptography", function () {
await expect(last).toContainText("test encrypted from unverified");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText(
await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
workerInfo.project.name === "Legacy Crypto"
? "Encrypted by an unknown or deleted device."
: "Encrypted by a device not verified by its owner.",
Expand Down Expand Up @@ -209,7 +216,7 @@ test.describe("Cryptography", function () {
// The key is coming from backup, so it is not anymore possible to establish if the claimed device
// creator of this key is authentic. The tooltip should be "The authenticity of this encrypted message can't be guaranteed on this device."
// It is not "Encrypted by an unknown or deleted device." even if the claimed device is actually deleted.
await expect(page.getByRole("tooltip")).toContainText(
await expect(await app.getTooltipForElement(lastTileE2eIcon)).toContainText(
"The authenticity of this encrypted message can't be guaranteed on this device.",
);
});
Expand Down Expand Up @@ -287,13 +294,15 @@ test.describe("Cryptography", function () {
// Let our app start syncing again
await app.client.network.goOnline();

// Wait for the messages to arrive
// Wait for the messages to arrive. It can take quite a while for the sync to wake up.
const last = page.locator(".mx_EventTile_last");
await expect(last).toContainText("test encrypted from unverified");
await expect(last).toContainText("test encrypted from unverified", { timeout: 20000 });
const lastE2eIcon = last.locator(".mx_EventTile_e2eIcon");
await expect(lastE2eIcon).toHaveClass(/mx_EventTile_e2eIcon_warning/);
await lastE2eIcon.focus();
await expect(page.getByRole("tooltip")).toContainText("Encrypted by a device not verified by its owner.");
await expect(await app.getTooltipForElement(lastE2eIcon)).toContainText(
"Encrypted by a device not verified by its owner.",
);

const penultimate = page.locator(".mx_EventTile").filter({ hasText: "test encrypted from verified" });
await expect(penultimate.locator(".mx_EventTile_e2eIcon")).not.toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/crypto/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export const verify = async (app: ElementAppPage, bob: Bot) => {
const bobsVerificationRequestPromise = waitForVerificationRequest(bob);

const roomInfo = await app.toggleRoomInfoPanel();
await page.locator(".mx_RightPanelTabs").getByText("People").click();
await page.locator(".mx_RightPanel").getByRole("menuitem", { name: "People" }).click();
await roomInfo.getByText("Bob").click();
await roomInfo.getByRole("button", { name: "Verify" }).click();
await roomInfo.getByRole("button", { name: "Start Verification" }).click();
Expand Down
2 changes: 1 addition & 1 deletion playwright/e2e/integration-manager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import type { ElementAppPage } from "../../pages/ElementAppPage";
export async function openIntegrationManager(app: ElementAppPage) {
const { page } = app;
await app.toggleRoomInfoPanel();
await page.getByRole("tab", { name: "Extensions" }).click();
await page.getByRole("menuitem", { name: "Extensions" }).click();
await page.getByRole("button", { name: "Add extensions" }).click();
}
2 changes: 1 addition & 1 deletion playwright/e2e/lazy-loading/lazy-loading.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test.describe("Lazy Loading", () => {
async function openMemberlist(app: ElementAppPage): Promise<void> {
await app.toggleRoomInfoPanel();
const { page } = app;
await page.locator(".mx_RightPanelTabs").getByText("People").click();
await page.locator(".mx_RightPanel").getByRole("menuitem", { name: "People" }).click();
}

function getMemberInMemberlist(page: Page, name: string): Locator {
Expand Down
Loading

0 comments on commit b45ad1e

Please sign in to comment.