Enable Jest and Percy snapshots for PreferencesUserSettingsTab (#10701)

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara 2023-04-27 18:11:48 +00:00 committed by GitHub
parent d1a1506572
commit 326e217d3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1102 additions and 1 deletions

View file

@ -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");
});
});

View file

@ -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">

View file

@ -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();