-
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.
* wip * add driver app .gitignore * add driver api * lint + format * add driver api to server.hooks * Update package.json * reset db before unit tests --------- Co-authored-by: Felix Gündling <[email protected]>
- Loading branch information
1 parent
f567c8f
commit 27f85eb
Showing
19 changed files
with
7,566 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ src/lib/shadcn/* | |
.github/* | ||
migrations/* | ||
src/lib/openapi | ||
taxidriver-android-app | ||
driver-app |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
INSERT INTO "request" ("tour", "passengers", "bikes", "wheelchairs", "luggage", "customer") VALUES | ||
(3, 1, 0, 0, 0, 1), | ||
(3, 1, 0, 0, 0, 1), | ||
(2, 1, 0, 0, 0, 1), | ||
(1, 1, 0, 0, 0, 1); | ||
INSERT INTO "request" ("tour", "passengers", "bikes", "wheelchairs", "luggage", "customer", "ticket_code", "ticket_checked") VALUES | ||
(3, 1, 0, 0, 0, 1, 'djsjdk2349484hdhdf93hddg38d', FALSE), | ||
(3, 1, 0, 0, 0, 1, 'djsjdk2349484hdhdf93hddg38d', FALSE), | ||
(2, 1, 0, 0, 0, 1, 'djsjdk2349484hdhdf93hddg38d', FALSE), | ||
(1, 1, 0, 0, 0, 1, 'djsjdk2349484hdhdf93hddg38d', FALSE); |
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ INSERT INTO "user" ("email", "is_taxi_owner", "is_admin", "password_hash", "name | |
('[email protected]', 't', 'f', '$argon2id$v=19$m=19456,t=2,p=1$jxW4oxa3l0tg+OG3+4lllw$l5TN76xuwWqc01KNBHB37WukqjmqjKsm/ZBF2y+NvPY', 'John', NULL, 5, 't'), | ||
('[email protected]', 't', 'f', '$argon2id$v=19$m=19456,t=2,p=1$dviKXplqYeVGdRA+UztyDg$/rQUv5OVgKufsy6VqYtFhXfE6jaHOCV6oE+3aDZVGMo', 'John', NULL, 6, 't'), | ||
('[email protected]', 't', 'f', '$argon2id$v=19$m=19456,t=2,p=1$B7mjUX8IFZv+1G/jiu2dSQ$xGhHcG8PKvDYLwydw2aVVqaaovdjFanlIrBjF0TgDkI', 'John', NULL, 7, 't'), | ||
('[email protected]', 't', 'f', '$argon2id$v=19$m=19456,t=2,p=1$6zvrI5rYSzw+NP8hRZ1Yxg$pAY9o3o3rhlCNGo2zVwP/Kq5YVOrm6yvLrqaSDeWxpw', 'John', NULL, 8, 't'); | ||
('[email protected]', 't', 'f', '$argon2id$v=19$m=19456,t=2,p=1$6zvrI5rYSzw+NP8hRZ1Yxg$pAY9o3o3rhlCNGo2zVwP/Kq5YVOrm6yvLrqaSDeWxpw', 'John', NULL, 8, 't'), | ||
('[email protected]', 'f', 'f', '$argon2id$v=19$m=19456,t=2,p=1$6zvrI5rYSzw+NP8hRZ1Yxg$pAY9o3o3rhlCNGo2zVwP/Kq5YVOrm6yvLrqaSDeWxpw', 'John', NULL, 1, 't'); |
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,2 @@ | ||
.gradle | ||
.idea |
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,87 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { TAXI_OWNER, execSQL, login } from './utils'; | ||
import { sql } from 'kysely'; | ||
|
||
test('Get tours', async ({ page }) => { | ||
await login(page, TAXI_OWNER); | ||
|
||
const response = await page | ||
.context() | ||
.request.get('/api/driver/tour?fromTime=1790726400000&toTime=1790812799000'); | ||
expect(response.status()).toBe(200); | ||
|
||
const responseBody = await response.json(); | ||
expect(responseBody).toHaveLength(1); | ||
expect(responseBody[0]).toHaveProperty('tourId'); | ||
expect(responseBody[0]).toHaveProperty('licensePlate', 'GR-TU-11'); | ||
expect(responseBody[0]).toHaveProperty('events'); | ||
|
||
const events = responseBody[0]['events']; | ||
expect(events).toHaveLength(2); | ||
expect(events[0]).toHaveProperty('requestId'); | ||
|
||
const requestId = events[0]['requestId']; | ||
expect(requestId).not.toBeNaN(); | ||
}); | ||
|
||
test('Get vehicles', async ({ page }) => { | ||
await login(page, TAXI_OWNER); | ||
|
||
const response = await page.context().request.get('/api/driver/vehicle'); | ||
expect(response.status()).toBe(200); | ||
|
||
const responseBody = await response.json(); | ||
expect(responseBody).toHaveLength(1); | ||
expect(responseBody[0]).toHaveProperty('licensePlate', 'GR-TU-11'); | ||
}); | ||
|
||
test('Set ticket checked', async ({ page }) => { | ||
await login(page, TAXI_OWNER); | ||
|
||
const toursResponse = await page | ||
.context() | ||
.request.get('/api/driver/tour?fromTime=1790726400000&toTime=1790812799000'); | ||
expect(toursResponse.status()).toBe(200); | ||
|
||
const tours = await toursResponse.json(); | ||
expect(tours).toHaveLength(1); | ||
expect(tours[0]).toHaveProperty('events'); | ||
|
||
const events = tours[0]['events']; | ||
expect(events).toHaveLength(2); | ||
expect(events[0]).toHaveProperty('requestId'); | ||
|
||
const requestId = events[0]['requestId']; | ||
expect(requestId).not.toBeNaN(); | ||
|
||
const ticketCode = 'a7d421840cf89e052d7c1aa74caf66d8'; | ||
await execSQL(sql`UPDATE "request" SET ticket_code = ${ticketCode} WHERE id = ${requestId}`); | ||
|
||
const response = await page | ||
.context() | ||
.request.post(`/api/driver/ticket?requestId=${requestId}&ticketCode=${ticketCode}`); | ||
expect(response.status()).toBe(200); | ||
}); | ||
|
||
test('Set tour fare', async ({ page }) => { | ||
await login(page, TAXI_OWNER); | ||
|
||
const toursResponse = await page | ||
.context() | ||
.request.get('/api/driver/tour?fromTime=1790726400000&toTime=1790812799000'); | ||
expect(toursResponse.status()).toBe(200); | ||
|
||
const tours = await toursResponse.json(); | ||
expect(tours).toHaveLength(1); | ||
expect(tours[0]).toHaveProperty('tourId'); | ||
|
||
const tourId = tours[0]['tourId']; | ||
expect(tourId).not.toBeNaN(); | ||
|
||
const fare = 1234; | ||
|
||
const response = await page | ||
.context() | ||
.request.post(`/api/driver/fare?tourId=${tourId}&fare=${fare}`); | ||
expect(response.status()).toBe(200); | ||
}); |
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 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
Oops, something went wrong.