Skip to content

Commit

Permalink
Enable Jest and Percy snapshots for PreferencesUserSettingsTab (#10701
Browse files Browse the repository at this point in the history
)

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
  • Loading branch information
luixxiul committed Apr 27, 2023
1 parent d1a1506 commit 326e217
Show file tree
Hide file tree
Showing 4 changed files with 1,102 additions and 1 deletion.
45 changes: 45 additions & 0 deletions cypress/e2e/settings/preferences-user-settings-tab.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Copyright 2023 Suguru Hirahara
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

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

import { HomeserverInstance } from "../../plugins/utils/homeserver";

describe("Preferences user settings tab", () => {
let homeserver: HomeserverInstance;

beforeEach(() => {
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Bob");
});
});

afterEach(() => {
cy.stopHomeserver(homeserver);
});

it("should be rendered properly", () => {
cy.openUserSettings("Preferences");

cy.get(".mx_SettingsTab.mx_PreferencesUserSettingsTab").within(() => {
// Assert that the top heading is rendered
cy.findByTestId("preferences").should("have.text", "Preferences").should("be.visible");
});

cy.get(".mx_SettingsTab.mx_PreferencesUserSettingsTab").percySnapshotElement("User settings tab - Preferences");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,

return (
<div className="mx_SettingsTab mx_PreferencesUserSettingsTab">
<div className="mx_SettingsTab_heading">{_t("Preferences")}</div>
<div className="mx_SettingsTab_heading" data-testid="preferences">
{_t("Preferences")}
</div>

{roomListSettings.length > 0 && (
<div className="mx_SettingsTab_section">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ describe("PreferencesUserSettingsTab", () => {
return render(<PreferencesUserSettingsTab closeSettingsFn={() => {}} />);
};

it("should render", () => {
const { asFragment } = renderTab();
expect(asFragment()).toMatchSnapshot();
});

describe("send read receipts", () => {
beforeEach(() => {
stubClient();
Expand Down
Loading

0 comments on commit 326e217

Please sign in to comment.