-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
150 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)' | ||
); | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: '[email protected]', | ||
password: 'longEnough1' | ||
}; | ||
|
||
export const ENTREPENEUR: UserCredentials = { | ||
email: '[email protected]', | ||
email: '[email protected]', | ||
password: 'longEnough2' | ||
}; | ||
|
||
export const ENTREPENEUR2: UserCredentials = { | ||
email: '[email protected]', | ||
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(); | ||
} |