Files
2024_DEV_BUT3/tests/authenticated/login.test.js

33 lines
809 B
JavaScript
Raw Normal View History

2024-04-01 12:55:40 +02:00
// @ts-check
import { test, expect } from "@playwright/test";
test("Test de connexion", async ({ page }) => {
2024-04-03 03:46:05 +02:00
const account = "Bilouuuuuuu94!@@";
2024-04-01 12:55:40 +02:00
await page.goto("/login");
2024-04-03 03:46:05 +02:00
await page.waitForURL("/login");
2024-04-01 12:55:40 +02:00
await page
.locator(
"#layout-container > main > div > form > input[type=text]:nth-child(1)",
)
2024-04-03 03:46:05 +02:00
.fill(account);
2024-04-01 12:55:40 +02:00
await page
.locator(
"#layout-container > main > div > form > input[type=password]:nth-child(2)",
)
2024-04-03 03:46:05 +02:00
.fill(account);
2024-04-01 12:55:40 +02:00
await page.locator("#layout-container > main > div > form > button").click({
button: "left",
});
await page.waitForURL("/");
2024-04-03 03:46:05 +02:00
expect(await page.title()).toBe("Accueil");
expect(await page.locator("#title").innerText()).toBe(`Bonjour ${account} !`);
test.setTimeout(10000);
await page.waitForURL("/");
2024-04-01 12:55:40 +02:00
});