Skip to content

Commit

Permalink
Fix flaky language switch test & refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Dec 3, 2024
1 parent 6d6c25b commit adad4a7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions spec/cypress/e2e/profile_spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ describe("Account settings", () => {

it("allows switching the language", function () {
function checkLanguage(locale, shouldContain, shouldNotContain) {
// click on other locale checkbox first to trigger a change
cy.getBySelector(`locale-${locale === "de" ? "en" : "de"}-checkbox`).click();
cy.getBySelector(`locale-${locale}-checkbox`).click();
cy.getBySelector("profile-change-submit").click();
cy.visit(PROFILE_PAGE);
Expand All @@ -106,17 +108,14 @@ describe("Account settings", () => {
cy.visit(PROFILE_PAGE);

// just some very basic checks if language is switched correctly
checkLanguage("en",
["Display name", "receive", "want to"],
["Anzeigename", "benachrichtigt", "möchte"]);

checkLanguage("de",
["Anzeigename", "benachrichtigt", "möchte"],
["Display name", "receive", "want to"]);
const wordsGerman = ["Anzeigename", "benachrichtigt", "möchte"];
const wordsEnglish = ["Display name", "receive", "want to"];
checkLanguage("de", wordsGerman, wordsEnglish);
checkLanguage("en", wordsEnglish, wordsGerman);
});
});

describe.only("Module settings", () => {
describe("Module settings", () => {
beforeEach(function () {
cy.createUserAndLogin("generic").as("user");

Expand Down

0 comments on commit adad4a7

Please sign in to comment.