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

Commit a4c9ba7

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feature/private-read-receipts
Signed-off-by: Šimon Brandner <[email protected]>
2 parents 774fbdc + d793490 commit a4c9ba7

File tree

185 files changed

+7603
-9481
lines changed

Some content is hidden

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

185 files changed

+7603
-9481
lines changed

.github/codecov.yml

-12
This file was deleted.

.github/workflows/netlify.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
if: always()
8585
with:
8686
step: finish
87+
override: false
8788
token: ${{ secrets.GITHUB_TOKEN }}
8889
status: ${{ job.status }}
8990
env: ${{ steps.deployment.outputs.env }}

.github/workflows/preview_changelog.yaml

-12
This file was deleted.

.github/workflows/pull_request.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Pull Request
2+
on:
3+
pull_request_target:
4+
types: [ opened, edited, labeled, unlabeled ]
5+
jobs:
6+
changelog:
7+
name: Preview Changelog
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: matrix-org/allchange@main
11+
with:
12+
ghToken: ${{ secrets.GITHUB_TOKEN }}
13+
14+
enforce-label:
15+
name: Enforce Labels
16+
runs-on: ubuntu-latest
17+
permissions:
18+
pull-requests: read
19+
steps:
20+
- uses: yogevbd/[email protected]
21+
with:
22+
REQUIRED_LABELS_ANY: "T-Defect,T-Enhancement,T-Task"
23+
BANNED_LABELS: "X-Blocked"
24+
BANNED_LABELS_DESCRIPTION: "Preventing merge whilst PR is marked blocked!"

.github/workflows/sonarqube.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: SonarQube
2+
on:
3+
workflow_run:
4+
workflows: [ "Tests" ]
5+
types:
6+
- completed
7+
jobs:
8+
sonarqube:
9+
name: SonarQube
10+
runs-on: ubuntu-latest
11+
if: github.event.workflow_run.conclusion == 'success'
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
17+
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
18+
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
19+
- name: Download Coverage Report
20+
uses: actions/[email protected]
21+
with:
22+
script: |
23+
const artifacts = await github.actions.listWorkflowRunArtifacts({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
run_id: ${{ github.event.workflow_run.id }},
27+
});
28+
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
29+
return artifact.name == "coverage"
30+
})[0];
31+
const download = await github.actions.downloadArtifact({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
artifact_id: matchArtifact.id,
35+
archive_format: 'zip',
36+
});
37+
const fs = require('fs');
38+
fs.writeFileSync('${{github.workspace}}/coverage.zip', Buffer.from(download.data));
39+
40+
- name: Extract Coverage Report
41+
run: unzip -d coverage coverage.zip && rm coverage.zip
42+
43+
- name: SonarCloud Scan
44+
uses: SonarSource/sonarcloud-github-action@master
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
47+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/static_analysis.yaml

+22-14
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,32 @@ jobs:
3838
run: "yarn run lint:types"
3939

4040
i18n_lint:
41-
name: "i18n Diff Check"
41+
name: "i18n Check"
4242
runs-on: ubuntu-latest
43+
permissions:
44+
pull-requests: read
4345
steps:
4446
- uses: actions/checkout@v2
4547

