Recent updates in the backend views now requires the user agent to be redirected to the logout endpoint. The logout endpoint should initiate the logout flow with the OIDC provider, by redirecting the user to the OIDC provider domain. Thus, OIDC provider session cookie should be cleared. E2E tests should be improved later on, when the CI and the development env use Agent Connect integration environment. The current logout is not working with the Keycloack configuration.
85 lines
2.2 KiB
TypeScript
85 lines
2.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
import { keyCloakSignIn } from './common';
|
|
|
|
test.beforeEach(async ({ page, browserName }) => {
|
|
await page.goto('/');
|
|
await keyCloakSignIn(page, browserName);
|
|
});
|
|
|
|
test.describe('Header', () => {
|
|
test('checks all the elements are visible', async ({ page }) => {
|
|
const header = page.locator('header').first();
|
|
|
|
await expect(header.getByAltText('Marianne Logo')).toBeVisible();
|
|
|
|
await expect(
|
|
header.getByAltText('Freedom Equality Fraternity Logo'),
|
|
).toBeVisible();
|
|
|
|
await expect(header.getByAltText('Equipes Logo')).toBeVisible();
|
|
await expect(header.locator('h2').getByText('Equipes')).toHaveCSS(
|
|
'color',
|
|
'rgb(0, 0, 145)',
|
|
);
|
|
await expect(header.locator('h2').getByText('Equipes')).toHaveCSS(
|
|
'font-family',
|
|
/Marianne/i,
|
|
);
|
|
|
|
await expect(
|
|
header.getByRole('button', {
|
|
name: 'Les services de La Suite numérique',
|
|
}),
|
|
).toBeVisible();
|
|
|
|
await expect(header.getByAltText('Language Icon')).toBeVisible();
|
|
await expect(header.getByText('My account')).toBeVisible();
|
|
});
|
|
|
|
test('checks logout button', async ({ page }) => {
|
|
await page
|
|
.getByRole('button', {
|
|
name: 'My account',
|
|
})
|
|
.click();
|
|
|
|
await page
|
|
.getByRole('button', {
|
|
name: 'Logout',
|
|
})
|
|
.click();
|
|
|
|
await expect(page.getByRole('button', { name: 'Sign in' })).toBeVisible();
|
|
});
|
|
|
|
test('checks La Gauffre interaction', async ({ page }) => {
|
|
const header = page.locator('header').first();
|
|
|
|
await expect(
|
|
header.getByRole('button', {
|
|
name: 'Les services de La Suite numérique',
|
|
}),
|
|
).toBeVisible();
|
|
|
|
/**
|
|
* La gaufre load a js file from a remote server,
|
|
* it takes some time to load the file and have the interaction available
|
|
*/
|
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
|
await page.waitForTimeout(1500);
|
|
|
|
await header
|
|
.getByRole('button', {
|
|
name: 'Les services de La Suite numérique',
|
|
})
|
|
.click();
|
|
|
|
await expect(
|
|
page.getByRole('link', { name: 'France Transfert' }),
|
|
).toBeVisible();
|
|
|
|
await expect(page.getByRole('link', { name: 'Grist' })).toBeVisible();
|
|
});
|
|
});
|