✅(frontend) fix end-to-end tests after refacto
Some test were broken other were flaky: fix them. All tests are not worthy but since it was easy to fix, we keep them until we write better tests...
This commit is contained in:
@@ -13,10 +13,13 @@ test.describe('When a commune, domain is created on first login via ProConnect',
|
||||
}) => {
|
||||
const menu = page.locator('menu').first();
|
||||
|
||||
await menu.getByLabel(`Mail Domains button`).click();
|
||||
await expect(page).toHaveURL(/mail-domains\//);
|
||||
await menu.getByRole('button', { name: 'Mail Domains button' }).click();
|
||||
await page.waitForURL('http://localhost:3000/mail-domains/**');
|
||||
await expect(
|
||||
page.getByLabel('Areas of the organization', { exact: true }),
|
||||
page.getByRole('heading', {
|
||||
name: 'Areas of the organization',
|
||||
exact: true,
|
||||
}),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText('merlaut.test.collectivite.fr')).toHaveCount(1);
|
||||
await expect(page.getByText('No domains exist.')).toHaveCount(0);
|
||||
|
||||
@@ -45,23 +45,32 @@ test.describe('Keyboard navigation', () => {
|
||||
await page.goto('/');
|
||||
await keyCloakSignIn(page, browserName, 'team-owner-mail-member');
|
||||
|
||||
await page.waitForURL('http://localhost:3000/teams/');
|
||||
|
||||
const header = page.locator('header');
|
||||
|
||||
// necessary to begin the keyboard navigation directly from first button on the app and only select its elements
|
||||
await header.click();
|
||||
|
||||
// ensure ignoring elements (like tanstack query button) that are not part of the app
|
||||
const focusableElements = await page
|
||||
.locator(
|
||||
'.c__app a:not([tabindex="-1"]), .c__app button:not([tabindex="-1"]), ' +
|
||||
'.c__app [tabindex]:not([tabindex="-1"])',
|
||||
[
|
||||
'.c__app a:not([tabindex="-1"]):visible',
|
||||
'.c__app button:not([tabindex="-1"]):visible',
|
||||
'.c__app input:not([disabled]):not([tabindex="-1"]):visible',
|
||||
'.c__app select:not([disabled]):not([tabindex="-1"]):visible',
|
||||
'.c__app textarea:not([disabled]):not([tabindex="-1"]):visible',
|
||||
'.c__app [tabindex]:not([tabindex="-1"]):visible',
|
||||
].join(', '),
|
||||
)
|
||||
.all();
|
||||
|
||||
// expect(focusableElements.length).toEqual(18);
|
||||
expect(focusableElements.length).toEqual(19);
|
||||
|
||||
for (let i = 0; i < focusableElements.length; i++) {
|
||||
await page.keyboard.press('Tab');
|
||||
// wait for the element to be visible (page scrolls)
|
||||
await focusableElements[i].scrollIntoViewIfNeeded();
|
||||
await expect(focusableElements[i]).toBeFocused();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,9 +4,7 @@ test.describe('Login to people as Identity Provider', () => {
|
||||
test('checks a user with mailbox can login via people', async ({ page }) => {
|
||||
// go to people index page, wait for the redirection to keycloak
|
||||
await page.goto('/');
|
||||
await page.locator('h2').first().textContent({
|
||||
timeout: 5000,
|
||||
});
|
||||
await page.waitForURL('http://localhost:8083/**');
|
||||
|
||||
// keycloak - click on the login button
|
||||
await page.click('a[id=social-oidc-people-local]');
|
||||
|
||||
Reference in New Issue
Block a user