2024-03-03 20:47:26 +01:00
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
|
|
|
test('Cox can start and cancel trip', async ({ page }) => {
|
|
|
|
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();
|
|
|
|
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.getByRole('link', { name: 'Joe' }).click();
|
|
|
|
page.once('dialog', dialog => {
|
|
|
|
console.log(`Dialog message: ${dialog.message()}`);
|
2024-03-03 21:11:38 +01:00
|
|
|
dialog.accept().catch(() => {});
|
2024-03-03 20:47:26 +01:00
|
|
|
});
|
|
|
|
await page.getByRole('link', { name: 'Löschen' }).click();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Cox can start and finish trip', async ({ page }) => {
|
|
|
|
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();
|
|
|
|
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.goto('http://localhost:8000/log');
|
|
|
|
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.waitForTimeout(60000);
|
|
|
|
await page.getByRole('button', { name: 'Ausfahrt beenden' }).click();
|
|
|
|
await expect(page.locator('body')).toContainText('Ausfahrt korrekt eingetragen');
|
|
|
|
});
|