Skip to content

Commit a2f5c49

Browse files
Half-Shott3chguy
andauthored
Update settings toggles to use consistent design across app. (#30169)
* Use EditInPlace for identity server picker. * Update test * Add a test for setting an ID server. * fix tests * Reformat other :not sections * forgot a comma * Update Apperance settings to use toggle switches. * Remove unused checkbox setting. * Remove unused import. * Update tests * lint * update apperance screenshot * Begin replacing settings * Refactor RoomPublishSetting * Remove LabelledToggleSwitch * Refactor SettingsFlag to use SettingsToggleInput * Refactor CreateRoomDialog to use SettingsToggleInput * Refactor DeclineAndBlockInviteDialog to use SettingsToggleInput * Update DevtoolsDialog * Refactor ReportRoomDialog to use SettingsToggle * Update RoomUpgradeWarningDialog to use SettingsToggleInput * Update WidgetCapabilitiesPromptDialog to use SettingsToggleInput * Update trivial switchovers * Update Notifications settings to use SettingsFlag where possible * Update RoomPublishSetting and SpaceSettingVisibilityTab to use SettingsToggleInput with a warning * revert changes to field * Updated screenshots * Prevent accidental submits * Replace test ID tests * Create new snapshot tests * Add screenshot test for DeclineAndBlockDialog * Add screenshot for create room dialog. * Add devtools test * Add upgrade rooms test * Add widget capabilites prompt test * Fix spec * Add a test for the live location sharing prompt. * fix copyright * Add tests for notification settings * Add tests for user security tab. * Add test for room security tab. * Add test for video settings tab. * remove .only * Test creating a video room * Mask the IM name in the header. * Add spaces vis tab test. * Fixup unit tests to check correct attributes. * Various fixes to components for tests. * lint * Update compound * update setting names * Cleanup tests prettier Updates some more playwright tests Update more snapshots Update switch more fixes drop .only last screenshot round fix video room flake Remove console.logs Remove roomId from devtools view. lint final screenshot * Add playwright tests * import pages/ remove duplicate create-room * Update screenshots * Fix accessibility for devtools * Disable region test * Fixup headers * remove extra test * Fix permissions dialog * fixup tests * update snapshot * Update jest tests * Clear up playwright tests * update widget screenshot * Fix wrong snaps from using wrong compound version * Revert mistaken s/checkbox/switch/ * lint lint * Update headings * fix snap * remove unused * update snapshot * update tab screenshot * Update snapshots * Fix margins * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Delint Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Update snapshot Signed-off-by: Michael Telatynski <[email protected]> * Update snapshot Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]> Co-authored-by: Michael Telatynski <[email protected]>
1 parent f84e281 commit a2f5c49

File tree

93 files changed

+4936
-4171
lines changed

Some content is hidden

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

93 files changed

+4936
-4171
lines changed

