Skip to content
Snippets Groups Projects
Unverified Commit 63ba56fd authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix flaky whitelabel test (#40441)

* Fix flaky whitelabel test

* Update another test for `landing-page`
parent bf43aa21
No related branches found
No related tags found
No related merge requests found
......@@ -327,7 +327,7 @@ describeEE("formatting > whitelabel", () => {
.clear()
.type("/test-1")
.blur();
cy.wait(["@putLandingPage", "@getSettings"]);
undoToast().findByText("Changes saved").should("be.visible");
cy.findByTestId("landing-page-error").should("not.exist");
cy.findByRole("navigation").findByText("Exit admin").click();
......@@ -340,7 +340,7 @@ describeEE("formatting > whitelabel", () => {
.clear()
.type("/test-2")
.blur();
cy.wait(["@putLandingPage", "@getSettings"]);
undoToast().findByText("Changes saved").should("be.visible");
// set to valid value then test invalid value is not persisted
cy.findByLabelText("Landing page custom destination")
......
......@@ -9,13 +9,10 @@ import { getRelativeLandingPageUrl } from "./utils";
interface Props {
settingValues: EnterpriseSettings;
onChangeSetting: (
key: "landing-page",
value: EnterpriseSettings["landing-page"],
) => Promise<void>;
onChange: (value: EnterpriseSettings["landing-page"]) => Promise<void>;
}
export function LandingPageWidget({ onChangeSetting, settingValues }: Props) {
export function LandingPageWidget({ onChange, settingValues }: Props) {
const [error, setError] = useState<string | null>(null);
const normalize = (value: string | number | null) => {
......@@ -33,7 +30,7 @@ export function LandingPageWidget({ onChangeSetting, settingValues }: Props) {
} else {
setError(null);
try {
await onChangeSetting("landing-page", relativeUrl);
await onChange(relativeUrl);
} catch (e: any) {
setError(e?.data?.message || t`Something went wrong`);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment