This commit is contained in:
Simon CATANESE 2024-05-12 18:51:25 +02:00
parent 2b65a6fef2
commit af562b7b10

View File

@ -1,70 +0,0 @@
import { test, expect } from '@playwright/test';
test("inscription avec nom d'utilisateur déjà existant", async ({ page }) => {
await page.goto('http://localhost:3001/register');
await page.fill('input[placeholder="username"]', 'utilisateur_existant');
await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_test');
await page.click('button[type="submit"]');
await page.waitForLoadState('networkidle');
const errorMessage = await page.textContent('.text-red-500');
expect(errorMessage).toContain("Ce nom d'utilisateur existe déjà");
});
test("inscription avec mots de passe non correspondants", async ({ page }) => {
await page.goto('http://localhost:3001/register');
await page.fill('input[placeholder="username"]', 'utilisateur_test');
await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_incorrect');
await page.click('button[type="submit"]');
await page.waitForLoadState('networkidle');
const errorMessage = await page.textContent('.text-red-500');
expect(errorMessage).toContain('Les mots de passe ne correspondent pas');
});
test("inscription sans nom d'utilisateur", async ({ page }) => {
await page.goto('http://localhost:3001/register');
await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_test');
await page.click('button[type="submit"]');
await page.waitForLoadState('networkidle');
const errorMessage = await page.textContent('.text-red-500');
expect(errorMessage).toContain("Veuillez fournir un nom d'utilisateur");
});
//describe("Register Component", () => {
// it("inscription avec nom d'utilisateur déjà existant", async ({ page }) => {
// await page.goto('http://localhost:3001/register');
// await page.fill('input[placeholder="username"]', 'utilisateur_existant');
// await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
// await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_test');
// await page.click('button[type="submit"]');
// await page.waitForLoadState('networkidle');
// const errorMessage = await page.textContent('.text-red-500');
// expect(errorMessage).toContain("Ce nom d'utilisateur existe déjà");
// });
// it("inscription avec mots de passe non correspondants", async ({ page }) => {
// await page.goto('http://localhost:3001/register');
// await page.fill('input[placeholder="username"]', 'utilisateur_test');
// await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
// await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_incorrect');
// await page.click('button[type="submit"]');
// await page.waitForLoadState('networkidle');
// const errorMessage = await page.textContent('.text-red-500');
// expect(errorMessage).toContain('Les mots de passe ne correspondent pas');
// });
// it("inscription sans nom d'utilisateur", async ({ page }) => {
// await page.goto('http://localhost:3001/register');
// await page.fill('input[placeholder="password"]', 'mot_de_passe_test');
// await page.fill('input[placeholder="confirmation"]', 'mot_de_passe_test');
// await page.click('button[type="submit"]');
// await page.waitForLoadState('networkidle');
// const errorMessage = await page.textContent('.text-red-500');
// expect(errorMessage).toContain("Veuillez fournir un nom d'utilisateur");
// });
//});