wait for webserver to respond with 2xx, fix failing first (flaky) test #239

Merged
philipp merged 1 commits from staging into main 2024-03-05 00:53:36 +01:00
3 changed files with 18 additions and 18 deletions

View File

@ -25,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://127.0.0.1:8000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

View File

@ -1,7 +1,7 @@
import { test, expect, Page } from "@playwright/test";
test("cox can create and delete trip", async ({ page }) => {
await page.goto("http://localhost:8000/auth");
await page.goto("/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox");
await page.getByPlaceholder("Name").press("Tab");
@ -17,7 +17,7 @@ test("cox can create and delete trip", async ({ page }) => {
await page.getByRole("button", { name: "Erstellen", exact: true }).click();
await expect(page.locator("body")).toContainText("18:00 Uhr (cox) Details");
await page.goto("http://localhost:8000/planned");
await page.goto("/planned");
await page.getByRole("link", { name: "Details" }).click();
await page.getByRole("link", { name: "Termin löschen" }).click();
await expect(page.locator("body")).toContainText("Erfolgreich gelöscht!");
@ -32,7 +32,7 @@ test.describe("cox can edit trips", () => {
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage();
await page.goto("http://localhost:8000/auth");
await page.goto("/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox");
await page.getByPlaceholder("Name").press("Tab");
@ -51,7 +51,7 @@ test.describe("cox can edit trips", () => {
});
test("edit remarks", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.goto("/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.locator("#sidebar #notes").click();
await sharedPage.locator("#sidebar #notes").fill("Meine Anmerkung");
@ -67,7 +67,7 @@ test.describe("cox can edit trips", () => {
});
test("add and remove guest", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.goto("/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.locator("#sidebar #user_note").click();
await sharedPage.locator("#sidebar #user_note").fill("Mein Gast");
@ -107,7 +107,7 @@ test.describe("cox can edit trips", () => {
});
test("change amount rower", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.goto("/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 5",
@ -121,7 +121,7 @@ test.describe("cox can edit trips", () => {
});
test("call off trip", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.goto("/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 3",
@ -136,7 +136,7 @@ test.describe("cox can edit trips", () => {
});
test.afterAll(async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.goto("/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.getByRole("link", { name: "Termin löschen" }).click();
await sharedPage.close();

View File

@ -1,14 +1,14 @@
import { test, expect } from "@playwright/test";
test("Cox can start and cancel trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/auth");
await page.goto("/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox2");
await page.getByPlaceholder("Name").press("Tab");
await page.getByPlaceholder("Passwort").fill("cox");
await page.getByPlaceholder("Passwort").press("Enter");
await page.goto("http://localhost:8000/");
await page.goto("/");
await page.getByRole("link", { name: "Ausfahrt eintragen" }).click();
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
@ -41,14 +41,14 @@ test("Cox can start and cancel trip", async ({ page }, testInfo) => {
});
test("Cox can start and finish trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/auth");
await page.goto("/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox2");
await page.getByPlaceholder("Name").press("Tab");
await page.getByPlaceholder("Passwort").fill("cox");
await page.getByPlaceholder("Passwort").press("Enter");
await page.goto("http://localhost:8000/");
await page.goto("/");
await page.getByRole("link", { name: "Ausfahrt eintragen" }).click();
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
@ -73,7 +73,7 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
);
await expect(page.locator("body")).toContainText("Joe");
await page.goto("http://localhost:8000/log");
await page.goto("/log");
await page.locator("div:nth-child(2) > .border-0").click();
// Add a minute
await page.locator('#arrivaljs').click();
@ -91,7 +91,7 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
"Ausfahrt korrekt eingetragen",
);
await page.goto('http://localhost:8000/log/show');
await page.goto('/log/show');
await expect(page.locator('body')).toContainText('Joe');
await expect(page.locator('body')).toContainText('(cox2)');
await expect(page.locator('body')).toContainText('Ottensheim (25 km)');
@ -99,7 +99,7 @@ test("Cox can start and finish trip", async ({ page }, testInfo) => {
});
test("Kiosk can start and cancel trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/log/kiosk/ekrv2019/Linz");
await page.goto("/log/kiosk/ekrv2019/Linz");
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
await page.getByText("Kaputtes Boot :-( (7 x)").nth(1).click();
@ -131,7 +131,7 @@ test("Kiosk can start and cancel trip", async ({ page }, testInfo) => {
});
test("Kiosk can start and finish trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/log/kiosk/ekrv2019/Linz");
await page.goto("/log/kiosk/ekrv2019/Linz");
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
@ -156,7 +156,7 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => {
);
await expect(page.locator("body")).toContainText("Joe");
await page.goto("http://localhost:8000/log");
await page.goto("/log");
await page.locator('div:nth-child(2) > .pt-2 > div > div > div:nth-child(2) > .border-0').click(); // 2 trips currently running, try to close second one
// Add a minute