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

Commit b8f3138

Browse files
committed
Merge branch 'develop' of https://github.com/matrix-org/matrix-react-sdk into fix-spacing-SetIntegrationManager
2 parents e6b84b1 + b0de7b3 commit b8f3138

File tree

121 files changed

+3146
-563
lines changed

Some content is hidden

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

121 files changed

+3146
-563
lines changed

.github/workflows/cypress.yaml

Lines changed: 31 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
commit_message: ${{ steps.commit.outputs.message }}
2525
commit_author: ${{ steps.commit.outputs.author }}
2626
commit_email: ${{ steps.commit.outputs.email }}
27-
percy_enable: ${{ steps.percy.outputs.value || '1' }}
28-
testrail_enable: ${{ steps.testrail.outputs.value || '1' }}
27+
percy_enable: ${{ steps.percy.outputs.value || '0' }}
28+
kiwi_enable: ${{ steps.kiwi.outputs.value || '1' }}
2929
steps:
3030
# We create the status here and then update it to success/failure in the `report` stage
3131
# This provides an easy link to this workflow_run from the PR before Cypress is done.
@@ -59,20 +59,23 @@ jobs:
5959
core.setOutput("author", response.data.author.name);
6060
core.setOutput("email", response.data.author.email);
6161
62-
# Only run Percy when it is demanded or on develop
63-
- name: Disable Percy if not needed
62+
# Only run Percy when it is demanded or we are running the daily build
63+
- name: Enable Percy if X-Needs-Percy
6464
id: percy
6565
if: |
66-
github.event.workflow_run.event == 'pull_request' &&
67-
!contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Needs-Percy')
68-
run: echo "::set-output name=value::0"
69-
70-
# Only run Testrail when it is demanded or on develop
71-
- name: Disable Testrail if not needed
72-
id: testrail
66+
github.event.workflow_run.event == 'schedule' ||
67+
(
68+
github.event.workflow_run.event == 'pull_request' &&
69+
contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Needs-Percy')
70+
)
71+
run: echo "::set-output name=value::1"
72+
73+
# Only export to kiwi when it is demanded or on develop
74+
- name: Disable Kiwi if not needed
75+
id: kiwi
7376
if: |
7477
github.event.workflow_run.event == 'pull_request' &&
75-
!contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Send-Testrail')
78+
!contains(fromJSON(steps.prdetails.outputs.data).labels.*.name, 'X-Send-Kiwi')
7679
run: echo "::set-output name=value::0"
7780

7881
- name: Generate unique ID 💎
@@ -222,69 +225,27 @@ jobs:
222225
sha: ${{ github.event.workflow_run.head_sha }}
223226
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
224227

