Uploaded image for project: 'Red Hat Developer Hub Bugs'
  1. Red Hat Developer Hub Bugs
  2. RHDHBUGS-2162

[E2E] Settings page language switch test fails due to race condition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 1.9.0
    • UI
    • False
    • Hide

      None

      Show
      None
    • False

      Problem

      The test "Settings page >> Verify settings page" fails when verifying French translations after switching the language to Français. The test times out waiting for "Profil" (French for "Profile") to appear, but the page still displays "Profile" (English).

      Test Location: e2e/settings.spec.ts:27:3

      Error: TimeoutError: locator.waitFor: Timeout 10000ms exceeded.

      The test fails at line 66 when trying to verify the French translation of "profileCard.title":

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      await uiHelper.verifyText(fr["user-settings"][langfr]["profileCard.title"]);
      

      Expected: "Profil" (French)
      Actual: "Profile" (English - shown in page snapshot)

      Root Cause

      Race condition: The test switches to French language (line 58) and immediately starts verifying French translations (line 66) without waiting for the page to re-render with the new language. The language change requires time for:
      1. The UI to update
      2. Components to re-render with new translations
      3. Text content to be replaced

      Proposed Fix

      Add a wait condition after the language selection to ensure the page has updated with French translations before verifying:

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      await page.getByRole("option", { name: "Français" }).click();
      await expect(page.getByTestId("select").locator("div")).toContainText(
        "Français",
      );
      
      // Add wait for language change to take effect
      await expect(page.getByText("Profil", { exact: true })).toBeVisible({ 
        timeout: 15000 
      });
      
      const fr = getLocale("fr");
      const langfr = "fr";
      
      await uiHelper.verifyText(fr["user-settings"][langfr]["profileCard.title"]);
      

      Alternatively, wait for any reliable French text that should appear after the language change, or add a page.waitForLoadState('networkidle') after the language selection.

      Additional Context

      Assisted-by: Cursor

              rhn-support-ssaikia Sanket Saikia
              zdrapela@redhat.com Zbynek Drapela
              RHIDP - Frontend Plugins & UI
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: