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

Commit c494e3c

Browse files
committed
Merge branch 'develop' into staging
# Conflicts: # package.json # src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx
2 parents f988a93 + 610ee53 commit c494e3c

File tree

441 files changed

+10983
-7288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

441 files changed

+10983
-7288
lines changed

.github/workflows/cypress.yaml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
# Triggers after the layered build has finished, taking the artifact and running cypress on it
2+
#
3+
# Also called by a workflow in matrix-js-sdk.
4+
#
25
name: Cypress End to End Tests
36
on:
47
workflow_run:
58
workflows: ["Element Web - Build"]
69
types:
710
- completed
11+
12+
# support calls from other workflows
13+
workflow_call:
14+
inputs:
15+
react-sdk-repository:
16+
type: string
17+
required: true
18+
description: "The name of the github repository to check out and build."
19+
rust-crypto:
20+
type: boolean
21+
required: false
22+
description: "Enable Rust cryptography for the cypress run."
23+
secrets:
24+
CYPRESS_RECORD_KEY:
25+
required: true
26+
827
concurrency:
928
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.run_id }}
1029
cancel-in-progress: ${{ github.event.workflow_run.event == 'pull_request' }}
30+
1131
jobs:
1232
prepare:
1333
name: Prepare
@@ -100,16 +120,10 @@ jobs:
100120
- uses: browser-actions/setup-chrome@c485fa3bab6be59dce18dbc18ef6ab7cbc8ff5f1
101121
- run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
102122

103-
- uses: tecolicom/actions-use-apt-tools@ceaf289fdbc6169fd2406a0f0365a584ffba003b # v1
104-
with:
105-
# Our test suite includes some screenshot tests with unusual diacritics, which are
106-
# supposed to be covered by STIXGeneral.
107-
tools: fonts-stix
108-
109123
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
110124
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
111125
- name: 📥 Download artifact
112-
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67 # v2
126+
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2
113127
with:
114128
run_id: ${{ github.event.workflow_run.id }}
115129
name: previewbuild
@@ -129,14 +143,23 @@ jobs:
129143
# XXX: We're checking out untrusted code in a secure context
130144
# We need to be careful to not trust anything this code outputs/may do
131145
#
132-
# Note that we check out from the default repository, which is (for this workflow) the
146+
# Note that (in the absence of a `react-sdk-repository` input),
147+
# we check out from the default repository, which is (for this workflow) the
133148
# *target* repository for the pull request.
149+
#
134150
ref: ${{ steps.sha.outputs.sha }}
135151
persist-credentials: false
136152
path: matrix-react-sdk
153+
repository: ${{ inputs.react-sdk-repository || github.repository }}
154+
155+
# Enable rust crypto if the calling workflow requests it
156+
- name: Enable rust crypto
157+
if: inputs.rust-crypto
158+
run: |
159+
echo "CYPRESS_RUST_CRYPTO=1" >> "$GITHUB_ENV"
137160
138161
- name: Run Cypress tests
139-
uses: cypress-io/github-action@59c3b9b4a1a6e623c29806797d849845443487d1
162+
uses: cypress-io/github-action@40a1a26c08d0e549e8516612ecebbd1ab5eeec8f
140163
with:
141164
working-directory: matrix-react-sdk
142165
# The built-in Electron runner seems to grind to a halt trying

.github/workflows/element-web.yaml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,47 @@ on:
1212
branches: [develop, master]
1313
repository_dispatch:
1414
types: [upstream-sdk-notify]
15+
16+
# support triggering from other workflows
17+
workflow_call:
18+
inputs:
19+
react-sdk-repository:
20+
type: string
21+
required: true
22+
description: "The name of the github repository to check out and build."
23+
24+
matrix-js-sdk-sha:
25+
type: string
26+
required: false
27+
description: "The Git SHA of matrix-js-sdk to build against. By default, will use a matching branch name if it exists, or develop."
28+
1529
concurrency:
1630
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1731
cancel-in-progress: true
32+
1833
env:
19-
# These must be set for fetchdep.sh to get the right branch
20-
REPOSITORY: ${{ github.repository }}
34+
# fetchdep.sh needs to know our PR number
2135
PR_NUMBER: ${{ github.event.pull_request.number }}
36+
2237
jobs:
2338
build:
2439
name: "Build Element-Web"
2540
runs-on: ubuntu-latest
2641
steps:
27-
- uses: actions/checkout@v3
42+
- name: Checkout code
43+
uses: actions/checkout@v3
44+
with:
45+
repository: ${{ inputs.react-sdk-repository || github.repository }}
2846

2947
- uses: actions/setup-node@v3
3048
with:
3149
cache: "yarn"
3250

