reformat files

This commit is contained in:
2024-03-04 13:28:42 +01:00
parent e338c78d04
commit 442257df01
39 changed files with 2570 additions and 2345 deletions

View File

@ -1,114 +1,144 @@
import { test, expect, Page } from '@playwright/test';
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.getByPlaceholder('Name').click();
await page.getByPlaceholder('Name').fill('cox');
await page.getByPlaceholder('Name').press('Tab');
await page.getByPlaceholder('Passwort').fill('cox');
await page.getByPlaceholder('Passwort').press('Enter');
await page.getByRole('link', { name: 'Geplante Ausfahrten' }).click();
await page.locator('.relative').first().click();
await page.locator('#sidebar #planned_starting_time').click();
await page.locator('#sidebar #planned_starting_time').fill('18:00');
await page.locator('#sidebar #planned_starting_time').press('Tab');
await page.locator('#sidebar #planned_starting_time').press('Tab');
await page.getByRole('spinbutton').fill('5');
await page.getByRole('button', { name: 'Erstellen', exact: true }).click();
await expect(page.locator('body')).toContainText('18:00 Uhr (cox) Details');
test("cox can create and delete trip", async ({ page }) => {
await page.goto("http://localhost:8000/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox");
await page.getByPlaceholder("Name").press("Tab");
await page.getByPlaceholder("Passwort").fill("cox");
await page.getByPlaceholder("Passwort").press("Enter");
await page.getByRole("link", { name: "Geplante Ausfahrten" }).click();
await page.locator(".relative").first().click();
await page.locator("#sidebar #planned_starting_time").click();
await page.locator("#sidebar #planned_starting_time").fill("18:00");
await page.locator("#sidebar #planned_starting_time").press("Tab");
await page.locator("#sidebar #planned_starting_time").press("Tab");
await page.getByRole("spinbutton").fill("5");
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.getByRole('link', { name: 'Details' }).click();
await page.getByRole('link', { name: 'Termin löschen' }).click();
await expect(page.locator('body')).toContainText('Erfolgreich gelöscht!');
await page.goto("http://localhost:8000/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!");
});
// TODO: group -> cox can create trips
// TODO: cox can help/register at trips/events
test.describe('cox can edit trips', () => {
test.describe("cox can edit trips", () => {
let sharedPage: Page;
test.beforeEach(async ({ browser }) => {
const page = await browser.newPage();
await page.goto('http://localhost:8000/auth');
await page.getByPlaceholder('Name').click();
await page.getByPlaceholder('Name').fill('cox');
await page.getByPlaceholder('Name').press('Tab');
await page.getByPlaceholder('Passwort').fill('cox');
await page.getByPlaceholder('Passwort').press('Enter');
await page.getByRole('link', { name: 'Geplante Ausfahrten' }).click();
await page.locator('.relative').first().click();
await page.locator('#sidebar #planned_starting_time').click();
await page.locator('#sidebar #planned_starting_time').fill('18:00');
await page.locator('#sidebar #planned_starting_time').press('Tab');
await page.locator('#sidebar #planned_starting_time').press('Tab');
await page.getByRole('spinbutton').fill('5');
await page.getByRole('button', { name: 'Erstellen', exact: true }).click();
await page.goto("http://localhost:8000/auth");
await page.getByPlaceholder("Name").click();
await page.getByPlaceholder("Name").fill("cox");
await page.getByPlaceholder("Name").press("Tab");
await page.getByPlaceholder("Passwort").fill("cox");
await page.getByPlaceholder("Passwort").press("Enter");
await page.getByRole("link", { name: "Geplante Ausfahrten" }).click();
await page.locator(".relative").first().click();
await page.locator("#sidebar #planned_starting_time").click();
await page.locator("#sidebar #planned_starting_time").fill("18:00");
await page.locator("#sidebar #planned_starting_time").press("Tab");
await page.locator("#sidebar #planned_starting_time").press("Tab");
await page.getByRole("spinbutton").fill("5");
await page.getByRole("button", { name: "Erstellen", exact: true }).click();
sharedPage = page;
});
test('edit remarks', async () => {
await sharedPage.goto('http://localhost:8000/planned');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await sharedPage.locator('#sidebar #notes').click();
await sharedPage.locator('#sidebar #notes').fill('Meine Anmerkung');
await sharedPage.getByRole('button', { name: 'Speichern' }).click();
await sharedPage.getByRole('link', { name: 'Details' }).click();
await expect(sharedPage.locator('#sidebar')).toContainText('Meine Anmerkung');
test("edit remarks", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.locator("#sidebar #notes").click();
await sharedPage.locator("#sidebar #notes").fill("Meine Anmerkung");
await sharedPage.getByRole("button", { name: "Speichern" }).click();
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Meine Anmerkung",
);
await sharedPage.getByRole('button', { name: 'Ausfahrt erstellen schließen' }).click();
await sharedPage
.getByRole("button", { name: "Ausfahrt erstellen schließen" })
.click();
});
test('add and remove guest', async () => {
await sharedPage.goto('http://localhost:8000/planned');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await sharedPage.locator('#sidebar #user_note').click();
await sharedPage.locator('#sidebar #user_note').fill('Mein Gast');
await sharedPage.getByRole('button', { name: 'Gast hinzufügen' }).click();
await expect(sharedPage.locator('body')).toContainText('Erfolgreich angemeldet!');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await expect(sharedPage.locator('#sidebar')).toContainText('Freie Plätze: 4');
await expect(sharedPage.locator('#sidebar')).toContainText('Mein Gast (Gast) Abmelden');
await expect(sharedPage.getByRole('link', { name: 'Termin löschen' })).not.toBeVisible();
test("add and remove guest", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.locator("#sidebar #user_note").click();
await sharedPage.locator("#sidebar #user_note").fill("Mein Gast");
await sharedPage.getByRole("button", { name: "Gast hinzufügen" }).click();
await expect(sharedPage.locator("body")).toContainText(
"Erfolgreich angemeldet!",
);
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 4",
);
await expect(sharedPage.locator("#sidebar")).toContainText(
"Mein Gast (Gast) Abmelden",
);
await expect(
sharedPage.getByRole("link", { name: "Termin löschen" }),
).not.toBeVisible();
await sharedPage.getByRole('link', { name: 'Abmelden' }).click();
await expect(sharedPage.locator('body')).toContainText('Erfolgreich abgemeldet!');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await expect(sharedPage.locator('#sidebar')).toContainText('Freie Plätze: 5');
await expect(sharedPage.locator('#sidebar')).toContainText('Keine Ruderer angemeldet');
await expect(sharedPage.getByRole('link', { name: 'Termin löschen' })).toBeVisible();
await sharedPage.getByRole("link", { name: "Abmelden" }).click();
await expect(sharedPage.locator("body")).toContainText(
"Erfolgreich abgemeldet!",
);
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 5",
);
await expect(sharedPage.locator("#sidebar")).toContainText(
"Keine Ruderer angemeldet",
);
await expect(
sharedPage.getByRole("link", { name: "Termin löschen" }),
).toBeVisible();
await sharedPage.getByRole('button', { name: 'Ausfahrt erstellen schließen' }).click();
await sharedPage
.getByRole("button", { name: "Ausfahrt erstellen schließen" })
.click();
});
test('change amount rower', async () => {
await sharedPage.goto('http://localhost:8000/planned');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await expect(sharedPage.locator('#sidebar')).toContainText('Freie Plätze: 5');
await sharedPage.getByRole('spinbutton').click();
await sharedPage.getByRole('spinbutton').fill('3');
await sharedPage.getByRole('button', { name: 'Speichern' }).click();
await expect(sharedPage.locator('body')).toContainText('Ausfahrt erfolgreich aktualisiert.');
test("change amount rower", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 5",
);
await sharedPage.getByRole("spinbutton").click();
await sharedPage.getByRole("spinbutton").fill("3");
await sharedPage.getByRole("button", { name: "Speichern" }).click();
await expect(sharedPage.locator("body")).toContainText(
"Ausfahrt erfolgreich aktualisiert.",
);
});
test('call off trip', async () => {
await sharedPage.goto('http://localhost:8000/planned');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await expect(sharedPage.locator('#sidebar')).toContainText('Freie Plätze: 5');
await sharedPage.getByRole('spinbutton').click();
await sharedPage.getByRole('spinbutton').fill('0');
await sharedPage.getByRole('button', { name: 'Speichern' }).click();
await expect(sharedPage.locator('body')).toContainText('Ausfahrt erfolgreich aktualisiert.');
await expect(sharedPage.locator('body')).toContainText('(Absage cox )');
test("call off trip", async () => {
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await expect(sharedPage.locator("#sidebar")).toContainText(
"Freie Plätze: 5",
);
await sharedPage.getByRole("spinbutton").click();
await sharedPage.getByRole("spinbutton").fill("0");
await sharedPage.getByRole("button", { name: "Speichern" }).click();
await expect(sharedPage.locator("body")).toContainText(
"Ausfahrt erfolgreich aktualisiert.",
);
await expect(sharedPage.locator("body")).toContainText("(Absage cox )");
});
test.afterEach(async () => {
await sharedPage.goto('http://localhost:8000/planned');
await sharedPage.getByRole('link', { name: 'Details' }).click();
await sharedPage.getByRole('link', { name: 'Termin löschen' }).click();
await sharedPage.goto("http://localhost:8000/planned");
await sharedPage.getByRole("link", { name: "Details" }).click();
await sharedPage.getByRole("link", { name: "Termin löschen" }).click();
await sharedPage.close();
});

View File

@ -1,69 +1,85 @@
import { test, expect } from '@playwright/test';
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.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');
test("Cox can start and cancel trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/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.getByRole('link', { name: 'Ausfahrt eintragen' }).click();
if (testInfo.project.name.includes('Mobile')) { // No left boat selector on mobile views
await page.getByText('Kaputtes Boot :-( (7 x)').nth(1).click();
await page.getByRole('option', { name: 'Joe' }).click();
} else{
await page.getByText('Joe', { exact: true }).click();
await page.goto("http://localhost:8000/");
await page.getByRole("link", { name: "Ausfahrt eintragen" }).click();
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
await page.getByText("Kaputtes Boot :-( (7 x)").nth(1).click();
await page.getByRole("option", { name: "Joe" }).click();
} else {
await page.getByText("Joe", { exact: true }).click();
}
await page.getByPlaceholder('Ruderer auswählen').click();
await page.getByRole('option', { name: 'rower2' }).click();
await page.getByRole('option', { name: 'cox2' }).click();
await expect(page.getByRole('listbox')).toContainText('Nur 2 Ruderer können hinzugefügt werden');
await expect(page.locator('#shipmaster-newrowerjs')).toContainText('cox');
await expect(page.locator('#steering_person-newrowerjs')).toContainText('rower2 cox');
await page.getByRole('button', { name: 'Ausfahrt eintragen' }).click();
await expect(page.locator('body')).toContainText('Ausfahrt erfolgreich hinzugefügt');
await expect(page.locator('body')).toContainText('Joe');
await page.getByPlaceholder("Ruderer auswählen").click();
await page.getByRole("option", { name: "rower2" }).click();
await page.getByRole("option", { name: "cox2" }).click();
await expect(page.getByRole("listbox")).toContainText(
"Nur 2 Ruderer können hinzugefügt werden",
);
await expect(page.locator("#shipmaster-newrowerjs")).toContainText("cox");
await expect(page.locator("#steering_person-newrowerjs")).toContainText(
"rower2 cox",
);
await page.getByRole("button", { name: "Ausfahrt eintragen" }).click();
await expect(page.locator("body")).toContainText(
"Ausfahrt erfolgreich hinzugefügt",
);
await expect(page.locator("body")).toContainText("Joe");
await page.getByRole('link', { name: 'Joe' }).click();
page.once('dialog', dialog => {
await page.getByRole("link", { name: "Joe" }).click();
page.once("dialog", (dialog) => {
dialog.accept().catch(() => {});
});
await page.getByRole('link', { name: 'Löschen' }).click();
await page.getByRole("link", { name: "Löschen" }).click();
});
test('Cox can start and finish trip', async ({ page }, testInfo) => {
await page.goto('http://localhost:8000/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');
test("Cox can start and finish trip", async ({ page }, testInfo) => {
await page.goto("http://localhost:8000/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.getByRole('link', { name: 'Ausfahrt eintragen' }).click();
if (testInfo.project.name.includes('Mobile')) { // No left boat selector on mobile views
await page.getByText('Kaputtes Boot :-( (7 x)').nth(1).click();
await page.getByRole('option', { name: 'Joe' }).click();
} else{
await page.getByText('Joe', { exact: true }).click();
await page.goto("http://localhost:8000/");
await page.getByRole("link", { name: "Ausfahrt eintragen" }).click();
if (testInfo.project.name.includes("Mobile")) {
// No left boat selector on mobile views
await page.getByText("Kaputtes Boot :-( (7 x)").nth(1).click();
await page.getByRole("option", { name: "Joe" }).click();
} else {
await page.getByText("Joe", { exact: true }).click();
}
await page.getByPlaceholder('Ruderer auswählen').click();
await page.getByRole('option', { name: 'rower2' }).click();
await page.getByRole('option', { name: 'cox2' }).click();
await expect(page.getByRole('listbox')).toContainText('Nur 2 Ruderer können hinzugefügt werden');
await expect(page.locator('#shipmaster-newrowerjs')).toContainText('cox');
await expect(page.locator('#steering_person-newrowerjs')).toContainText('rower2 cox');
await page.getByRole('button', { name: 'Ausfahrt eintragen' }).click();
await expect(page.locator('body')).toContainText('Ausfahrt erfolgreich hinzugefügt');
await expect(page.locator('body')).toContainText('Joe');
await page.getByPlaceholder("Ruderer auswählen").click();
await page.getByRole("option", { name: "rower2" }).click();
await page.getByRole("option", { name: "cox2" }).click();
await expect(page.getByRole("listbox")).toContainText(
"Nur 2 Ruderer können hinzugefügt werden",
);
await expect(page.locator("#shipmaster-newrowerjs")).toContainText("cox");
await expect(page.locator("#steering_person-newrowerjs")).toContainText(
"rower2 cox",
);
await page.getByRole("button", { name: "Ausfahrt eintragen" }).click();
await expect(page.locator("body")).toContainText(
"Ausfahrt erfolgreich hinzugefügt",
);
await expect(page.locator("body")).toContainText("Joe");
await page.goto('http://localhost:8000/log');
await page.goto("http://localhost:8000/log");
await page.waitForTimeout(60000);
await page.locator('div:nth-child(2) > .border-0').click();
await page.getByRole('combobox', { name: 'Destination' }).click();
await page.getByRole('combobox', { name: 'Destination' }).fill('Ottensheim');
await page.getByRole('button', { name: 'Ausfahrt beenden' }).click();
await expect(page.locator('body')).toContainText('Ausfahrt korrekt eingetragen');
await page.locator("div:nth-child(2) > .border-0").click();
await page.getByRole("combobox", { name: "Destination" }).click();
await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim");
await page.getByRole("button", { name: "Ausfahrt beenden" }).click();
await expect(page.locator("body")).toContainText(
"Ausfahrt korrekt eingetragen",
);
});