feat: Provisionner automatiquement un nouvel établissement
Lorsqu'un super-admin crée un établissement via l'interface, le système doit automatiquement créer la base tenant, exécuter les migrations, créer le premier utilisateur admin et envoyer l'invitation — le tout de manière asynchrone pour ne pas bloquer la réponse HTTP. Ce mécanisme rend chaque établissement opérationnel dès sa création sans intervention manuelle sur l'infrastructure.
This commit is contained in:
@@ -48,10 +48,8 @@ async function login(page: import('@playwright/test').Page, email: string) {
|
||||
await page.goto(getTenantUrl('/login'));
|
||||
await page.locator('#email').fill(email);
|
||||
await page.locator('#password').fill(TEST_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForURL(/\/dashboard/, { timeout: 60000 }),
|
||||
page.getByRole('button', { name: /se connecter/i }).click()
|
||||
]);
|
||||
await page.getByRole('button', { name: /se connecter/i }).click();
|
||||
await page.waitForURL(/\/dashboard/, { timeout: 60000 });
|
||||
}
|
||||
|
||||
test.describe('Sessions Management', () => {
|
||||
@@ -264,14 +262,15 @@ test.describe('Sessions Management', () => {
|
||||
|
||||
await login(page, email);
|
||||
await page.goto(getTenantUrl('/settings'));
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Click logout button
|
||||
const logoutButton = page.getByRole('button', { name: /d[eé]connexion/i });
|
||||
await expect(logoutButton).toBeVisible();
|
||||
await logoutButton.click();
|
||||
|
||||
// Wait for redirect to login
|
||||
await expect(page).toHaveURL(/login/, { timeout: 10000 });
|
||||
await Promise.all([
|
||||
page.waitForURL(/login/, { timeout: 30000 }),
|
||||
logoutButton.click()
|
||||
]);
|
||||
});
|
||||
|
||||
test('logout clears authentication', async ({ page, browserName }, testInfo) => {
|
||||
@@ -288,8 +287,8 @@ test.describe('Sessions Management', () => {
|
||||
await expect(logoutButton).toBeVisible();
|
||||
await logoutButton.click();
|
||||
|
||||
// Wait for redirect to login
|
||||
await expect(page).toHaveURL(/login/, { timeout: 10000 });
|
||||
// Wait for redirect to login (Firefox can be slow to redirect)
|
||||
await expect(page).toHaveURL(/login/, { timeout: 20000 });
|
||||
|
||||
// Try to access protected page
|
||||
await page.goto(getTenantUrl('/settings/sessions'));
|
||||
|
||||
Reference in New Issue
Block a user