225-
testrail:
226-
name: Report results to testrail
228+
kiwi:
229+
name: Report results to kiwi
227230
needs:
228231
- prepare
229232
- tests
230-
environment: Testrail
233+
environment: Kiwi
231234
runs-on: ubuntu-latest
232-
if: ${{ needs.prepare.outputs.testrail_enable }}
235+
if: ${{ needs.prepare.outputs.kiwi_enable }}
233236
steps:
234-
- uses: actions/download-artifact@v3
237+
- name: Download all zip files
238+
uses: actions/download-artifact@v3
235239
with:
236240
name: cypress-junit
237-
- name: Prepare testrail upload config
238-
id: testrailprep
239-
env:
240-
TESTRAIL_PROJECT_ID: ${{ secrets.TESTRAIL_PROJECT_ID }}
241-
TESTRAIL_SUITE_ID: ${{ secrets.TESTRAIL_SUITE_ID }}
242-
TEST_ID: ${{ github.run_id }}
243-
TESTRAIL_URL: https://elementqa.testrail.io
244-
TESTRAIL_USER: ${{ secrets.TESTRAIL_USER }}
245-
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
246-
run: |
247-
echo '{"name": "element-web cypress '$TEST_ID'", "suite_id": '$TESTRAIL_SUITE_ID' }' > body.json # TODO add description with more context?
248-
RUN_ID=`curl -X POST -d @body.json -u "$TESTRAIL_USER:$TESTRAIL_API_KEY" -H "Content-Type: application/json" "$TESTRAIL_URL/index.php?/api/v2/add_run/$TESTRAIL_PROJECT_ID" | jq '.id'`
249-
PROJECT_NAME=`curl -X GET -u "$TESTRAIL_USER:$TESTRAIL_API_KEY" -H "Content-Type: application/json" "$TESTRAIL_URL/index.php?/api/v2/get_project/$TESTRAIL_PROJECT_ID" | jq '.name'`
250-
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
251-
echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
252-
- name: setup python
253-
uses: actions/setup-python@v4
241+
- name: Upload to kiwi
242+
uses: vector-im/kiwitcms-upload-action@main
254243
with:
255-
python-version: "3.11"
256-
- run: pip install trcli
257-
- name: Upload junit files
258-
env:
259-
TESTRAIL_PROJECT_ID: ${{ secrets.TESTRAIL_PROJECT_ID }}
260-
TESTRAIL_SUITE_ID: ${{ secrets.TESTRAIL_SUITE_ID }}
261-
TESTRAIL_URL: https://elementqa.testrail.io
262-
TESTRAIL_USER: ${{ secrets.TESTRAIL_USER }}
263-
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
264-
TESTRAIL_RUN_ID: ${{ steps.testrailprep.outputs.run_id }}
265-
run: |
266-
for file in results-*.xml; do
267-
echo "Handling $file"
268-
trcli -y -h $TESTRAIL_URL \
269-
--project-id $TESTRAIL_PROJECT_ID \
270-
--project ${{ steps.testrailprep.outputs.project_name }} \
271-
--username $TESTRAIL_USER \
272-
--password $TESTRAIL_API_KEY \
273-
parse_junit \
274-
--run-id $TESTRAIL_RUN_ID \
275-
--suite-id $TESTRAIL_SUITE_ID \
276-
--title "if you see this please check cypress build for run id not being provisioned" \
277-
-f $file || true
278-
# We want to keep uploading what we can; but don't want the failures/red marks when it fails, so we add || true above.
279-
done
280-
- name: Close test run
281-
id: testrailpost
282-
if: always()
283-
env:
284-
TESTRAIL_URL: https://elementqa.testrail.io
285-
TESTRAIL_USER: ${{ secrets.TESTRAIL_USER }}
286-
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
287-
TESTRAIL_RUN_ID: ${{ steps.testrailprep.outputs.run_id }}
288-
run: |
289-
CLOSE_RESPONSE=`curl -X POST -d '{}' -u "$TESTRAIL_USER:$TESTRAIL_API_KEY" -H "Content-Type: application/json" "$TESTRAIL_URL/index.php?/api/v2/close_run/$TESTRAIL_RUN_ID"`
290-
if [ ! "0" == "`echo $CLOSE_RESPONSE | jq .untested_count`" ] ; then echo "::warning title=Missing Tests::Testrail reported some cypress tests were not run. $CLOSE_RESPONSE"; fi
244+
file-pattern: results-*.xml
245+
kiwi-username: ${{ secrets.TCMS_USERNAME }}
246+
kiwi-password: ${{ secrets.TCMS_PASSWORD }}
247+
product: "Element Web"
248+
product-version: ${{ github.event.workflow_run.head_branch }}
249+
build-id: ${{ github.event.workflow_run.head_sha }}
250+
suite-name: "Cypress E2E"
251+
summary-template: "$name"

.github/workflows/element-web.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# as an artifact and run integration tests.
44
name: Element Web - Build
55
on:
6+
schedule:
7+
- cron: "17 4 * * *" # every day at 04:17 UTC
68
pull_request: {}
79
push:
810
branches: [develop, master]

cypress/e2e/login/login.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ describe("Login", () => {
4545
cy.injectAxe();
4646

4747
cy.get("#mx_LoginForm_username", { timeout: 15000 }).should("be.visible");
48-
cy.percySnapshot("Login");
48+
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24688
49+
//cy.percySnapshot("Login");
4950
cy.checkA11y();
5051

5152
cy.get(".mx_ServerPicker_change").click();

cypress/e2e/polls/polls.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ describe("Polls", () => {
118118
cy.get('[aria-label="Poll"]').click();
119119
});
120120

121-
cy.get(".mx_CompoundDialog").percySnapshotElement("Polls Composer");
121+
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24688
122+
//cy.get(".mx_CompoundDialog").percySnapshotElement("Polls Composer");
122123

123124
const pollParams = {
124125
title: "Does the polls feature work?",
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/*
2+
Copyright 2023 Suguru Hirahara
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 { HomeserverInstance } from "../../plugins/utils/homeserver";
20+
import Chainable = Cypress.Chainable;
21+
22+
const ROOM_NAME = "Test room";
23+
const NAME = "Alice";
24+
25+
const viewRoomSummaryByName = (name: string): Chainable<JQuery<HTMLElement>> => {
26+
cy.viewRoomByName(name);
27+
cy.get(".mx_RightPanel_roomSummaryButton").click();
28+
return checkRoomSummaryCard(name);
29+
};
30+
31+
const checkRoomSummaryCard = (name: string): Chainable<JQuery<HTMLElement>> => {
32+
cy.get(".mx_RoomSummaryCard").should("have.length", 1);
33+
return cy.get(".mx_BaseCard_header").should("contain", name);
34+
};
35+
36+
const uploadFile = (file: string) => {
37+
// Upload a file from the message composer
38+
cy.get(".mx_MessageComposer_actions input[type='file']").selectFile(file, { force: true });
39+
40+
cy.get(".mx_Dialog").within(() => {
41+
// Click "Upload" button
42+
cy.get("[data-testid='dialog-primary-button']").should("have.text", "Upload").click();
43+
});
44+
45+
// Wait until the file is sent
46+
cy.get(".mx_RoomView_statusArea_expanded").should("not.exist");
47+
cy.get(".mx_EventTile.mx_EventTile_last .mx_EventTile_receiptSent").should("exist");
48+
};
49+
50+
describe("FilePanel", () => {
51+
let homeserver: HomeserverInstance;
52+
53+
beforeEach(() => {
54+
cy.startHomeserver("default").then((data) => {
55+
homeserver = data;
56+
cy.initTestUser(homeserver, NAME).then(() =>
57+
cy.window({ log: false }).then(() => {
58+
cy.createRoom({ name: ROOM_NAME });
59+
}),
60+
);
61+
});
62+
63+
// Open the file panel
64+
viewRoomSummaryByName(ROOM_NAME);
65+
cy.get(".mx_RoomSummaryCard_icon_files").click();
66+
cy.get(".mx_FilePanel").should("have.length", 1);
67+
});
68+
69+
afterEach(() => {
70+
cy.stopHomeserver(homeserver);
71+
});
72+
73+
describe("render", () => {
74+
it("should list tiles on the panel", () => {
75+
// Upload multiple files
76+
uploadFile("cypress/fixtures/riot.png"); // Image
77+
uploadFile("cypress/fixtures/1sec.ogg"); // Audio
78+
uploadFile("cypress/fixtures/matrix-org-client-versions.json"); // JSON
79+
80+
cy.get(".mx_RoomView_body").within(() => {
81+
// Assert that all of the file were uploaded and rendered
82+
cy.get(".mx_EventTile[data-layout='group']").should("have.length", 3);
83+
84+
// Assert that the image exists and has the alt string
85+
cy.get(".mx_EventTile[data-layout='group'] img[alt='riot.png']").should("exist");
86+
87+
// Assert that the audio player is rendered
88+
cy.get(".mx_EventTile[data-layout='group'] .mx_AudioPlayer_container").should("exist");
89+
90+
// Assert that the file button exists
91+
cy.contains(".mx_EventTile_last[data-layout='group'] .mx_MFileBody", ".json").should("exist");
92+
});
93+
94+
cy.get(".mx_FilePanel").within(() => {
95+
cy.get(".mx_RoomView_MessageList").within(() => {
96+
// Assert that data-layout attribute is not applied to file tiles on the panel
97+
cy.get(".mx_EventTile[data-layout='group']").should("not.exist");
98+
99+
// Assert that all of the file tiles are rendered
100+
cy.get(".mx_EventTile").should("have.length", 3);
101+
102+
// Assert that the download links are rendered
103+
cy.get(".mx_MFileBody_download").should("have.length", 3);
104+
105+
// Assert that the sender of the files is rendered on all of the tiles
106+
cy.get(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName").should("have.length", 3);
107+
cy.contains(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName", NAME);
108+
109+
// Detect the image file
110+
cy.get(".mx_EventTile_mediaLine.mx_EventTile_image").within(() => {
111+
// Assert that the image is specified as thumbnail and has the alt string
112+
cy.get(".mx_MImageBody").within(() => {
113+
cy.get("img[class='mx_MImageBody_thumbnail']").should("exist");
114+
cy.get("img[alt='riot.png']").should("exist");
115+
});
116+
});
117+
118+
// Detect the audio file
119+
cy.get(".mx_EventTile_mediaLine .mx_MAudioBody").within(() => {
120+
// Assert that the audio player is rendered
121+
cy.get(".mx_AudioPlayer_container").within(() => {
122+
// Assert that the play button is rendered
123+
cy.get("[data-testid='play-pause-button']").should("exist");
124+
});
125+
});
126+
127+
// Detect the JSON file
128+
// Assert that the tile is rendered as a button
129+
cy.get(".mx_EventTile_mediaLine .mx_MFileBody .mx_MFileBody_info[role='button']").within(() => {
130+
// Assert that the file name is rendered inside the button
131+
// File name: matrix-org-client-versions.json
132+
cy.contains(".mx_MFileBody_info_filename", "matrix-org");
133+
});
134+
});
135+
136+
// Exclude timestamps and read markers from snapshot
137+
// FIXME: hide mx_SeekBar because flaky - see https://github.com/vector-im/element-web/issues/24897
138+
// Remove this once https://github.com/vector-im/element-web/issues/24898 is fixed.
139+
const percyCSS =
140+
".mx_MessageTimestamp, .mx_RoomView_myReadMarker, .mx_SeekBar { visibility: hidden !important; }";
141+
cy.get(".mx_RoomView_MessageList").percySnapshotElement("File tiles on FilePanel", { percyCSS });
142+
});
143+
});
144+
145+
it("should render the audio pleyer and play the audio file on the panel", () => {
146+
// Upload an image file
147+
uploadFile("cypress/fixtures/1sec.ogg");
148+
149+
cy.get(".mx_FilePanel").within(() => {
150+
cy.get(".mx_RoomView_MessageList").within(() => {
151+
// Detect the audio file
152+
cy.get(".mx_EventTile_mediaLine .mx_MAudioBody").within(() => {
153+
// Assert that the audio player is rendered
154+
cy.get(".mx_AudioPlayer_container").within(() => {
155+
// Assert that the audio file information is rendered
156+
cy.get(".mx_AudioPlayer_mediaInfo").within(() => {
157+
cy.get(".mx_AudioPlayer_mediaName").should("have.text", "1sec.ogg");
158+
cy.contains(".mx_AudioPlayer_byline", "00:01").should("exist");
159+
cy.contains(".mx_AudioPlayer_byline", "(3.56 KB)").should("exist"); // actual size
160+
});
161+
162+
// Assert that the counter is zero before clicking the play button
163+
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
164+
165+
// Click the play button
166+
cy.get("[data-testid='play-pause-button'][aria-label='Play']").click();
167+
168+
// Assert that the pause button is rendered
169+
cy.get("[data-testid='play-pause-button'][aria-label='Pause']").should("exist");
170+
171+
// Assert that the timer is reset when the audio file finished playing
172+
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");
173+
174+
// Assert that the play button is rendered
175+
cy.get("[data-testid='play-pause-button'][aria-label='Play']").should("exist");
176+
});
177+
});
178+
});
179+
});
180+
});
181+
});
182+
183+
describe("download", () => {
184+
it("should download an image via the link on the panel", () => {
185+
// Upload an image file
186+
uploadFile("cypress/fixtures/riot.png");
187+
188+
cy.get(".mx_FilePanel").within(() => {
189+
cy.get(".mx_RoomView_MessageList").within(() => {
190+
// Detect the image file on the panel
191+
cy.get(".mx_EventTile_mediaLine.mx_EventTile_image .mx_MImageBody").within(() => {
192+
// Click the anchor link (not the image itself)
193+
cy.get(".mx_MFileBody_download a").click();
194+
cy.readFile("cypress/downloads/riot.png").should("exist");
195+
});
196+
});
197+
});
198+
});
199+
});
200+
});

cypress/e2e/room-directory/room-directory.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ describe("Room Directory", () => {
9292

9393
cy.get('.mx_SpotlightDialog [aria-label="Search"]').type("{selectAll}{backspace}test1234");
9494
cy.contains(".mx_SpotlightDialog .mx_SpotlightDialog_result_publicRoomName", name).should("exist");
95-
cy.get(".mx_SpotlightDialog_wrapper").percySnapshotElement("Room Directory - filtered one result");
95+
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24881
96+
//cy.get(".mx_SpotlightDialog_wrapper").percySnapshotElement("Room Directory - filtered one result");
9697
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_option").find(".mx_AccessibleButton").contains("Join").click();
9798

9899
cy.url().should("contain", `/#/room/#test1234:localhost`);

0 commit comments

Comments
 (0)