From 3fc67dadd9e607637aedf95dc8c0a201551977af Mon Sep 17 00:00:00 2001 From: 2mal3 <56305732+2mal3@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:21:30 +0100 Subject: [PATCH] test(frontend): more tests --- control/frontend/e2e/basic.test.ts | 35 +++++++- control/frontend/playwright.config.ts | 1 + .../src/components/DisplayObject.svelte | 1 + .../src/components/InodeElement.svelte | 2 +- .../src/components/Notification.svelte | 87 ++++++++++--------- .../src/components/TipTapInput.svelte | 2 +- 6 files changed, 86 insertions(+), 42 deletions(-) diff --git a/control/frontend/e2e/basic.test.ts b/control/frontend/e2e/basic.test.ts index 751b624..b4751ab 100644 --- a/control/frontend/e2e/basic.test.ts +++ b/control/frontend/e2e/basic.test.ts @@ -2,5 +2,38 @@ import { expect, test } from '@playwright/test'; test('page loads', async ({ page }) => { await page.goto('/'); - await expect(page.locator('main')).toBeVisible(); + await expect(page.getByText('PLG MuDiCS')).toBeVisible(); +}); + +test('page loads without problems', async ({ page }) => { + await page.goto('/'); + await expect(page.getByText('PLG MuDiCS')).toBeVisible(); + await expect(page.getByTestId('notification')).not.toBeVisible(); +}); + +test('diplay click shows files', async ({ page }) => { + await page.goto('/'); + await page.getByTestId('display').click(); + await expect(page.getByTestId('inode').first()).toBeVisible(); +}); + +test('show text', async ({ page }) => { + await page.goto('/'); + await page.getByTestId('display').click(); + + const controlButton = page.getByText('Text anzeigen'); + await expect(controlButton).toBeVisible(); + await controlButton.click(); + + const textPopup = page.getByTestId('text-popup'); + await expect(textPopup).toBeVisible(); + const textArea = textPopup.getByRole('textbox'); + await expect(textArea).toBeVisible(); + await textArea.fill('Hello, world!'); + + const submitButton = textPopup.locator('button').filter({ hasText: 'Text anzeigen' }); + await submitButton.click(); + await expect( + page.locator('[data-testid="notification"]:not(:has-text("Fehler 500"))') + ).not.toBeVisible(); }); diff --git a/control/frontend/playwright.config.ts b/control/frontend/playwright.config.ts index aa4ea48..9189563 100644 --- a/control/frontend/playwright.config.ts +++ b/control/frontend/playwright.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from '@playwright/test'; export default defineConfig({ + fullyParallel: true, webServer: { command: 'deno task build && deno task preview', port: 4173 diff --git a/control/frontend/src/components/DisplayObject.svelte b/control/frontend/src/components/DisplayObject.svelte index e097f8a..4af293a 100755 --- a/control/frontend/src/components/DisplayObject.svelte +++ b/control/frontend/src/components/DisplayObject.svelte @@ -45,6 +45,7 @@