diff --git a/.gitignore b/.gitignore
index 6c9e726d..8b34bc53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,5 +10,5 @@ node_modules
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
booking-generator/data/stops.txt
-booking-generator/test/
+booking-generator/test
.vscode
diff --git a/booking-generator/test/generator.conf b/booking-generator/test/generator.conf
deleted file mode 100644
index e1f95e23..00000000
--- a/booking-generator/test/generator.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "data": "./booking-generator/test/single_request.json",
- "single_request": true,
- "days": 3,
- "max_passengers": 3,
- "max_requests": 5,
- "max_bookings": null,
- "delay": 1,
- "url": "http://localhost:5173/api/booking",
- "auth": "or5cgzd77zodgexr6nhch3fjbl2ozybk3rw52uab"
-}
\ No newline at end of file
diff --git a/booking-generator/test/single_request.json b/booking-generator/test/single_request.json
deleted file mode 100644
index 40ffd349..00000000
--- a/booking-generator/test/single_request.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "from": {
- "coordinates": { "lat": 51.18205293877134, "lng": 14.862986488474997 },
- "address": {
- "street": "",
- "house_number": "",
- "city": "",
- "postal_code": ""
- }
- },
- "to": {
- "coordinates": { "lat": 51.14937071095368, "lng": 14.93582906557364 },
- "address": {
- "street": "",
- "house_number": "",
- "city": "",
- "postal_code": ""
- }
- },
- "startFixed": true,
- "timeStamp": "2024-08-16T14:00:00Z",
- "numPassengers": 2,
- "numWheelchairs": 0,
- "numBikes": 0,
- "luggage": 0
-}
diff --git a/src/lib/ConfirmationDialog.svelte b/src/lib/ConfirmationDialog.svelte
index e87229d4..5043aa2a 100644
--- a/src/lib/ConfirmationDialog.svelte
+++ b/src/lib/ConfirmationDialog.svelte
@@ -37,7 +37,7 @@
Abbrechen
- Ok
+ Bestätigen
diff --git a/src/routes/(user)/taxi/ConfirmationDialog.svelte b/src/routes/(user)/taxi/ConfirmationDialog.svelte
deleted file mode 100644
index 6b69a87e..00000000
--- a/src/routes/(user)/taxi/ConfirmationDialog.svelte
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-{#if showDialog}
-
-
Are you sure?
-
-
-
-{/if}
-
-
-
-
diff --git a/src/routes/request/+page.svelte b/src/routes/request/+page.svelte
index abd32b4e..b1f7f690 100644
--- a/src/routes/request/+page.svelte
+++ b/src/routes/request/+page.svelte
@@ -24,12 +24,12 @@
let map = $state();
let start = $state({
- lat: 51.343543966724404,
- lng: 14.843405973137568
+ lat: 51.526934461032994,
+ lng: 14.57712544716437
});
let destination = $state({
- lat: 51.30359310483892,
- lng: 14.901901510528297
+ lat: 51.505730979747334,
+ lng: 14.638267982988827
});
let dummyAddress = {
street: '',
diff --git a/tests/entrepreneurAssignsRoles.test.ts b/tests/entrepreneurAssignsRoles.test.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/setAvailability.test.ts b/tests/setAvailability.test.ts
new file mode 100644
index 00000000..12cc0a9b
--- /dev/null
+++ b/tests/setAvailability.test.ts
@@ -0,0 +1,105 @@
+import { expect, test } from '@playwright/test';
+import { login, ENTREPENEUR, setCompanyData, COMPANY1 } from './utils';
+
+test.describe.configure({ mode: 'serial' });
+
+test('Set company data', async ({ page }) => {
+ await setCompanyData(page, ENTREPENEUR, COMPANY1);
+});
+
+test('Set availability', async ({ page }) => {
+ await login(page, ENTREPENEUR);
+ await page.getByRole('link', { name: 'Taxi' }).click();
+ await expect(page.getByRole('heading', { name: 'Fahrzeuge und Touren' })).toBeVisible();
+ await page.waitForTimeout(500);
+ await page.getByRole('button', { name: 'Fahrzeug hinzufügen' }).click();
+ await page.getByPlaceholder('DA-AB-1234').fill('GR-TU-11');
+ await page.getByLabel('3 Passagiere').check();
+ await page
+ .locator('button')
+ .filter({ hasText: /^Fahrzeug hinzufügen$/ })
+ .click();
+
+ await page.goto('/taxi?offset=-120&date=2026-09-30');
+ await page.waitForTimeout(500);
+ await page.mouse.move(425, 465);
+ await page.mouse.down();
+ await page.mouse.move(525, 465);
+ await page.mouse.up();
+});
+
+test('Request ride', async ({ page }) => {
+ await login(page, ENTREPENEUR);
+ await page.waitForTimeout(500);
+ await page.goto('/request');
+ await page.getByRole('textbox').fill('');
+ await page.keyboard.down('0');
+ await page.keyboard.down('9');
+ await page.keyboard.down('3');
+ await page.keyboard.down('0');
+ await page.keyboard.down('2');
+ await page.keyboard.down('0');
+ await page.keyboard.down('2');
+ await page.keyboard.down('6');
+ await page.keyboard.press('ArrowRight');
+ await page.keyboard.down('1');
+ await page.keyboard.down('0');
+ await page.keyboard.down('4');
+ await page.keyboard.down('0');
+ await page.keyboard.press('ArrowRight');
+ await page.keyboard.down('A');
+ await page.getByRole('button', { name: 'Suchen' }).click();
+ await expect(page.getByRole('heading', { name: ': OK' })).toHaveText('200: OK');
+});
+
+test('Move tour to other vehicle', async ({ page }) => {
+ await login(page, ENTREPENEUR);
+ await page.getByRole('link', { name: 'Taxi' }).click();
+ await expect(page.getByRole('heading', { name: 'Fahrzeuge und Touren' })).toBeVisible();
+ await page.waitForTimeout(500);
+ await page.getByRole('button', { name: 'Fahrzeug hinzufügen' }).click();
+ await page.getByPlaceholder('DA-AB-1234').fill('GR-TU-12');
+ await page.getByLabel('3 Passagiere').check();
+ await page
+ .locator('button')
+ .filter({ hasText: /^Fahrzeug hinzufügen$/ })
+ .click();
+
+ await page.goto('/taxi?offset=-120&date=2026-09-30');
+ await page.waitForTimeout(1000);
+
+ await page
+ .locator('table:nth-child(2) > tbody > tr > td:nth-child(4) > .w-full > tbody > tr > td > .w-8')
+ .first()
+ .click();
+ await page.getByText('Tour redisponieren').click();
+ await page.getByText('Bestätigen').click();
+ await page.getByText('Ok').click();
+ await page.getByRole('button', { name: 'cross 2, Close' }).click();
+
+ await expect(
+ page
+ .locator(
+ 'table:nth-child(2) > tbody > tr > td:nth-child(4) > .w-full > tbody > tr > td > .w-8'
+ )
+ .first()
+ ).toHaveCSS('background-color', 'rgb(251, 146, 60)');
+
+ await page.mouse.move(425, 505);
+ await page.mouse.down();
+ await page.mouse.move(425, 540);
+ await page.waitForTimeout(1000);
+ await page.mouse.up();
+
+ await expect(
+ page
+ .locator(
+ 'table:nth-child(2) > tbody > tr > td:nth-child(4) > .w-full > tbody > tr > td > .w-8'
+ )
+ .first()
+ ).toHaveCSS('background-color', 'rgb(254, 249, 195)');
+ await expect(page.locator('.cursor-pointer').first()).toHaveCSS(
+ 'background-color',
+ 'rgb(251, 146, 60)'
+ );
+});
diff --git a/tests/tourRedisposition.test.ts b/tests/tourRedisposition.test.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/utils.ts b/tests/utils.ts
index 4f695a3e..4eb25611 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -5,16 +5,42 @@ export type UserCredentials = {
password: string;
};
+export type Company = {
+ name: string;
+ address: string;
+ zone: string;
+ community: string;
+};
+
export const MAINTAINER: UserCredentials = {
email: 'master@example.com',
password: 'longEnough1'
};
export const ENTREPENEUR: UserCredentials = {
- email: 'taxi@example.com',
+ email: 'taxi1@test.de',
+ password: 'longEnough2'
+};
+
+export const ENTREPENEUR2: UserCredentials = {
+ email: 'taxi2@test.de',
password: 'longEnough2'
};
+export const COMPANY1: Company = {
+ name: 'Taxi Weißwasser',
+ address: 'Werner-Seelenbinder-Straße 70A, 02943 Weißwasser/Oberlausitz',
+ zone: 'Weißwasser',
+ community: 'Weißwasser/O.L.'
+};
+
+export const COMPANY2: Company = {
+ name: 'Taxi Gablenz',
+ address: 'Schulstraße 21, 02953 Gablenz',
+ zone: 'Weißwasser',
+ community: 'Gablenz'
+};
+
export async function login(page: Page, credentials: UserCredentials) {
await page.goto('/login');
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible();
@@ -33,3 +59,15 @@ export async function signup(page: Page, credentials: UserCredentials) {
page.getByRole('heading', { name: 'Willkommen beim Projekt PrimaÖV!' })
).toBeVisible();
}
+
+export async function setCompanyData(page: Page, user: UserCredentials, company: Company) {
+ await login(page, user);
+ await expect(page.getByRole('heading', { name: 'Stammdaten Ihres Unternehmens' })).toBeVisible();
+
+ await page.getByLabel('Name').fill(company.name);
+ await page.getByLabel('Unternehmenssitz').fill(company.address);
+ await page.waitForTimeout(250);
+ await page.getByLabel('Pflichtfahrgebiet').selectOption({ label: company.zone });
+ await page.getByLabel('Gemeinde').selectOption({ label: company.community });
+ await page.getByRole('button', { name: 'Übernehmen' }).click();
+}