fix(client): show more descriptive error message on fetchUserError (#64061)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
leputz
2025-12-12 12:28:43 +02:00
committed by GitHub
parent 9f16487a20
commit 5c3dd55406
6 changed files with 31 additions and 7 deletions
+17 -4
View File
@@ -1,10 +1,6 @@
import { test, expect, type Page } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
test.beforeEach(async ({ page }) => {
await page.goto('/settings');
});
const checkFlashMessageVisibility = async (page: Page, translation: string) => {
const flashMessage = page.getByText(translation);
await expect(flashMessage).toBeVisible();
@@ -15,6 +11,8 @@ const checkFlashMessageVisibility = async (page: Page, translation: string) => {
test.describe('Flash Message component E2E test', () => {
test('Flash Message Visibility for Night Mode Toggle', async ({ page }) => {
await page.goto('/settings');
await page
.getByRole('button', { name: translations.buttons.menu, exact: true })
.click();
@@ -31,6 +29,8 @@ test.describe('Flash Message component E2E test', () => {
});
test('Flash Message Visibility for Sound Mode Toggle', async ({ page }) => {
await page.goto('/settings');
await page
.getByLabel(translations.settings.labels['sound-mode'])
.getByRole('button', { name: translations.buttons.on })
@@ -40,4 +40,17 @@ test.describe('Flash Message component E2E test', () => {
translations.flash['updated-sound']
);
});
test('should be visible when a network error occurs', async ({ page }) => {
await page.route(
'*/**/user/get-session-user',
async route => await route.fulfill({ status: 500 })
);
await page.goto('/');
await checkFlashMessageVisibility(
page,
translations.flash['user-fetch-error']
);
});
});