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:
@@ -14,10 +14,8 @@ async function loginAsTeacher(page: import('@playwright/test').Page) {
|
||||
await page.goto(`${ALPHA_URL}/login`);
|
||||
await page.locator('#email').fill(TEACHER_EMAIL);
|
||||
await page.locator('#password').fill(TEACHER_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 });
|
||||
}
|
||||
|
||||
// Deterministic IDs for test data
|
||||
@@ -171,7 +169,7 @@ test.describe('Grade Input Grid (Story 6.2)', () => {
|
||||
await firstInput.fill('25');
|
||||
|
||||
// Should show error
|
||||
await expect(page.locator('.input-error-msg').first()).toBeVisible({ timeout: 5000 });
|
||||
await expect(page.locator('.input-error-msg').first()).toBeVisible({ timeout: 15000 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -253,15 +251,15 @@ test.describe('Grade Input Grid (Story 6.2)', () => {
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.grade-input').first()).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// Start listening for the PUT response BEFORE triggering the save
|
||||
// Enter grades
|
||||
const firstInput = page.locator('.grade-input').first();
|
||||
await expect(firstInput).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// Setup response listener right before triggering the change
|
||||
const savePromise = page.waitForResponse(
|
||||
(resp) => resp.url().includes('/grades') && resp.request().method() === 'PUT',
|
||||
{ timeout: 30000 }
|
||||
);
|
||||
|
||||
// Enter grades
|
||||
const firstInput = page.locator('.grade-input').first();
|
||||
await expect(firstInput).toBeVisible({ timeout: 5000 });
|
||||
await firstInput.fill('18');
|
||||
await expect(page.locator('.status-graded').first()).toContainText('18/20', { timeout: 10000 });
|
||||
|
||||
@@ -299,15 +297,15 @@ test.describe('Grade Input Grid (Story 6.2)', () => {
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('.grade-input').first()).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// Start listening for PUT before triggering
|
||||
// Enter a grade and wait for save
|
||||
const firstInput = page.locator('.grade-input').first();
|
||||
await expect(firstInput).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// Setup response listener right before triggering the change
|
||||
const savePromise = page.waitForResponse(
|
||||
(resp) => resp.url().includes('/grades') && resp.request().method() === 'PUT',
|
||||
{ timeout: 30000 }
|
||||
);
|
||||
|
||||
// Enter a grade
|
||||
const firstInput = page.locator('.grade-input').first();
|
||||
await expect(firstInput).toBeVisible({ timeout: 5000 });
|
||||
await firstInput.fill('14');
|
||||
await expect(page.locator('.status-graded').first()).toContainText('14/20', { timeout: 10000 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user