Files
ontime/e2e/tests/features/301-spreadsheet-import.spec.ts
T
Alex Christoffer Rasmussen cf206e6220 feat: Vite 8 (#2018)
* chore: upgrade vite

* fix: inconsistentCjsInterop for ReactQR

* chore: e2e tests should use relativve path and get host from playwright config

* refactor: drop qr code dependency

---------

Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
2026-03-24 09:11:57 +01:00

42 lines
1.8 KiB
TypeScript

import { expect, test } from '@playwright/test';
const fileToUpload = 'e2e/tests/fixtures/test-sheet.xlsx';
test('sheet file upload', async ({ page }) => {
await page.goto('/editor');
await page.getByRole('button', { name: 'Edit' }).click();
await page.getByRole('button', { name: 'Rundown menu' }).click();
await page.getByRole('menuitem', { name: 'Clear all' }).click();
await page.getByRole('button', { name: 'Delete all' }).click();
await page.getByRole('button', { name: 'Toggle settings' }).click();
await page.getByRole('button', { name: 'Import spreadsheet' }).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 from spreadsheet', exact: true }).click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(fileToUpload);
await page.getByRole('row', { name: 'Worksheet' }).getByRole('combobox').click();
await page.getByRole('option', { name: 'test' }).click();
await page.getByRole('button', { name: 'Import preview' }).click();
await page.getByRole('button', { name: 'Apply' }).click();
await page.getByRole('button', { name: 'Return' }).click();
await page.getByRole('button', { name: 'Close settings' }).scrollIntoViewIfNeeded();
await page.getByRole('button', { name: 'Close settings' }).click();
// asset test events
const firstTitle = page.getByTestId('entry-1').getByTestId('entry__title');
await expect(firstTitle).toHaveValue('Attempt light check');
const secondTitle = page.getByTestId('entry-2').getByTestId('entry__title');
await expect(secondTitle).toHaveValue('Preset');
const thirdTitle = page.getByTestId('entry-3').getByTestId('entry__title');
await expect(thirdTitle).toHaveValue('Albania');
});