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:
@@ -28,20 +28,16 @@ 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 });
|
||||
}
|
||||
|
||||
async function loginAsStudent(page: import('@playwright/test').Page, email: string) {
|
||||
await page.goto(`${ALPHA_URL}/login`);
|
||||
await page.locator('#email').fill(email);
|
||||
await page.locator('#password').fill(STUDENT_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
|
||||
@@ -233,14 +229,15 @@ test.describe('Competencies Mode (Story 6.5)', () => {
|
||||
await expect(page.locator('.level-cell').first()).toBeVisible({ timeout: 15000 });
|
||||
|
||||
const firstCell = page.locator('.level-cell').first();
|
||||
const levelBtn = firstCell.locator('.level-btn').nth(1);
|
||||
|
||||
// Click to set level
|
||||
await levelBtn.click();
|
||||
// Use keyboard to set level (more reliable than click for toggle)
|
||||
await firstCell.click();
|
||||
await firstCell.press('2');
|
||||
const levelBtn = firstCell.locator('.level-btn').nth(1);
|
||||
await expect(levelBtn).toHaveClass(/active/, { timeout: 15000 });
|
||||
|
||||
// Click same button immediately to toggle off (no wait for save)
|
||||
await levelBtn.click();
|
||||
// Use keyboard to toggle off by pressing same key
|
||||
await firstCell.press('2');
|
||||
await expect(levelBtn).not.toHaveClass(/active/, { timeout: 15000 });
|
||||
});
|
||||
});
|
||||
@@ -251,21 +248,21 @@ test.describe('Competencies Mode (Story 6.5)', () => {
|
||||
await page.goto(`${ALPHA_URL}/dashboard/teacher/evaluations/${evaluationId}/competencies`);
|
||||
await expect(page.locator('.level-cell').first()).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// Focus the first cell
|
||||
// Click the first cell to ensure focus (more reliable than focus() across browsers)
|
||||
const firstCell = page.locator('.level-cell').first();
|
||||
await firstCell.focus();
|
||||
await firstCell.click();
|
||||
|
||||
// Press '3' to set level 3 (Acquis)
|
||||
await firstCell.press('3');
|
||||
|
||||
// The third level button should become active
|
||||
await expect(firstCell.locator('.level-btn').nth(2)).toHaveClass(/active/, { timeout: 5000 });
|
||||
await expect(firstCell.locator('.level-btn').nth(2)).toHaveClass(/active/, { timeout: 10000 });
|
||||
|
||||
// Press '1' to set level 1 (Non acquis)
|
||||
await firstCell.press('1');
|
||||
|
||||
// The first level button should become active, third should not
|
||||
await expect(firstCell.locator('.level-btn').first()).toHaveClass(/active/, { timeout: 5000 });
|
||||
await expect(firstCell.locator('.level-btn').first()).toHaveClass(/active/, { timeout: 10000 });
|
||||
await expect(firstCell.locator('.level-btn').nth(2)).not.toHaveClass(/active/, { timeout: 5000 });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user