Upgrade expressjs (#1633)

* upgrade expressjs

* migration

* reenable test

* extend timeout on download test

* fixup! migration

* move empty body test from controller to validator

* enusre not empty

* extract validation function

* fixup! reenable test

* remove thin controllers

* disable e2e test of project file download
This commit is contained in:
Alex Christoffer Rasmussen
2025-06-12 15:02:35 +02:00
committed by Carlos Valente
parent 90870ecfb6
commit 6f3ab274bd
39 changed files with 590 additions and 841 deletions
+13 -12
View File
@@ -1,9 +1,10 @@
import { test, expect } from '@playwright/test';
import { randomUUID } from 'crypto';
import { readFile } from 'fs/promises';
import { readFile, unlink } from 'fs/promises';
const fileToUpload = 'e2e/tests/fixtures/e2e-test-db.json';
const fileToDownload = 'e2e/tests/fixtures/tmp/e2e-test-db.json';
const fileToDownload = 'e2e/tests/fixtures/tmp/';
test('project file upload', async ({ page }) => {
await page.goto('http://localhost:4001/editor');
@@ -35,30 +36,30 @@ test('project file upload', async ({ page }) => {
await expect(thirdTitle).toHaveValue('Lithuania');
});
//TODO: this works when testing locally, but not in github actions
test.fixme('project file download', async ({ page }) => {
await page.goto('http://localhost:4001/editor');
await page.getByRole('button', { name: 'toggle settings' }).click();
await page.getByRole('button', { name: 'Manage projects' }).click();
// workaround to download
// https://playwright.dev/docs/api/class-download
const downloadPromise = page.waitForEvent('download');
await page.goto('http://localhost:4001/editor/?settings=project__manage');
await page
.getByRole('row', { name: /.*currently loaded/i })
.getByLabel('Options')
.click();
// workaround to download
// https://playwright.dev/docs/api/class-download
const downloadPromise = page.waitForEvent('download', { timeout: 10_000 });
await page.getByRole('menuitem', { name: 'Download' }).click();
const download = await downloadPromise;
// Wait for the download process to complete and save the downloaded file somewhere.
await download.saveAs(fileToDownload);
const uniqFileToDownload = fileToDownload + randomUUID() + '.json';
await download.saveAs(uniqFileToDownload);
expect(download.failure()).toMatchObject({});
const original = JSON.parse(await readFile(fileToUpload, { encoding: 'utf-8' }));
const fromServer = JSON.parse(await readFile(fileToDownload, { encoding: 'utf-8' }));
const fromServer = JSON.parse(await readFile(uniqFileToDownload, { encoding: 'utf-8' }));
await unlink(uniqFileToDownload);
// when a file is parsed, the server will write the version number to the project file
original.settings.version = 'not-important';
+22 -3
View File
@@ -21,6 +21,24 @@
"bab4a",
"d3eb1"
],
"flatOrder": [
"32d31",
"21cd2",
"0b371",
"3cd28",
"e457f",
"01e85",
"1c420",
"b7737",
"d3a80",
"8276c",
"2340b",
"cb90b",
"503c4",
"5e965",
"bab4a",
"d3eb1"
],
"entries": {
"32d31": {
"type": "event",
@@ -469,7 +487,8 @@
"publicInfo": "Rehearsal Schedule - Turin 2022",
"backstageUrl": "www.github.com/cpvalente/ontime",
"backstageInfo": "Rehearsal Schedule - Turin 2022\nAll performers to wear full costumes for 1st rehearsal",
"projectLogo": null
"projectLogo": null,
"custom": []
},
"settings": {
"app": "ontime",
@@ -489,12 +508,12 @@
"warningColor": "#FFAB33"
},
"customFields": {
"song": {
"Song": {
"label": "Song",
"type": "string",
"colour": "#339E4E"
},
"artist": {
"Artist": {
"label": "Artist",
"type": "string",
"colour": "#3E75E8"