mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 11:53:49 +00:00
V2 e2e playwright (#343)
* test: create utility for uploading test-db * chore: upgrade deps * refactor: remove unused functions * chore: create testing boilerplate * test: upload showfile
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// haven't been able to get this to work
|
||||
// it is well discussed in the issues, so should be able to find something
|
||||
// https://playwrightsolutions.com/making-a-post/
|
||||
// https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-fetch
|
||||
// the upload is accepted by backend we receive 400 after upload and parse
|
||||
|
||||
export async function uploadTestDb(request) {
|
||||
const filePath = path.resolve('e2e/tests/fixtures/test-db.json');
|
||||
const file = fs.readFileSync(filePath);
|
||||
|
||||
const response = await request.post('http://localhost:4001/ontime/db?onlyRundown=false', {
|
||||
multipart: {
|
||||
file: {
|
||||
fileName: filePath,
|
||||
mimeType: "application/json",
|
||||
buffer: file,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
Reference in New Issue
Block a user