import { test, expect } from '@playwright/test'; import { readFileSync } from 'node:fs'; import path from 'node:path'; const demo = JSON.parse(readFileSync(path.resolve(__dirname, '../../examples/project-definitions/valid-release-demo.json'), 'utf8')); test('deterministic launcher, dependent data, dashboard, and save/reload workflow', async ({ page, request }) => { test.setTimeout(60_000); const name = `Slice 6 E2E ${Date.now()}`; const document = structuredClone(demo); document.project.name = name; const created = await request.post('http://127.0.0.1:4000/api/projects', { data: { name, description: document.project.description, project_json: JSON.stringify(document) }, }); expect(created.status()).toBe(201); const row = await created.json(); try { await page.goto('/'); await page.getByRole('button', { name: 'Visual Editor', exact: true }).click(); await page.getByRole('button', { name: 'Load', exact: true }).click(); await page.getByRole('button', { name: new RegExp(name) }).click(); await expect(page.getByTitle('Click to rename project')).toContainText(name); await page.getByRole('button', { name: 'Preview', exact: true }).click(); await expect(page.getByTestId('page-load-status')).toContainText('completed', { ignoreCase: true }); const environment = page.locator('select').first(); await expect(environment.locator('option')).toHaveCount(3); await environment.selectOption('prod'); await page.locator('input[type="text"]').first().fill('bravo.example'); await page.getByRole('button', { name: 'Launch workflow', exact: true }).click(); await expect(page.getByText('req-demo-001', { exact: true })).toBeVisible(); await expect(page.locator('pre').filter({ hasText: 'bravo.example' })).toBeVisible(); await page.getByRole('button', { name: 'Refresh inventory', exact: true }).click(); await expect(page.getByRole('cell', { name: 'srv-202' })).toBeVisible(); await page.getByRole('cell', { name: 'srv-202' }).click(); await expect(page.locator('pre').filter({ hasText: 'srv-202' })).toBeVisible(); await page.getByRole('button', { name: 'Visual Editor', exact: true }).click(); await page.getByRole('button', { name: 'Update', exact: true }).click(); await expect(page.getByText(`Project "${name}" saved.`)).toBeVisible(); await page.reload(); await page.getByRole('button', { name: 'Visual Editor', exact: true }).click(); await page.getByRole('button', { name: 'Load', exact: true }).click(); await page.getByRole('button', { name: new RegExp(name) }).click(); await page.getByRole('button', { name: 'Preview', exact: true }).click(); await expect(page.getByRole('button', { name: 'Launch workflow', exact: true })).toBeVisible(); } finally { await request.delete(`http://127.0.0.1:4000/api/projects/${row.id}`); await request.delete('http://127.0.0.1:4000/api/executions'); } });