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:
@@ -56,10 +56,8 @@ test.describe('Settings Page [P1]', () => {
|
||||
await page.goto(getTenantUrl('/login'));
|
||||
await page.locator('#email').fill(email);
|
||||
await page.locator('#password').fill(USER_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForURL(getTenantUrl('/dashboard'), { timeout: 30000 }),
|
||||
page.getByRole('button', { name: /se connecter/i }).click()
|
||||
]);
|
||||
await page.getByRole('button', { name: /se connecter/i }).click();
|
||||
await page.waitForURL(/\/dashboard/, { timeout: 30000 });
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -153,10 +151,11 @@ test.describe('Settings Page [P1]', () => {
|
||||
await login(page, email);
|
||||
|
||||
await page.goto(getTenantUrl('/settings'));
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await expect(
|
||||
page.getByRole('link', { name: /tableau de bord/i })
|
||||
).toBeVisible();
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('[P1] settings layout shows Parametres navigation link as active', async ({ page }, testInfo) => {
|
||||
@@ -176,19 +175,22 @@ test.describe('Settings Page [P1]', () => {
|
||||
test('[P1] logout button on settings layout logs user out', async ({ page, browserName }, testInfo) => {
|
||||
// Skip on webkit due to navigation timing issues with SvelteKit
|
||||
test.skip(browserName === 'webkit', 'Webkit has navigation timing issues with SvelteKit');
|
||||
test.setTimeout(90000);
|
||||
|
||||
const email = getTestEmail(testInfo.project.name);
|
||||
await login(page, email);
|
||||
|
||||
await page.goto(getTenantUrl('/settings'));
|
||||
await expect(page.getByRole('heading', { name: /paramètres/i })).toBeVisible({ timeout: 10000 });
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Click logout button
|
||||
// Click logout button and wait for the API call + redirect
|
||||
const logoutButton = page.getByRole('button', { name: /d[eé]connexion/i });
|
||||
await expect(logoutButton).toBeVisible();
|
||||
await logoutButton.click();
|
||||
|
||||
// Should redirect to login
|
||||
await expect(page).toHaveURL(/\/login/, { timeout: 10000 });
|
||||
// Should redirect to login — logout involves an API call before navigation
|
||||
await expect(page).toHaveURL(/\/login/, { timeout: 60000 });
|
||||
});
|
||||
|
||||
// ============================================================================
|
||||
@@ -202,8 +204,9 @@ test.describe('Settings Page [P1]', () => {
|
||||
await login(page, email);
|
||||
|
||||
await page.goto(getTenantUrl('/settings'));
|
||||
await expect(page.getByRole('heading', { name: /paramètres/i })).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Click the logo button
|
||||
// Click the logo button and wait for navigation
|
||||
await page.locator('.logo-button').click();
|
||||
|
||||
await expect(page).toHaveURL(/\/dashboard/, { timeout: 30000 });
|
||||
|
||||
Reference in New Issue
Block a user