mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
Navigation (#850)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import fs from 'fs';
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test('cuesheet displays events and exports csv', async ({ page }) => {
|
||||
// same elements in cuesheet
|
||||
@@ -9,35 +8,4 @@ test('cuesheet displays events and exports csv', async ({ page }) => {
|
||||
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: string) {
|
||||
// We should try to keep this in sync with the implementation over at cuesheetUtils.ts
|
||||
const expectedHeader = ['Project title: Eurovision Song Contest', 'Project description: Turin 2022'];
|
||||
const expectedColumns = [
|
||||
'Time Start',
|
||||
'Time End',
|
||||
'Duration',
|
||||
'ID',
|
||||
'Colour',
|
||||
'Cue',
|
||||
'Title',
|
||||
'Note',
|
||||
'Is Public? (x)',
|
||||
'Skip?',
|
||||
];
|
||||
const expectedValues = ['Albania', 'Latvia', 'Lithuania', 'Lunch break'];
|
||||
|
||||
const allExpected = [...expectedHeader, ...expectedColumns, ...expectedValues];
|
||||
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(validateCSV(contents)).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user