Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
test: refactor test utilities
Kyle Mendell69ba1d023507
diff --git a/tests/playwright.config.ts b/tests/playwright.config.tsindex 2a077aec6..646cc2c30 100644--- a/tests/playwright.config.ts+++ b/tests/playwright.config.ts@@ -1,6 +1,5 @@import { defineConfig, devices } from '@playwright/test';-const authFile = '.auth/login.json';const baseURL = process.env.BASE_URL || 'http://localhost:3000';const composeFile = process.env.COMPOSE_FILE || 'setup/compose.yaml';@@ -25,7 +24,7 @@ export default defineConfig({},{name: 'chromium',- use: { ...devices['Desktop Chrome'], storageState: authFile },+ use: { ...devices['Desktop Chrome'], storageState: '.auth/login.json' },dependencies: ['setup'],testMatch: /spec\/.*\.spec\.ts/,},diff --git a/tests/setup/auth.setup.ts b/tests/setup/auth.setup.tsindex d018f98da..02a94956c 100644--- a/tests/setup/auth.setup.ts+++ b/tests/setup/auth.setup.ts@@ -1,18 +1,15 @@-import { test as setup, expect } from '@playwright/test';+import { test as setup } from '@playwright/test';import { skipOnboarding } from '../utils/onboarding.util';+import authUtil from '../utils//auth.util';const authFile = '.auth/login.json';setup('authenticate', async ({ page }) => {await skipOnboarding();- await page.goto('/auth/login');- await page.getByLabel('Username').fill('arcane');- await page.getByLabel('Password').fill('arcane-admin');- await page.getByRole('button', { name: 'Sign in to Arcane', exact: true }).click();+ await authUtil.login(page);- await expect(page).toHaveURL('/dashboard');+ await page.waitForURL('/dashboard');await page.context().storageState({ path: authFile });- console.log(`Authentication state saved to ${authFile}`);});diff --git a/tests/setup/compose-postgres.yaml b/tests/setup/compose-postgres.yamlindex fe4996475..916f9436c 100644--- a/tests/setup/compose-postgres.yaml+++ b/tests/setup/compose-postgres.yaml@@ -35,7 +35,7 @@ services:args:- BUILD_TAGS=playwrightcontext: ../..- dockerfile: ../docker/Dockerfile+ dockerfile: docker/Dockerfilevolumes:arcane_data:diff --git a/tests/setup/compose.yaml b/tests/setup/compose.yamlindex 3eb89982f..c282acb44 100644--- a/tests/setup/compose.yaml+++ b/tests/setup/compose.yaml@@ -17,7 +17,7 @@ services:args:- BUILD_TAGS=playwrightcontext: ../..- dockerfile: ../docker/Dockerfile+ dockerfile: docker/Dockerfilevolumes:arcane_data:diff --git a/tests/setup/projects/test-project-1757432438167/compose.yaml b/tests/setup/projects/test-project-1757432438167/compose.yamlnew file mode 100644index 000000000..48532829c--- /dev/null+++ b/tests/setup/projects/test-project-1757432438167/compose.yaml@@ -0,0 +1,15 @@+services:+ nginx:+ image: nginx:alpine+ container_name: nginx_service+ env_file:+ - .env+ ports:+ - "8080:80"+ volumes:+ - nginx_data:/usr/share/nginx/html+ restart: unless-stopped++volumes:+ nginx_data:+ driver: local\ No newline at end of filediff --git a/tests/spec/images.spec.ts b/tests/spec/images.spec.tsindex 17c2a1a57..f0af8ec13 100644--- a/tests/spec/images.spec.ts+++ b/tests/spec/images.spec.ts@@ -143,16 +143,14 @@ test.describe('Images Page', () => {await page.waitForLoadState('networkidle');await page.locator('button:has-text("Pull Image")').first().click();- await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Image")')).toBeVisible();+ const dialogHeading = page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Image")');+ await expect(dialogHeading).toBeVisible();- const imageNameFull = 'ghcr.io/linuxserver/nginx:latest';const imageName = 'ghcr.io/linuxserver/nginx';await page.locator('input[id="image-name-*"]').fill(imageName);await page.locator('button[type="submit"]:has-text("Pull Image")').click();- await page.waitForLoadState('networkidle');-- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();+ await expect(dialogHeading).toBeHidden({ timeout: 120_000 });});});diff --git a/tests/utils/auth.util.ts b/tests/utils/auth.util.tsnew file mode 100644index 000000000..ec0708ee6--- /dev/null+++ b/tests/utils/auth.util.ts@@ -0,0 +1,10 @@+import type { Page } from '@playwright/test';++async function login(page: Page) {+ await page.goto('/auth/login');+ await page.getByLabel('Username').fill('arcane');+ await page.getByLabel('Password').fill('arcane-admin');+ await page.getByRole('button', { name: 'Sign in to Arcane', exact: true }).click();+}++export default { login };