3351
- name: Fetch layered build
3452
id: layered_build
53+
env:
54+
# tell layered.sh to check out the right sha of the JS-SDK, if we were given one
55+
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
3556
run: |
3657
scripts/ci/layered.sh
3758
JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD)
@@ -43,17 +64,20 @@ jobs:
4364
run: cp element.io/develop/config.json config.json
4465
working-directory: ./element-web
4566

46-
# After building we write the version file and the react-sdk sha so our cypress tests are from the same sha
4767
- name: Build
4868
env:
4969
CI_PACKAGE: true
5070
VERSION: "${{ steps.layered_build.outputs.VERSION }}"
5171
run: |
5272
yarn build
5373
echo $VERSION > webapp/version
54-
echo $GITHUB_SHA > webapp/sha
5574
working-directory: ./element-web
5675

76+
# Record the react-sdk sha so our cypress tests are from the same sha
77+
- name: Record react-sdk SHA
78+
run: |
79+
git rev-parse HEAD > element-web/webapp/sha
80+
5781
- name: Upload Artifact
5882
uses: actions/upload-artifact@v3
5983
with:

.github/workflows/netlify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
3434
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
3535
- name: 📥 Download artifact
36-
uses: dawidd6/action-download-artifact@5e780fc7bbd0cac69fc73271ed86edf5dcb72d67 # v2
36+
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2
3737
with:
3838
run_id: ${{ github.event.workflow_run.id }}
3939
name: previewbuild

.github/workflows/static_analysis.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1212
cancel-in-progress: true
13+
1314
env:
14-
# These must be set for fetchdep.sh to get the right branch
15-
REPOSITORY: ${{ github.repository }}
15+
# fetchdep.sh needs to know our PR number
1616
PR_NUMBER: ${{ github.event.pull_request.number }}
17+
1718
jobs:
1819
ts_lint:
1920
name: "Typescript Syntax Check"
@@ -59,7 +60,7 @@ jobs:
5960

6061
- name: Get diff lines
6162
id: diff
62-
uses: Equip-Collaboration/diff-line-numbers@df70b4b83e05105c15f20dc6cc61f1463411b2a6 # v1.0.0
63+
uses: Equip-Collaboration/diff-line-numbers@e752977e2cb4207d671bb9e4dad18c07c1b73d52 # v1.1.0
6364
with:
6465
include: '["\\.tsx?$"]'
6566

.github/workflows/tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ on:
2020
concurrency:
2121
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
2222
cancel-in-progress: true
23+
2324
env:
2425
ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }}
25-
# These must be set for fetchdep.sh to get the right branch
26-
REPOSITORY: ${{ github.repository }}
26+
# fetchdep.sh needs to know our PR number
2727
PR_NUMBER: ${{ github.event.pull_request.number }}
28+
2829
jobs:
2930
jest:
3031
name: Jest

.stylelintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module.exports = {
3333
"import-notation": null,
3434
"value-keyword-case": null,
3535
"declaration-block-no-redundant-longhand-properties": null,
36+
"declaration-block-no-duplicate-properties": [
37+
true,
38+
// useful for fallbacks
39+
{ ignore: ["consecutive-duplicates-with-different-values"] },
40+
],
3641
"shorthand-property-no-redundant-values": null,
3742
"property-no-vendor-prefix": null,
3843
"value-no-vendor-prefix": null,

cypress/e2e/audio-player/audio-player.spec.ts

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe("Audio player", () => {
176176

177177
// Enable high contrast manually
178178
cy.openUserSettings("Appearance")
179-
.get(".mx_ThemeChoicePanel")
179+
.findByTestId("mx_ThemeChoicePanel")
180180
.findByLabelText("Use high contrast")
181181
.click({ force: true }); // force click because the size of the checkbox is zero
182182

@@ -333,30 +333,33 @@ describe("Audio player", () => {
333333

334334
// On a thread
335335
cy.get(".mx_ThreadView").within(() => {
336-
cy.get(".mx_EventTile_last")
337-
.within(() => {
338-
// Assert that the player is correctly rendered on a thread
339-
cy.get(".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container").within(() => {
340-
// Assert that the counter is zero before clicking the play button
341-
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
342-
343-
// Find and click "Play" button, the wait is to make the test less flaky
344-
cy.findByRole("button", { name: "Play" }).should("exist");
345-
cy.wait(500).findByRole("button", { name: "Play" }).click();
346-
347-
// Assert that "Pause" button can be found
348-
cy.findByRole("button", { name: "Pause" }).should("exist");
349-
350-
// Assert that the timer is reset when the audio file finished playing
351-
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
352-
353-
// Assert that "Play" button can be found
354-
cy.findByRole("button", { name: "Play" }).should("exist").should("not.have.attr", "disabled");
355-
});
356-
})
357-
.realHover()
358-
.findByRole("button", { name: "Reply" })
359-
.click(); // Find and click "Reply" button
336+
cy.get(".mx_EventTile_last").within(() => {
337+
// Assert that the player is correctly rendered on a thread
338+
cy.get(".mx_EventTile_mediaLine .mx_MAudioBody .mx_AudioPlayer_container").within(() => {
339+
// Assert that the counter is zero before clicking the play button
340+
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
341+
342+
// Find and click "Play" button, the wait is to make the test less flaky
343+
cy.findByRole("button", { name: "Play" }).should("exist");
344+
cy.wait(500).findByRole("button", { name: "Play" }).click();
345+
346+
// Assert that "Pause" button can be found
347+
cy.findByRole("button", { name: "Pause" }).should("exist");
348+
349+
// Assert that the timer is reset when the audio file finished playing
350+
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
351+
352+
// Assert that "Play" button can be found
353+
cy.findByRole("button", { name: "Play" }).should("exist").should("not.have.attr", "disabled");
354+
});
355+
});
356+
357+
// Find and click "Reply" button
358+
//
359+
// Calling cy.get(".mx_EventTile_last") again here is a workaround for
360+
// https://github.com/matrix-org/matrix-js-sdk/issues/3394: the event tile may have been re-mounted while
361+
// the audio was playing.
362+
cy.get(".mx_EventTile_last").realHover().findByRole("button", { name: "Reply" }).click();
360363

361364
cy.get(".mx_MessageComposer--compact").within(() => {
362365
// Assert that the reply preview is rendered on the message composer

cypress/e2e/composer/composer.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,10 @@ describe("Composer", () => {
225225
});
226226
// ...inserts the username into the composer
227227
cy.findByRole("textbox").within(() => {
228-
// TODO update this test when the mentions are inserted as pills, instead
229-
// of as text
230-
cy.findByText(otherUserName, { exact: false }).should("exist");
228+
cy.findByText(otherUserName, { exact: false })
229+
.should("exist")
230+
.should("have.attr", "contenteditable", "false")
231+
.should("have.attr", "data-mention-type", "user");
231232
});
232233

233234
// Send the message to clear the composer
@@ -250,9 +251,10 @@ describe("Composer", () => {
250251
// Selecting the autocomplete option using Enter inserts it into the composer
251252
cy.findByRole("textbox").type(`{Enter}`);
252253
cy.findByRole("textbox").within(() => {
253-
// TODO update this test when the mentions are inserted as pills, instead
254-
// of as text
255-
cy.findByText(otherUserName, { exact: false }).should("exist");
254+
cy.findByText(otherUserName, { exact: false })
255+
.should("exist")
256+
.should("have.attr", "contenteditable", "false")
257+
.should("have.attr", "data-mention-type", "user");
256258
});
257259
});
258260
});

cypress/e2e/crypto/complete-security.spec.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ limitations under the License.
1616

1717
import type { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
1818
import { HomeserverInstance } from "../../plugins/utils/homeserver";
19-
import { handleVerificationRequest, waitForVerificationRequest } from "./utils";
19+
import { handleVerificationRequest, logIntoElement, waitForVerificationRequest } from "./utils";
2020
import { CypressBot } from "../../support/bot";
21+
import { skipIfRustCrypto } from "../../support/util";
2122

2223
describe("Complete security", () => {
2324
let homeserver: HomeserverInstance;
@@ -46,6 +47,8 @@ describe("Complete security", () => {
4647
});
4748

4849
it("should walk through device verification if we have a signed device", () => {
50+
skipIfRustCrypto();
51+
4952
// create a new user, and have it bootstrap cross-signing
5053
let botClient: CypressBot;
5154
cy.getBot(homeserver, { displayName: "Jeff" })
@@ -66,7 +69,6 @@ describe("Complete security", () => {
6669

6770
// accept the verification request on the "bot" side
6871
cy.wrap(botVerificationRequestPromise).then(async (verificationRequest: VerificationRequest) => {
69-
await verificationRequest.accept();
7072
await handleVerificationRequest(verificationRequest);
7173
});
7274

@@ -80,22 +82,3 @@ describe("Complete security", () => {
8082
});
8183
});
8284
});
83-
84-
/**
85-
* Fill in the login form in element with the given creds
86-
*/
87-
function logIntoElement(homeserverUrl: string, username: string, password: string) {
88-
cy.visit("/#/login");
89-
90-
// select homeserver
91-
cy.findByRole("button", { name: "Edit" }).click();
92-
cy.findByRole("textbox", { name: "Other homeserver" }).type(homeserverUrl);
93-
cy.findByRole("button", { name: "Continue" }).click();
94-
95-
// wait for the dialog to go away
96-
cy.get(".mx_ServerPickerDialog").should("not.exist");
97-
98-
cy.findByRole("textbox", { name: "Username" }).type(username);
99-
cy.findByPlaceholderText("Password").type(password);
100-
cy.findByRole("button", { name: "Sign in" }).click();
101-
}

0 commit comments

Comments
 (0)