Files
ontime/e2e/tests/000-upload-showfile.spec.ts
T
Carlos Valente 10852eecdd Rundown modes (#864)
* refactor: simplify settings

* refactor: quick add around selection

* refactor: no action menu in delay block

* refactor: no action menu in event block

* style: context menu dark

* refactor: context menu actions
2024-04-02 20:09:27 +02:00

32 lines
1.3 KiB
TypeScript

import { test, expect } from '@playwright/test';
const fileToUpload = 'e2e/tests/fixtures/test-db.json';
test('project file upload', async ({ page }) => {
await page.goto('http://localhost:4001/editor');
await page.getByRole('button', { name: 'Edit mode' }).click();
await page.getByRole('button', { name: 'Clear rundown' }).click();
await page.getByRole('button', { name: 'toggle settings' }).click();
await page.getByRole('button', { name: 'Project', exact: true }).click();
// workaround to upload file on hidden input
// https://playwright.dev/docs/api/class-filechooser
const fileChooserPromise = page.waitForEvent('filechooser');
await page.getByRole('button', { name: 'Import', exact: true }).click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(fileToUpload);
await page.getByRole('button', { name: 'close' }).click();
// asset test events
const firstTitle = page.getByTestId('entry-1').getByTestId('block__title');
await expect(firstTitle).toHaveValue('Albania');
const secondTitle = page.getByTestId('entry-2').getByTestId('block__title');
await expect(secondTitle).toHaveValue('Latvia');
const thirdTitle = page.getByTestId('entry-3').getByTestId('block__title');
await expect(thirdTitle).toHaveValue('Lithuania');
});