staging #169
@ -28,7 +28,7 @@ jobs:
|
|||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
run: cd frontend && npx playwright install --with-deps
|
run: cd frontend && npx playwright install --with-deps
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: cd frontend && npx playwright test
|
run: cd frontend && npx playwright test --workers 1
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
|
114
frontend/tests/cox.spec.ts
Normal file
114
frontend/tests/cox.spec.ts
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import { test, expect } 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 page.getByRole('link', { name: 'Geplante Ausfahrten' }).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!');
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('cox can edit trips', () => {
|
||||||
|
let sharedPage;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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: 'Geplante Ausfahrten' }).click();
|
||||||
|
await sharedPage.getByRole('link', { name: 'Details' }).click();
|
||||||
|
await expect(sharedPage.locator('#sidebar')).toContainText('Meine Anmerkung');
|
||||||
|
await sharedPage.locator('.sidebar-overlay').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();
|
||||||
|
|
||||||
|
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.locator('.sidebar-overlay').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.');
|
||||||
|
await sharedPage.getByRole('link', { name: 'Geplante Ausfahrten' }).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
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 sharedPage.getByRole('link', { name: 'Geplante Ausfahrten' }).click();
|
||||||
|
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.close();
|
||||||
|
});
|
||||||
|
});
|
@ -1,22 +0,0 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
|
||||||
|
|
||||||
test('cox can create 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.getByRole('button', { name: 'Einloggen' }).click();
|
|
||||||
await expect(page.locator('body')).toContainText('Login erfolgreich');
|
|
||||||
await page.locator('li').filter({ hasText: 'Geplante Ausfahrten' }).click();
|
|
||||||
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').press('ArrowLeft');
|
|
||||||
await page.locator('#sidebar #planned_starting_time').press('Tab');
|
|
||||||
await page.locator('#sidebar #planned_starting_time').fill('14:00');
|
|
||||||
await page.locator('#sidebar #planned_starting_time').press('Tab');
|
|
||||||
await page.getByRole('spinbutton').fill('4');
|
|
||||||
await page.getByRole('button', { name: 'Erstellen', exact: true }).click();
|
|
||||||
await expect(page.locator('body')).toContainText('Ausfahrt erfolgreich erstellt.');
|
|
||||||
});
|
|
@ -209,7 +209,7 @@
|
|||||||
{% if rower.is_real_guest %}
|
{% if rower.is_real_guest %}
|
||||||
<small class="text-gray-600 dark:text-gray-100">(Gast)</small>
|
<small class="text-gray-600 dark:text-gray-100">(Gast)</small>
|
||||||
{% if allow_removing %}
|
{% if allow_removing %}
|
||||||
<a href="/remove/{{ trip_details_id }}/{{ rower.name }}" class="btn btn-attention btn-fw">Abmelden</a>
|
<a href="/planned/remove/{{ trip_details_id }}/{{ rower.name }}" class="btn btn-attention btn-fw">Abmelden</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="hidden">(angemeldet seit
|
<span class="hidden">(angemeldet seit
|
||||||
|
Loading…
Reference in New Issue
Block a user