48+
- name: "Get modified files"
49+
id: changed_files
50+
if: github.event_name == 'pull_request' && github.actor != 'RiotTranslateBot'
51+
uses: tj-actions/changed-files@v19
52+
with:
53+
files: |
54+
src/i18n/strings/*
55+
files_ignore: |
56+
src/i18n/strings/en_EN.json
57+
58+
- name: "Assert only en_EN was modified"
59+
if: |
60+
github.event_name == 'pull_request' &&
61+
github.actor != 'RiotTranslateBot' &&
62+
steps.changed_files.outputs.any_modified == 'true'
63+
run: |
64+
echo "You can only modify en_EN.json, do not touch any of the other i18n files as Weblate will be confused"
65+
exit 1
66+
4667
- uses: actions/setup-node@v3
4768
with:
4869
cache: 'yarn'
@@ -87,16 +108,3 @@ jobs:
87108

88109
- name: Run Linter
89110
run: "yarn run lint:style"
90-
91-
sonarqube:
92-
name: "SonarQube"
93-
runs-on: ubuntu-latest
94-
steps:
95-
- uses: actions/checkout@v2
96-
with:
97-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
98-
- name: SonarCloud Scan
99-
uses: SonarSource/sonarcloud-github-action@master
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/tests.yml

+8-12
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@ env:
1111
PR_NUMBER: ${{ github.event.pull_request.number }}
1212
jobs:
1313
jest:
14-
name: Jest with Codecov
14+
name: Jest
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v2
19-
with:
20-
# If this is a pull request, make sure we check out its head rather than the
21-
# automatically generated merge commit, so that the coverage diff excludes
22-
# unrelated changes in the base branch
23-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
2419

2520
- name: Yarn cache
2621
uses: actions/setup-node@v3
@@ -31,11 +26,12 @@ jobs:
3126
run: "./scripts/ci/install-deps.sh --ignore-scripts"
3227

3328
- name: Run tests with coverage
34-
run: "yarn coverage"
29+
run: "yarn coverage --ci"
3530

36-
- name: Upload coverage
37-
uses: codecov/codecov-action@v2
31+
- name: Upload Artifact
32+
uses: actions/upload-artifact@v2
3833
with:
39-
fail_ci_if_error: false
40-
verbose: true
41-
override_commit: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
34+
name: coverage
35+
path: |
36+
coverage
37+
!coverage/lcov-report
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Upgrade Dependencies
2+
on:
3+
workflow_dispatch: { }
4+
jobs:
5+
upgrade:
6+
uses: matrix-org/matrix-js-sdk/.github/workflows/upgrade_dependencies.yml@develop
7+
secrets:
8+
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
[![npm](https://img.shields.io/npm/v/matrix-react-sdk)](https://www.npmjs.com/package/matrix-react-sdk)
2+
![Tests](https://github.com/matrix-org/matrix-react-sdk/actions/workflows/tests.yml/badge.svg)
3+
![Static Analysis](https://github.com/matrix-org/matrix-react-sdk/actions/workflows/static_analysis.yaml/badge.svg)
4+
[![Weblate](https://translate.element.io/widgets/element-web/-/matrix-react-sdk/svg-badge.svg)](https://translate.element.io/engage/element-web/)
5+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk)
6+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk)
7+
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk)
8+
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=matrix-react-sdk&metric=bugs)](https://sonarcloud.io/summary/new_code?id=matrix-react-sdk)
9+
110
matrix-react-sdk
211
================
312

cypress/integration/1-register/register.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,34 @@ limitations under the License.
1616

1717
/// <reference types="cypress" />
1818

19-
import { SynapseInstance } from "../../plugins/synapsedocker/index";
19+
import { SynapseInstance } from "../../plugins/synapsedocker";
2020

2121
describe("Registration", () => {
22-
let synapseId;
23-
let synapsePort;
22+
let synapse: SynapseInstance;
2423

2524
beforeEach(() => {
26-
cy.task<SynapseInstance>("synapseStart", "consent").then(result => {
27-
synapseId = result.synapseId;
28-
synapsePort = result.port;
29-
});
3025
cy.visit("/#/register");
26+
cy.startSynapse("consent").then(data => {
27+
synapse = data;
28+
});
3129
});
3230

3331
afterEach(() => {
34-
cy.task("synapseStop", synapseId);
32+
cy.stopSynapse(synapse);
3533
});
3634

3735
it("registers an account and lands on the home screen", () => {
3836
cy.get(".mx_ServerPicker_change", { timeout: 15000 }).click();
39-
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(`http://localhost:${synapsePort}`);
37+
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl);
4038
cy.get(".mx_ServerPickerDialog_continue").click();
4139
// wait for the dialog to go away
4240
cy.get('.mx_ServerPickerDialog').should('not.exist');
41+
4342
cy.get("#mx_RegistrationForm_username").type("alice");
4443
cy.get("#mx_RegistrationForm_password").type("totally a great password");
4544
cy.get("#mx_RegistrationForm_passwordConfirm").type("totally a great password");
4645
cy.get(".mx_Login_submit").click();
46+
4747
cy.get(".mx_RegistrationEmailPromptDialog button.mx_Dialog_primary").click();
4848
cy.get(".mx_InteractiveAuthEntryComponents_termsPolicy input").click();
4949
cy.get(".mx_InteractiveAuthEntryComponents_termsSubmit").click();
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2022 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+
/// <reference types="cypress" />
18+
19+
import { SynapseInstance } from "../../plugins/synapsedocker";
20+
21+
describe("Login", () => {
22+
let synapse: SynapseInstance;
23+
24+
beforeEach(() => {
25+
cy.visit("/#/login");
26+
cy.startSynapse("consent").then(data => {
27+
synapse = data;
28+
});
29+
});
30+
31+
afterEach(() => {
32+
cy.stopSynapse(synapse);
33+
});
34+
35+
describe("m.login.password", () => {
36+
const username = "user1234";
37+
const password = "p4s5W0rD";
38+
39+
beforeEach(() => {
40+
cy.registerUser(synapse, username, password);
41+
});
42+
43+
it("logs in with an existing account and lands on the home screen", () => {
44+
cy.get(".mx_ServerPicker_change", { timeout: 15000 }).click();
45+
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(synapse.baseUrl);
46+
cy.get(".mx_ServerPickerDialog_continue").click();
47+
// wait for the dialog to go away
48+
cy.get('.mx_ServerPickerDialog').should('not.exist');
49+
50+
cy.get("#mx_LoginForm_username").type(username);
51+
cy.get("#mx_LoginForm_password").type(password);
52+
cy.get(".mx_Login_submit").click();
53+
54+
cy.url().should('contain', '/#/home');
55+
});
56+
});
57+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Copyright 2022 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+
/// <reference types="cypress" />
18+
19+
import { SynapseInstance } from "../../plugins/synapsedocker";
20+
import type { UserCredentials } from "../../support/login";
21+
22+
describe("UserMenu", () => {
23+
let synapse: SynapseInstance;
24+
let user: UserCredentials;
25+
26+
beforeEach(() => {
27+
cy.startSynapse("consent").then(data => {
28+
synapse = data;
29+
30+
cy.initTestUser(synapse, "Jeff").then(credentials => {
31+
user = credentials;
32+
});
33+
});
34+
});
35+
36+
afterEach(() => {
37+
cy.stopSynapse(synapse);
38+
});
39+
40+
it("should contain our name & userId", () => {
41+
cy.get('[aria-label="User menu"]', { timeout: 15000 }).click();
42+
cy.get(".mx_UserMenu_contextMenu_displayName").should("contain", "Jeff");
43+
cy.get(".mx_UserMenu_contextMenu_userId").should("contain", user.userId);
44+
});
45+
});

cypress/plugins/index.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ limitations under the License.
1616

1717
/// <reference types="cypress" />
1818

19-
import { synapseDocker } from "./synapsedocker/index";
19+
import { synapseDocker } from "./synapsedocker";
20+
import PluginEvents = Cypress.PluginEvents;
21+
import PluginConfigOptions = Cypress.PluginConfigOptions;
2022

21-
export default function(on, config) {
23+
/**
24+
* @type {Cypress.PluginConfig}
25+
*/
26+
export default function(on: PluginEvents, config: PluginConfigOptions) {
2227
synapseDocker(on, config);
2328
}

0 commit comments

Comments
 (0)