mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 05:13:32 +00:00
refactor: normalise data (#756)
* chore: remove legal from bundle * refactor: create normalised dataset * refactor: cuesheet uses flat rundown * refactor: multi-selection * refactor: prevent stale data on server restart * refactor: increase ID size * chore: instrument operation * chore: update csv tests * fix: resolve directory to test-db (#758)
This commit is contained in:
@@ -22,11 +22,7 @@ test('test project file upload', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Import' }).click();
|
||||
|
||||
// asset test events
|
||||
await page.getByPlaceholder('Start').first().click();
|
||||
await page.getByText('First test event').click();
|
||||
await page.getByTestId('delay-input').click();
|
||||
await page.getByText('New start: 10:10').click();
|
||||
await page.getByText('Second test event').click();
|
||||
await page.getByText('Lunch').click();
|
||||
await page.getByText('Third test event').click();
|
||||
await page.getByText('Albania').click();
|
||||
await page.getByText('Latvia').click();
|
||||
await page.getByText('Lithuania').click();
|
||||
});
|
||||
|
||||
@@ -2,31 +2,21 @@ import { expect, test } from '@playwright/test';
|
||||
import fs from 'fs';
|
||||
|
||||
test('cuesheet displays events and exports csv', async ({ page }) => {
|
||||
// ensure elements exist in editor
|
||||
await page.goto('http://localhost:4001/editor');
|
||||
await page.getByText('First test event').click();
|
||||
await page.getByText('Second test event').click();
|
||||
await page.getByText('Third test event').click();
|
||||
await page.getByText('Add timeSubtract timeApplyCancel').click();
|
||||
await page.getByText('Lunch').click();
|
||||
|
||||
// same elements in cuesheet
|
||||
await page.goto('http://localhost:4001/cuesheet');
|
||||
await page.getByText('All about Carlos demo event').click();
|
||||
await page.getByRole('cell', { name: 'First test event' }).click();
|
||||
await page.getByRole('cell', { name: 'Second test event' }).click();
|
||||
await page.getByRole('cell', { name: 'Third test event' }).click();
|
||||
await page.getByRole('cell', { name: '+10 min' }).click();
|
||||
await page.getByRole('cell', { name: 'Lunch' }).click();
|
||||
const downloadPromise = page.waitForEvent('download');
|
||||
await page.getByTestId('cuesheet').getByText('Export').click();
|
||||
await page.getByText('CSV').click();
|
||||
await page.getByText('Eurovision Song Contest').click();
|
||||
await page.getByRole('cell', { name: 'Lunch break' }).click();
|
||||
await page.getByRole('cell', { name: 'Albania' }).click();
|
||||
await page.getByRole('cell', { name: 'Latvia' }).click();
|
||||
await page.getByRole('cell', { name: 'Lithuania' }).click();
|
||||
|
||||
// From here we test the CSV download feature
|
||||
const downloadPromise = page.waitForEvent('download');
|
||||
await page.getByTestId('cuesheet').getByText('Export CSV').click();
|
||||
|
||||
function validateCSV(contents) {
|
||||
function validateCSV(contents: string) {
|
||||
// We should try to keep this in sync with the implementation over at cuesheetUtils.ts
|
||||
const expectedHeader = ['All about Carlos demo event', 'www.getontime.no'];
|
||||
const expectedHeader = ['Project title: Eurovision Song Contest', 'Project description: Turin 2022'];
|
||||
const expectedColumns = [
|
||||
'Time Start',
|
||||
'Time End',
|
||||
@@ -50,14 +40,15 @@ test('cuesheet displays events and exports csv', async ({ page }) => {
|
||||
'user8',
|
||||
'user9',
|
||||
];
|
||||
const expectedValues = ['First test event', 'Second test event', 'Third test event', 'Lunch'];
|
||||
const expectedValues = ['Albania', 'Latvia', 'Lithuania', 'Lunch break'];
|
||||
|
||||
const allExpected = [...expectedHeader, ...expectedColumns, ...expectedValues];
|
||||
return allExpected.every((value) => contents.includes(value));
|
||||
return allExpected.every((value) => {
|
||||
return contents.toLowerCase().includes(value.toLowerCase());
|
||||
});
|
||||
}
|
||||
|
||||
const download = await downloadPromise;
|
||||
const contents = await fs.promises.readFile(await download.path(), 'utf-8');
|
||||
expect(contents).toContain('All about Carlos demo event');
|
||||
expect(validateCSV(contents)).toBe(true);
|
||||
});
|
||||
|
||||
Vendored
+394
-62
@@ -1,48 +1,15 @@
|
||||
{
|
||||
"rundown": [
|
||||
{
|
||||
"title": "First test event",
|
||||
"subtitle": "",
|
||||
"presenter": "",
|
||||
"note": "",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 32400000,
|
||||
"timeEnd": 36000000,
|
||||
"duration": 3600000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 4,
|
||||
"id": "aa42f"
|
||||
},
|
||||
{
|
||||
"duration": 600000,
|
||||
"type": "delay",
|
||||
"revision": 0,
|
||||
"id": "b1d5a"
|
||||
},
|
||||
{
|
||||
"title": "Second test event",
|
||||
"subtitle": "",
|
||||
"presenter": "",
|
||||
"note": "",
|
||||
"title": "Albania",
|
||||
"subtitle": "Sekret",
|
||||
"presenter": "Ronela Hajati",
|
||||
"note": "SF1.01",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 36000000,
|
||||
"timeEnd": 39600000,
|
||||
"duration": 3600000,
|
||||
"timeEnd": 37200000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
@@ -57,24 +24,20 @@
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 2,
|
||||
"id": "d71bc"
|
||||
"revision": 0,
|
||||
"id": "32d31",
|
||||
"cue": "SF1.01"
|
||||
},
|
||||
{
|
||||
"title": "Lunch",
|
||||
"type": "block",
|
||||
"id": "91682"
|
||||
},
|
||||
{
|
||||
"title": "Third test event",
|
||||
"subtitle": "",
|
||||
"presenter": "",
|
||||
"note": "",
|
||||
"title": "Latvia",
|
||||
"subtitle": "Eat Your Salad",
|
||||
"presenter": "Citi Zeni",
|
||||
"note": "SF1.02",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 39600000,
|
||||
"timeEnd": 720000,
|
||||
"duration": 47520000,
|
||||
"timeStart": 37500000,
|
||||
"timeEnd": 38700000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
@@ -89,17 +52,364 @@
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 2,
|
||||
"id": "da5b4"
|
||||
"revision": 0,
|
||||
"id": "21cd2",
|
||||
"cue": "SF1.02"
|
||||
},
|
||||
{
|
||||
"title": "Lithuania",
|
||||
"subtitle": "Sentimentai",
|
||||
"presenter": "Monika Liu",
|
||||
"note": "SF1.03",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 39000000,
|
||||
"timeEnd": 40200000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "0b371",
|
||||
"cue": "SF1.03"
|
||||
},
|
||||
{
|
||||
"title": "Switzerland",
|
||||
"subtitle": "Boys Do Cry",
|
||||
"presenter": "Marius Bear",
|
||||
"note": "SF1.04",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 40500000,
|
||||
"timeEnd": 41700000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "3cd28",
|
||||
"cue": "SF1.04"
|
||||
},
|
||||
{
|
||||
"title": "Slovenia",
|
||||
"subtitle": "Disko",
|
||||
"presenter": "LPS",
|
||||
"note": "SF1.05",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 42000000,
|
||||
"timeEnd": 43200000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "e457f",
|
||||
"cue": "SF1.05"
|
||||
},
|
||||
{
|
||||
"title": "Lunch break",
|
||||
"type": "block",
|
||||
"id": "01e85"
|
||||
},
|
||||
{
|
||||
"title": "Ukraine",
|
||||
"subtitle": "Stefania",
|
||||
"presenter": "Kalush Orchestra",
|
||||
"note": "SF1.06",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 47100000,
|
||||
"timeEnd": 48300000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "1c420",
|
||||
"cue": "SF1.06"
|
||||
},
|
||||
{
|
||||
"title": "Bulgaria",
|
||||
"subtitle": "Intention",
|
||||
"presenter": "Intelligent Music Project",
|
||||
"note": "SF1.07",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 48600000,
|
||||
"timeEnd": 49800000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "b7737",
|
||||
"cue": "SF1.07"
|
||||
},
|
||||
{
|
||||
"title": "Netherlands",
|
||||
"subtitle": "De Diepte",
|
||||
"presenter": "S10",
|
||||
"note": "SF1.08",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 50100000,
|
||||
"timeEnd": 51300000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "d3a80",
|
||||
"cue": "SF1.08"
|
||||
},
|
||||
{
|
||||
"title": "Moldova",
|
||||
"subtitle": "Trenuletul",
|
||||
"presenter": "Zdob si Zdub",
|
||||
"note": "SF1.09",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 51600000,
|
||||
"timeEnd": 52800000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "8276c",
|
||||
"cue": "SF1.09"
|
||||
},
|
||||
{
|
||||
"title": "Portugal",
|
||||
"subtitle": "Saudade Saudade",
|
||||
"presenter": "Maro",
|
||||
"note": "SF1.10",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 53100000,
|
||||
"timeEnd": 54300000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "2340b",
|
||||
"cue": "SF1.10"
|
||||
},
|
||||
{
|
||||
"title": "Afternoon break",
|
||||
"type": "block",
|
||||
"id": "cb90b"
|
||||
},
|
||||
{
|
||||
"title": "Croatia",
|
||||
"subtitle": "Guilty Pleasure",
|
||||
"presenter": "Mia Dimsic",
|
||||
"note": "SF1.11",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 56100000,
|
||||
"timeEnd": 57300000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "503c4",
|
||||
"cue": "SF1.11"
|
||||
},
|
||||
{
|
||||
"title": "Denmark",
|
||||
"subtitle": "The Show",
|
||||
"presenter": "Reddi",
|
||||
"note": "SF1.12",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 57600000,
|
||||
"timeEnd": 58800000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "5e965",
|
||||
"cue": "SF1.12"
|
||||
},
|
||||
{
|
||||
"title": "Austria",
|
||||
"subtitle": "Halo",
|
||||
"presenter": "LUM!X & Pia Maria",
|
||||
"note": "SF1.13",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 59100000,
|
||||
"timeEnd": 60300000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "bab4a",
|
||||
"cue": "SF1.13"
|
||||
},
|
||||
{
|
||||
"title": "Greece",
|
||||
"subtitle": "Die Together",
|
||||
"presenter": "Amanda Tenfjord",
|
||||
"note": "SF1.14",
|
||||
"endAction": "none",
|
||||
"timerType": "count-down",
|
||||
"timeStart": 60600000,
|
||||
"timeEnd": 61800000,
|
||||
"duration": 1200000,
|
||||
"isPublic": true,
|
||||
"skip": false,
|
||||
"colour": "",
|
||||
"user0": "",
|
||||
"user1": "",
|
||||
"user2": "",
|
||||
"user3": "",
|
||||
"user4": "",
|
||||
"user5": "",
|
||||
"user6": "",
|
||||
"user7": "",
|
||||
"user8": "",
|
||||
"user9": "",
|
||||
"type": "event",
|
||||
"revision": 0,
|
||||
"id": "d3eb1",
|
||||
"cue": "SF1.14"
|
||||
}
|
||||
],
|
||||
"project": {
|
||||
"title": "All about Carlos demo event",
|
||||
"description": "Demo event for Ontime",
|
||||
"title": "Eurovision Song Contest",
|
||||
"description": "Turin 2022",
|
||||
"publicUrl": "www.getontime.no",
|
||||
"publicInfo": "WiFi: demoproject \nPassword: ontimeproject",
|
||||
"backstageUrl": "www.getontime.no",
|
||||
"backstageInfo": "WiFi: demobackstage\nPassword: ontimeproject"
|
||||
"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"
|
||||
},
|
||||
"settings": {
|
||||
"app": "ontime",
|
||||
@@ -112,6 +422,11 @@
|
||||
},
|
||||
"viewSettings": {
|
||||
"overrideStyles": false,
|
||||
"normalColor": "#ffffffcc",
|
||||
"warningColor": "#FFAB33",
|
||||
"warningThreshold": 120000,
|
||||
"dangerColor": "#ED3333",
|
||||
"dangerThreshold": 60000,
|
||||
"endMessage": ""
|
||||
},
|
||||
"aliases": [
|
||||
@@ -137,8 +452,25 @@
|
||||
"portIn": 8888,
|
||||
"portOut": 9999,
|
||||
"targetIP": "127.0.0.1",
|
||||
"enabledIn": false,
|
||||
"enabledOut": false,
|
||||
"enabledIn": true,
|
||||
"enabledOut": true,
|
||||
"subscriptions": {
|
||||
"onLoad": [],
|
||||
"onStart": [],
|
||||
"onPause": [],
|
||||
"onStop": [],
|
||||
"onUpdate": [
|
||||
{
|
||||
"id": "10eea",
|
||||
"enabled": true,
|
||||
"message": "/ontime/update/{{timer.current}}"
|
||||
}
|
||||
],
|
||||
"onFinish": []
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"enabledOut": true,
|
||||
"subscriptions": {
|
||||
"onLoad": [],
|
||||
"onStart": [],
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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