Skip to content

Commit

Permalink
add Cypress test for failing translation API fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate committed Jul 15, 2024
1 parent 1d3813d commit efc0b1b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions clients/privacy-center/cypress/e2e/consent-i18n.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable spaced-comment */
import {
ExperienceConfigTranslation,
FidesEndpointPaths,
FidesInitOptions,
PrivacyExperience,
PrivacyNotice,
Expand Down Expand Up @@ -1507,6 +1508,34 @@ describe("Consent i18n", () => {
testTcfModalLocalization(SPANISH_TCF_MODAL);
});
});
describe("when translations API fails", () => {
beforeEach(() => {
cy.intercept(
{
method: "GET",
url: `${API_URL}${FidesEndpointPaths.GVL_TRANSLATIONS}*`,
middleware: true,
},
(req) => {
req.on("before:response", (res) => {
res.send(500, { error: "Internal Server Error" });
});
}
).as("getGvlTranslations500");
});
it("falls back to default locale", () => {
visitDemoWithI18n({
navigatorLanguage: ENGLISH_LOCALE,
fixture: "experience_tcf.json",
options: { tcfEnabled: true },
});
cy.get("#fides-banner").should("be.visible");
cy.get(".fides-i18n-menu").should("not.exist");
cy.get(".fides-notice-toggle")
.first()
.contains(/^Selection of personalised(.*)/);
});
});
});

describe("when localizing privacy_center components", () => {
Expand Down

0 comments on commit efc0b1b

Please sign in to comment.