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

Commit da36117

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into SimonBrandner/feat/reaction-redact
2 parents ade966c + 8e9f740 commit da36117

Some content is hidden

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

51 files changed

+1203
-738
lines changed

.github/workflows/cypress.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,25 @@ jobs:
4848

4949
- name: Get commit details
5050
if: github.event.workflow_run.event == 'pull_request'
51+
uses: actions/github-script@v5
52+
with:
53+
script: |
54+
const response = await github.rest.git.getCommit({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
commit_sha: "${{ github.event.workflow_run.head_sha }}",
58+
});
59+
core.exportVariable("COMMIT_INFO_MESSAGE", response.data.message);
60+
core.exportVariable("COMMIT_INFO_AUTHOR", response.data.author.name);
61+
core.exportVariable("COMMIT_INFO_EMAIL", response.data.author.email);
62+
63+
# Only run Percy when it is demanded or on develop
64+
- name: Disable Percy if not needed
65+
if: |
66+
github.event.workflow_run.event == 'pull_request' &&
67+
!contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Needs-Percy')
5168
run: |
52-
echo "COMMIT_INFO_MESSAGE=\"$(git log --format=%B -n 1 ${{ github.event.workflow_run.head_sha }})\"" >> $GITHUB_ENV
53-
echo "COMMIT_INFO_AUTHOR=$(git log --format='%an' -n 1 ${{ github.event.workflow_run.head_sha }})" >> $GITHUB_ENV
54-
echo "COMMIT_INFO_EMAIL=$(git log --format='%ae' -n 1 ${{ github.event.workflow_run.head_sha }})" >> $GITHUB_ENV
55-
# Only run Percy when it is demanded or on develop
56-
if [[ "${{ (contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Needs-Percy') || github.event.workflow_run.event != 'pull_request') }}" == "false" ]]; then
57-
echo "PERCY_ENABLE=0" >> $GITHUB_ENV
58-
fi
69+
echo "PERCY_ENABLE=0" >> $GITHUB_ENV
5970
6071
- name: Run Cypress tests
6172
uses: cypress-io/github-action@v2
@@ -109,10 +120,14 @@ jobs:
109120
store-benchmark:
110121
needs: cypress
111122
runs-on: ubuntu-latest
112-
if: github.event.workflow_run.event != 'pull_request'
123+
if: |
124+
github.event.workflow_run.event != 'pull_request' &&
125+
github.event.workflow_run.head_branch == 'develop'
113126
permissions:
114127
contents: write
115128
steps:
129+
- uses: actions/checkout@v2
130+
116131
- name: Download benchmark result
117132
uses: actions/download-artifact@v3
118133
with:

cypress.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
"videoUploadOnPasses": false,
44
"projectId": "ppvnzg",
55
"experimentalSessionAndOrigin": true,
6-
"experimentalInteractiveRunEvents": true
6+
"experimentalInteractiveRunEvents": true,
7+
"retries": {
8+
"runMode": 2,
9+
"openMode": 0
10+
}
711
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 { MatrixClient } from "../../global";
21+
22+
describe("UserView", () => {
23+
let synapse: SynapseInstance;
24+
25+
beforeEach(() => {
26+
cy.startSynapse("default").then(data => {
27+
synapse = data;
28+
29+
cy.initTestUser(synapse, "Violet");
30+
cy.getBot(synapse, "Usman").as("bot");
31+
});
32+
});
33+
34+
afterEach(() => {
35+
cy.stopSynapse(synapse);
36+
});
37+
38+
it("should render the user view as expected", () => {
39+
cy.get<MatrixClient>("@bot").then(bot => {
40+
cy.visit(`/#/user/${bot.getUserId()}`);
41+
});
42+
43+
cy.get("#mx_RightPanel .mx_UserInfo_profile h2").should("contain", "Usman");
44+
cy.get(".mx_RightPanel .mx_Spinner").should("not.exist"); // wait for spinners to finish
45+
cy.get(".mx_RightPanel").percySnapshotElement("User View", {
46+
// Hide the MXID field as it'll vary on each test
47+
percyCSS: ".mx_UserInfo_profile_mxid { visibility: hidden !important; }",
48+
widths: [260, 500],
49+
});
50+
});
51+
});

cypress/support/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

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

19-
import "./client"; // XXX: without an (any) import here, types break down
2019
import Chainable = Cypress.Chainable;
2120
import AUTWindow = Cypress.AUTWindow;
2221

@@ -41,3 +40,6 @@ Cypress.Commands.add("tweakConfig", (tweaks: Record<string, any>): Chainable<AUT
4140
}
4241
});
4342
});
43+
44+
// Needed to make this file a module
45+
export { };

cypress/support/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ import "./bot";
2828
import "./clipboard";
2929
import "./util";
3030
import "./app";
31+
import "./percy";

cypress/support/percy.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
import { SnapshotOptions as PercySnapshotOptions } from '@percy/core';
19+
20+
declare global {
21+
// eslint-disable-next-line @typescript-eslint/no-namespace
22+
namespace Cypress {
23+
interface SnapshotOptions extends PercySnapshotOptions {
24+
domTransformation?: (documentClone: Document) => void;
25+
}
26+
27+
interface Chainable {
28+
percySnapshotElement(name?: string, options?: SnapshotOptions);
29+
}
30+
31+
interface Chainable {
32+
/**
33+
* Takes a Percy snapshot of a given element
34+
*/
35+
percySnapshotElement(name: string, options: SnapshotOptions): Chainable<void>;
36+
}
37+
}
38+
}
39+
40+
Cypress.Commands.add("percySnapshotElement", { prevSubject: true }, (subject, name, options) => {
41+
cy.percySnapshot(name, {
42+
domTransformation: documentClone => scope(documentClone, subject.selector),
43+
...options,
44+
});
45+
});
46+
47+
function scope(documentClone: Document, selector: string): Document {
48+
const element = documentClone.querySelector(selector);
49+
documentClone.querySelector('body').innerHTML = element.outerHTML;
50+
51+
return documentClone;
52+
}
53+
54+
export { };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"@babel/traverse": "^7.12.12",
135135
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
136136
"@peculiar/webcrypto": "^1.1.4",
137-
"@percy/cli": "^1.1.4",
137+
"@percy/cli": "^1.3.0",
138138
"@percy/cypress": "^3.1.1",
139139
"@sentry/types": "^6.10.0",
140140
"@sinonjs/fake-timers": "^9.1.2",

res/css/_components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
@import "./views/rooms/_ThreadSummary.scss";
276276
@import "./views/rooms/_TopUnreadMessagesBar.scss";
277277
@import "./views/rooms/_VoiceRecordComposerTile.scss";
278+
@import "./views/rooms/_VideoRoomSummary.scss";
278279
@import "./views/rooms/_WhoIsTypingTile.scss";
279280
@import "./views/settings/_AvatarSetting.scss";
280281
@import "./views/settings/_CrossSigningPanel.scss";

res/css/views/beta/_BetaCard.scss

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ limitations under the License.
2020
background-color: $system;
2121
border-radius: 8px;
2222
box-sizing: border-box;
23+
color: $secondary-content;
2324

2425
.mx_BetaCard_columns {
2526
display: flex;
@@ -45,14 +46,13 @@ limitations under the License.
4546
.mx_BetaCard_caption {
4647
font-size: $font-15px;
4748
line-height: $font-20px;
48-
color: $secondary-content;
4949
}
5050

5151
.mx_BetaCard_buttons {
5252
display: flex;
5353
flex-wrap: wrap-reverse;
54-
gap: 12px;
55-
margin: 20px auto;
54+
gap: $spacing-12;
55+
margin: $spacing-20 auto 0;
5656

5757
.mx_AccessibleButton {
5858
padding: 7px 40px;
@@ -66,10 +66,16 @@ limitations under the License.
6666
}
6767
}
6868

69-
.mx_BetaCard_disclaimer {
69+
.mx_BetaCard_refreshWarning {
70+
margin-top: $spacing-8;
71+
font-size: $font-10px;
72+
text-align: center;
73+
}
74+
75+
.mx_BetaCard_faq {
76+
margin-top: $spacing-20;
7077
font-size: $font-12px;
7178
line-height: $font-15px;
72-
color: $secondary-content;
7379

7480
> h4 {
7581
margin: 12px 0 0;
@@ -105,7 +111,6 @@ limitations under the License.
105111
margin-top: 4px;
106112
font-size: $font-12px;
107113
line-height: $font-15px;
108-
color: $secondary-content;
109114
}
110115
}
111116
}

0 commit comments

Comments
 (0)