playwright/e2e/left-panel/room-list-panel/room-list.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ test.describe("Room list", () => {
428428
await app.settings.closeDialog();
429429

430430
await app.settings.openUserSettings("Notifications");
431-
await page.getByText("Show all activity in the room list (dots or number of unread messages)").click();
431+
await page
432+
.getByRole("switch", { name: "Show all activity in the room list (dots or number of unread messages)" })
433+
.check();
432434
await app.settings.closeDialog();
433435

434436
// Switch to the other room to avoid the notification to be cleared

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ test.describe("Room Directory", () => {
3838
// Publish into the public rooms directory
3939
const publishedAddresses = page.locator(".mx_SettingsFieldset", { hasText: "Published Addresses" });
4040
await expect(publishedAddresses.locator("#canonicalAlias")).toHaveValue(`#gaming:${user.homeServer}`);
41-
const checkbox = publishedAddresses
42-
.locator(".mx_SettingsFlag", {
43-
hasText: `Publish this room to the public in ${user.homeServer}'s room directory?`,
44-
})
45-
.getByRole("switch");
46-
await checkbox.check();
41+
const checkbox = publishedAddresses.getByRole("switch", {
42+
name: `Publish this room to the public in ${user.homeServer}'s room directory?`,
43+
});
44+
// .click() rather than .check() as checking happens after publish
45+
await checkbox.click();
4746
await expect(checkbox).toBeChecked();
4847

4948
await app.closeDialog();

playwright/e2e/settings/appearance-user-settings-tab/appearance-user-settings-tab.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ test.describe("Appearance user settings tab", () => {
5050
// Click "Show advanced" link button
5151
await tab.getByRole("button", { name: "Show advanced" }).click();
5252

53-
await tab.getByLabel("Use bundled emoji font").click();
54-
await tab.getByLabel("Use a system font").click();
53+
await tab.getByRole("switch", { name: "Use bundled emoji font" }).click();
54+
await tab.getByRole("switch", { name: "Use a system font" }).click();
5555

5656
// Assert that the font-family value was removed
5757
await expect(page.locator("body")).toHaveCSS("font-family", '""');

playwright/e2e/settings/appearance-user-settings-tab/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Helpers {
8484
/**
8585
* Return the system theme toggle
8686
*/
87-
getMatchSystemThemeCheckbox() {
87+
getMatchSystemThemeSwitch() {
8888
return this.getThemePanel().getByRole("switch", { name: "Match system theme" });
8989
}
9090

@@ -216,9 +216,9 @@ class Helpers {
216216
}
217217

218218
/**
219-
* Return the compact layout checkbox
219+
* Return the compact layout switch
220220
*/
221-
getCompactLayoutCheckbox() {
221+
getCompactLayoutSwitch() {
222222
return this.getMessageLayoutPanel().getByRole("switch", { name: "Show compact text and messages" });
223223
}
224224

playwright/e2e/settings/appearance-user-settings-tab/message-layout-panel.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ test.describe("Appearance user settings tab", () => {
4040
);
4141

4242
test("should enable compact layout when the modern layout is selected", async ({ page, app, user, util }) => {
43-
await expect(util.getCompactLayoutCheckbox()).not.toBeChecked();
43+
await expect(util.getCompactLayoutSwitch()).not.toBeChecked();
4444

45-
await util.getCompactLayoutCheckbox().click();
45+
await util.getCompactLayoutSwitch().click();
4646
await util.assertCompactLayout();
4747
});
4848

@@ -52,11 +52,11 @@ test.describe("Appearance user settings tab", () => {
5252
user,
5353
util,
5454
}) => {
55-
await expect(util.getCompactLayoutCheckbox()).not.toBeDisabled();
55+
await expect(util.getCompactLayoutSwitch()).not.toBeDisabled();
5656

5757
// Select the bubble layout, which should disable the compact layout checkbox
5858
await util.getBubbleLayout().click();
59-
await expect(util.getCompactLayoutCheckbox()).toBeDisabled();
59+
await expect(util.getCompactLayoutSwitch()).toBeDisabled();
6060
});
6161
});
6262
});

playwright/e2e/settings/appearance-user-settings-tab/theme-choice-panel.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test.describe("Appearance user settings tab", () => {
2525
{ tag: "@screenshot" },
2626
async ({ page, app, util }) => {
2727
// Assert that 'Match system theme' is not checked
28-
await expect(util.getMatchSystemThemeCheckbox()).not.toBeChecked();
28+
await expect(util.getMatchSystemThemeSwitch()).not.toBeChecked();
2929

3030
// Assert that the light theme is selected
3131
await expect(util.getLightTheme()).toBeChecked();
@@ -41,7 +41,7 @@ test.describe("Appearance user settings tab", () => {
4141
"should disable the themes when the system theme is clicked",
4242
{ tag: "@screenshot" },
4343
async ({ page, app, util }) => {
44-
await util.getMatchSystemThemeCheckbox().click();
44+
await util.getMatchSystemThemeSwitch().click();
4545

4646
// Assert that the themes are disabled
4747
await expect(util.getLightTheme()).toBeDisabled();

playwright/e2e/sliding-sync/sliding-sync.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ test.describe("Sliding Sync", () => {
184184

185185
test("should update user settings promptly", async ({ page, app }) => {
186186
await app.settings.openUserSettings("Preferences");
187-
const locator = page.locator(".mx_SettingsFlag").filter({ hasText: "Show timestamps in 12 hour format" });
187+
const locator = page.getByRole("switch", { name: "Show timestamps in 12 hour format" });
188188
await expect(locator).toBeVisible();
189-
await expect(locator.locator(".mx_ToggleSwitch_on")).not.toBeAttached();
190-
await locator.locator(".mx_ToggleSwitch_ball").click();
191-
await expect(locator.locator(".mx_ToggleSwitch_on")).toBeAttached();
189+
await locator.check();
192190
});
193191

194192
test("should send subscribe_rooms on room switch if room not already subscribed", async ({ page, app }) => {
-1.43 KB
Loading
-1.78 KB
Loading
-978 Bytes
Loading

0 commit comments

Comments
 (0)