(e2e) check lang attribute on html tag updates

Asserts that lang attribute of html tag updates according to
language chosen by user.
This commit is contained in:
daproclaima
2024-07-01 19:20:55 +02:00
committed by Sebastien Nobour
parent dfb5394310
commit d3589dfca1

View File

@@ -26,4 +26,20 @@ test.describe('Language', () => {
}),
).toBeVisible();
});
// test('checks lang attribute of html tag has same default value as defined');
test('checks lang attribute of html tag updates when user changes language', async ({
page,
}) => {
const header = page.locator('header').first();
await header.getByRole('combobox').getByText('EN').click();
const html = page.locator('html');
await expect(html).toHaveAttribute('lang', 'en');
await header.getByRole('option', { name: 'FR' }).click();
await expect(html).toHaveAttribute('lang', 'fr');
});
});