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

Add a setting to allow users to set account-wide custom notification sound #10494

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c97f619
Add custom notification setting
kenwuuu Mar 31, 2023
164dc99
Merge branch 'develop' into feature/custom_global_notification_sound
kenwuuu Mar 31, 2023
cef6c6d
Merge branch 'develop' into feature/custom_global_notification_sound
kenwuuu Apr 8, 2023
b2032f1
Call NotificationSound with roomId
kenwuuu Apr 15, 2023
3839113
Merge branch 'develop' into feature/custom_global_notification_sound
kenwuuu Apr 15, 2023
c6c5112
remove comment
kenwuuu Apr 16, 2023
41c0b08
Update pills-click-in-app.spec.ts - use Cypress Testing Library (#10582)
luixxiul Apr 16, 2023
7751f9c
#21451 Fix WebGL disabled error message (#10589)
rashmitpankhania Apr 17, 2023
9385881
Update stickers.spec.ts - use Cypress Testing Library (#10622)
luixxiul Apr 17, 2023
daad630
Conform more of the codebase to `strictNullChecks` (#10602)
t3chguy Apr 17, 2023
8a4a584
Make test ID compatible with findByTestId() of Cypress Testing Librar…
luixxiul Apr 17, 2023
9d8d610
Update `room.spec.ts` - use Cypress Testing Library (#10608)
luixxiul Apr 17, 2023
1d9df7e
Apply strictNullChecks to Markdown.ts (#10623)
timjamello Apr 17, 2023
8125649
Update `location.spec.ts` - use Cypress Testing Library (#10612)
luixxiul Apr 17, 2023
816a078
Update pollHistory.spec.ts - use Cypress Testing Library (#10611)
luixxiul Apr 17, 2023
56e4ae4
Conform more of the codebase to strictNullChecks (#10607)
t3chguy Apr 17, 2023
4c0efc5
Update Cypress test files under `support/` directory - use Cypress Te…
luixxiul Apr 17, 2023
8471e45
Update send_event.spec.ts - use Cypress Testing Library (#10613)
luixxiul Apr 17, 2023
4d859a3
Update right-panel.spec.ts - use Cypress Testing Library (#10539)
luixxiul Apr 17, 2023
dc4bb23
Replace hardcoded strings with MsgType constants (#10604)
kenwuuu Apr 17, 2023
013b720
Update room-directory.spec.ts - use Cypress Testing Library (#10596)
luixxiul Apr 17, 2023
9c277d6
Update file-panel.spec.ts - use Cypress Testing Library (#10574)
luixxiul Apr 17, 2023
568ec77
Make SonarCloud happier about our code quality (#10630)
t3chguy Apr 17, 2023
7114f82
Update spotlight.spec.ts - use Cypress Testing Library (#10621)
luixxiul Apr 17, 2023
a092a91
Update lazy-loading.spec.ts - use Cypress Testing Library (#10591)
luixxiul Apr 17, 2023
270a26d
Fix view source from edit history dialog always showing latest event …
t3chguy Apr 17, 2023
1a0e5c1
Fix multiple accessibility defects identified by AXE (#10606)
t3chguy Apr 17, 2023
d1461d3
Update polls.spec.ts - use Cypress Testing Library (#10609)
luixxiul Apr 17, 2023
6bf1815
Add missing rel noreferrer noopener attributes (#10629)
t3chguy Apr 17, 2023
2cf6782
Add custom notification setting
kenwuuu Mar 31, 2023
aa90786
Call NotificationSound with roomId
kenwuuu Apr 15, 2023
037be66
remove comment
kenwuuu Apr 16, 2023
1c64888
add aria-label
kenwuuu Apr 17, 2023
37f35d1
Merge remote-tracking branch 'origin/feature/custom_global_notificati…
kenwuuu Apr 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cypress/e2e/integration-manager/send_event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const INTEGRATION_MANAGER_HTML = `
`;

function openIntegrationManager() {
cy.get(".mx_RightPanel_roomSummaryButton").click();
cy.findByRole("tab", { name: "Room info" }).click();
cy.get(".mx_RoomSummaryCard_appsGroup").within(() => {
cy.contains("Add widgets, bridges & bots").click();
cy.findByRole("button", { name: "Add widgets, bridges & bots" }).click();
});
}

Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/lazy-loading/lazy-loading.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ describe("Lazy Loading", () => {
}

function openMemberlist(): void {
cy.get('.mx_HeaderButtons [aria-label="Room info"]').click();
cy.get(".mx_HeaderButtons").within(() => {
cy.findByRole("tab", { name: "Room info" }).click();
});

cy.get(".mx_RoomSummaryCard").within(() => {
cy.get(".mx_RoomSummaryCard_icon_people").click();
cy.findByRole("button", { name: /People \d/ }).click(); // \d represents the number of the room members
});
}

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/location/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe("Location sharing", () => {
let homeserver: HomeserverInstance;

const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
return cy.get(`[data-test-id="share-location-option-${shareType}"]`);
return cy.findByTestId(`share-location-option-${shareType}`);
};

const submitShareLocation = (): void => {
cy.get('[data-testid="location-picker-submit-button"]').click();
cy.findByRole("button", { name: "Share location" }).click();
};

beforeEach(() => {
Expand All @@ -53,7 +53,7 @@ describe("Location sharing", () => {
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Location"]').click();
cy.findByRole("menuitem", { name: "Location" }).click();
});

selectLocationShareTypeOption("Pin").click();
Expand All @@ -67,7 +67,7 @@ describe("Location sharing", () => {
// clicking location tile opens maximised map
cy.get(".mx_LocationViewDialog_wrapper").should("exist");

cy.get('[aria-label="Close dialog"]').click();
cy.closeDialog();

cy.get(".mx_Marker").should("exist");
});
Expand Down
30 changes: 17 additions & 13 deletions cypress/e2e/polls/pollHistory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ describe("Poll history", () => {
};

function openPollHistory(): void {
cy.get('.mx_HeaderButtons [aria-label="Room info"]').click();
cy.findByRole("tab", { name: "Room info" }).click();
cy.get(".mx_RoomSummaryCard").within(() => {
cy.contains("Poll history").click();
cy.findByRole("button", { name: "Poll history" }).click();
});
}

Expand Down Expand Up @@ -124,7 +124,7 @@ describe("Poll history", () => {
cy.inviteUser(roomId, bot.getUserId());
cy.visit("/#/room/" + roomId);
// wait until Bob joined
cy.contains(".mx_TextualEvent", "BotBob joined the room").should("exist");
cy.findByText("BotBob joined the room").should("exist");
});

// active poll
Expand Down Expand Up @@ -153,19 +153,23 @@ describe("Poll history", () => {
cy.get(".mx_Dialog").within(() => {
// active poll is in active polls list
// open poll detail
cy.contains(pollParams1.title).click();
cy.findByText(pollParams1.title).click();

// vote in the poll
cy.contains("Yes").click();
cy.get('[data-testid="totalVotes"]').should("have.text", "Based on 2 votes");
cy.findByText("Yes").click();
cy.findByTestId("totalVotes").within(() => {
cy.findByText("Based on 2 votes");
});

// navigate back to list
cy.contains("Active polls").click();
cy.get(".mx_PollHistory_header").within(() => {
cy.findByRole("button", { name: "Active polls" }).click();
});

// go to past polls list
cy.contains("Past polls").click();
cy.findByText("Past polls").click();

cy.contains(pollParams2.title).should("exist");
cy.findByText(pollParams2.title).should("exist");
});

// end poll1 while dialog is open
Expand All @@ -175,13 +179,13 @@ describe("Poll history", () => {

cy.get(".mx_Dialog").within(() => {
// both ended polls are in past polls list
cy.contains(pollParams2.title).should("exist");
cy.contains(pollParams1.title).should("exist");
cy.findByText(pollParams2.title).should("exist");
cy.findByText(pollParams1.title).should("exist");

cy.contains("Active polls").click();
cy.findByText("Active polls").click();

// no more active polls
cy.contains("There are no active polls in this room").should("exist");
cy.findByText("There are no active polls in this room").should("exist");
});
});
});
44 changes: 24 additions & 20 deletions cypress/e2e/polls/polls.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ describe("Polls", () => {
throw new Error("Poll must have at least two options");
}
cy.get(".mx_PollCreateDialog").within((pollCreateDialog) => {
cy.get("#poll-topic-input").type(title);
cy.findByRole("textbox", { name: "Question or topic" }).type(title);

options.forEach((option, index) => {
const optionId = `#pollcreate_option_${index}`;

// click 'add option' button if needed
if (pollCreateDialog.find(optionId).length === 0) {
cy.get(".mx_PollCreateDialog_addOption").scrollIntoView().click();
cy.findByRole("button", { name: "Add option" }).scrollIntoView().click();
}
cy.get(optionId).scrollIntoView().type(option);
});
});
cy.get('.mx_Dialog button[type="submit"]').click();
cy.get(".mx_Dialog").within(() => {
cy.findByRole("button", { name: "Create Poll" }).click();
});
};

const getPollTile = (pollId: string): Chainable<JQuery> => {
Expand All @@ -67,7 +69,7 @@ describe("Polls", () => {

const botVoteForOption = (bot: MatrixClient, roomId: string, pollId: string, optionText: string): void => {
getPollOption(pollId, optionText).within((ref) => {
cy.get('input[type="radio"]')
cy.findByRole("radio")
.invoke("attr", "value")
.then((optionId) => {
// We can't use the js-sdk types for this stuff directly, so manually construct the event.
Expand Down Expand Up @@ -111,11 +113,11 @@ describe("Polls", () => {
cy.inviteUser(roomId, bot.getUserId());
cy.visit("/#/room/" + roomId);
// wait until Bob joined
cy.contains(".mx_TextualEvent", "BotBob joined the room").should("exist");
cy.findByText("BotBob joined the room").should("exist");
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Poll"]').click();
cy.findByRole("menuitem", { name: "Poll" }).click();
});

// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24688
Expand All @@ -142,7 +144,9 @@ describe("Polls", () => {
botVoteForOption(bot, roomId, pollId, pollParams.options[2]);

// no votes shown until I vote, check bots vote has arrived
cy.get(".mx_MPollBody_totalVotes").should("contain", "1 vote cast");
cy.get(".mx_MPollBody_totalVotes").within(() => {
cy.findByText("1 vote cast. Vote to see the results");
});

// vote 'Maybe'
getPollOption(pollId, pollParams.options[2]).click("topLeft");
Expand Down Expand Up @@ -183,7 +187,7 @@ describe("Polls", () => {
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Poll"]').click();
cy.findByRole("menuitem", { name: "Poll" }).click();
});

const pollParams = {
Expand All @@ -203,9 +207,7 @@ describe("Polls", () => {
getPollTile(pollId).rightclick();

// Select edit item
cy.get(".mx_ContextualMenu").within(() => {
cy.get('[aria-label="Edit"]').click();
});
cy.findByRole("menuitem", { name: "Edit" }).click();

// Expect poll editing dialog
cy.get(".mx_PollCreateDialog");
Expand All @@ -226,7 +228,7 @@ describe("Polls", () => {
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Poll"]').click();
cy.findByRole("menuitem", { name: "Poll" }).click();
});

const pollParams = {
Expand All @@ -252,9 +254,7 @@ describe("Polls", () => {
getPollTile(pollId).rightclick();

// Select edit item
cy.get(".mx_ContextualMenu").within(() => {
cy.get('[aria-label="Edit"]').click();
});
cy.findByRole("menuitem", { name: "Edit" }).click();

// Expect error dialog
cy.get(".mx_ErrorDialog");
Expand All @@ -278,11 +278,11 @@ describe("Polls", () => {
cy.inviteUser(roomId, botCharlie.getUserId());
cy.visit("/#/room/" + roomId);
// wait until the bots joined
cy.contains(".mx_TextualEvent", "and one other were invited and joined").should("exist");
cy.findByText("BotBob and one other were invited and joined", { timeout: 10000 }).should("exist");
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Poll"]').click();
cy.findByRole("menuitem", { name: "Poll" }).click();
});

const pollParams = {
Expand All @@ -304,17 +304,21 @@ describe("Polls", () => {
});

// open the thread summary
cy.get(".mx_RoomView_body .mx_ThreadSummary").click();
cy.findByRole("button", { name: "Open thread" }).click();

// Bob votes 'Maybe' in the poll
botVoteForOption(botBob, roomId, pollId, pollParams.options[2]);
// Charlie votes 'No'
botVoteForOption(botCharlie, roomId, pollId, pollParams.options[1]);

// no votes shown until I vote, check votes have arrived in main tl
cy.get(".mx_RoomView_body .mx_MPollBody_totalVotes").should("contain", "2 votes cast");
cy.get(".mx_RoomView_body .mx_MPollBody_totalVotes").within(() => {
cy.findByText("2 votes cast. Vote to see the results").should("exist");
});
// and thread view
cy.get(".mx_ThreadView .mx_MPollBody_totalVotes").should("contain", "2 votes cast");
cy.get(".mx_ThreadView .mx_MPollBody_totalVotes").within(() => {
cy.findByText("2 votes cast. Vote to see the results").should("exist");
});

// Take snapshots of poll on ThreadView
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/regression-tests/pills-click-in-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ describe("Pills", () => {
cy.url().should("contain", `/#/room/${messageRoomId}`);

// send a message using the built-in room mention functionality (autocomplete)
cy.get(".mx_SendMessageComposer .mx_BasicMessageComposer_input").type(
cy.findByRole("textbox", { name: "Send a message…" }).type(
`Hello world! Join here: #${targetLocalpart.substring(0, 3)}`,
);
cy.get(".mx_Autocomplete_Completion_title").click();
cy.get(".mx_MessageComposer_sendMessage").click();
cy.findByRole("button", { name: "Send message" }).click();

// find the pill in the timeline and click it
cy.get(".mx_EventTile_body .mx_Pill").click();
Expand Down
27 changes: 14 additions & 13 deletions cypress/e2e/right-panel/file-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NAME = "Alice";

const viewRoomSummaryByName = (name: string): Chainable<JQuery<HTMLElement>> => {
cy.viewRoomByName(name);
cy.get(".mx_RightPanel_roomSummaryButton").click();
cy.findByRole("tab", { name: "Room info" }).click();
return checkRoomSummaryCard(name);
};

Expand All @@ -38,8 +38,7 @@ const uploadFile = (file: string) => {
cy.get(".mx_MessageComposer_actions input[type='file']").selectFile(file, { force: true });

cy.get(".mx_Dialog").within(() => {
// Click "Upload" button
cy.get("[data-testid='dialog-primary-button']").should("have.text", "Upload").click();
cy.findByRole("button", { name: "Upload" }).click();
});

// Wait until the file is sent
Expand Down Expand Up @@ -106,8 +105,7 @@ describe("FilePanel", () => {
cy.get(".mx_MFileBody_download").should("have.length", 3);

// Assert that the sender of the files is rendered on all of the tiles
cy.get(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName").should("have.length", 3);
cy.contains(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName", NAME);
cy.findAllByText(NAME).should("have.length", 3);

// Detect the image file
cy.get(".mx_EventTile_mediaLine.mx_EventTile_image").within(() => {
Expand All @@ -123,16 +121,17 @@ describe("FilePanel", () => {
// Assert that the audio player is rendered
cy.get(".mx_AudioPlayer_container").within(() => {
// Assert that the play button is rendered
cy.get("[data-testid='play-pause-button']").should("exist");
cy.findByRole("button", { name: "Play" }).should("exist");
});
});

// Detect the JSON file
// Assert that the tile is rendered as a button
cy.get(".mx_EventTile_mediaLine .mx_MFileBody .mx_MFileBody_info[role='button']").within(() => {
// Assert that the file name is rendered inside the button
// File name: matrix-org-client-versions.json
cy.contains(".mx_MFileBody_info_filename", "matrix-org");
// Assert that the file name is rendered inside the button with ellipsis
cy.get(".mx_MFileBody_info_filename").within(() => {
cy.findByText(/matrix.*?\.json/);
});
});
});
});
Expand Down Expand Up @@ -186,7 +185,9 @@ describe("FilePanel", () => {
cy.get(".mx_AudioPlayer_container").within(() => {
// Assert that the audio file information is rendered
cy.get(".mx_AudioPlayer_mediaInfo").within(() => {
cy.get(".mx_AudioPlayer_mediaName").should("have.text", "1sec.ogg");
cy.get(".mx_AudioPlayer_mediaName").within(() => {
cy.findByText("1sec.ogg");
});
cy.contains(".mx_AudioPlayer_byline", "00:01").should("exist");
cy.contains(".mx_AudioPlayer_byline", "(3.56 KB)").should("exist"); // actual size
});
Expand All @@ -195,16 +196,16 @@ describe("FilePanel", () => {
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");

// Click the play button
cy.get("[data-testid='play-pause-button'][aria-label='Play']").click();
cy.findByRole("button", { name: "Play" }).click();

// Assert that the pause button is rendered
cy.get("[data-testid='play-pause-button'][aria-label='Pause']").should("exist");
cy.findByRole("button", { name: "Pause" }).should("exist");

// Assert that the timer is reset when the audio file finished playing
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");

// Assert that the play button is rendered
cy.get("[data-testid='play-pause-button'][aria-label='Play']").should("exist");
cy.findByRole("button", { name: "Play" }).should("exist");
});
});
});
Expand Down
Loading