Enable Jest and Percy snapshots for PreferencesUserSettingsTab
(#10701)
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
parent
d1a1506572
commit
326e217d3f
4 changed files with 1102 additions and 1 deletions
45
cypress/e2e/settings/preferences-user-settings-tab.spec.ts
Normal file
45
cypress/e2e/settings/preferences-user-settings-tab.spec.ts
Normal 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");
|
||||
});
|
||||
});
|
|
@ -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">
|
||||
|
|
|
@ -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();
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue