Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: dont force pull images on project start and respect pull policy (#1820)
Kyle Mendellb5e31da47d8f
diff --git a/backend/internal/services/project_service.go b/backend/internal/services/project_service.goindex 8a8c4ab76..761fbb3ff 100644--- a/backend/internal/services/project_service.go+++ b/backend/internal/services/project_service.go@@ -114,6 +114,66 @@ type ProjectServiceInfo struct {ServiceConfig *composetypes.ServiceConfig `json:"service_config,omitempty"`}+type imagePullMode int++const (+ imagePullModeNever imagePullMode = iota+ imagePullModeIfMissing+ imagePullModeAlways+)++func resolveServiceImagePullMode(svc composetypes.ServiceConfig) imagePullMode {+ rawPolicy := strings.ToLower(strings.TrimSpace(svc.PullPolicy))+ switch {+ case rawPolicy == composetypes.PullPolicyNever:+ return imagePullModeNever+ case rawPolicy == composetypes.PullPolicyAlways:+ return imagePullModeAlways+ case rawPolicy == composetypes.PullPolicyRefresh,+ rawPolicy == "daily",+ rawPolicy == "weekly",+ strings.HasPrefix(rawPolicy, "every_"):+ return imagePullModeAlways+ case rawPolicy == composetypes.PullPolicyMissing,+ rawPolicy == composetypes.PullPolicyIfNotPresent,+ rawPolicy == composetypes.PullPolicyBuild,+ rawPolicy == "":+ return imagePullModeIfMissing+ }++ policy, _, err := svc.GetPullPolicy()+ if err != nil {+ slog.Warn("failed to parse service pull_policy, defaulting to missing", "service", svc.Name, "pull_policy", svc.PullPolicy, "error", err)+ return imagePullModeIfMissing+ }++ switch policy {+ case composetypes.PullPolicyNever:+ return imagePullModeNever+ case composetypes.PullPolicyAlways, composetypes.PullPolicyRefresh:+ return imagePullModeAlways+ case composetypes.PullPolicyMissing, composetypes.PullPolicyIfNotPresent, composetypes.PullPolicyBuild:+ return imagePullModeIfMissing+ default:+ return imagePullModeIfMissing+ }+}++func buildProjectImagePullPlan(services composetypes.Services) map[string]imagePullMode {+ plan := map[string]imagePullMode{}+ for _, svc := range services {+ img := strings.TrimSpace(svc.Image)+ if img == "" {+ continue+ }+ mode := resolveServiceImagePullMode(svc)+ if existing, exists := plan[img]; !exists || mode > existing {+ plan[img] = mode+ }+ }+ return plan+}+func normalizeComposeProjectName(name string) string {if name == "" {return ""@@ -731,7 +791,12 @@ func (s *ProjectService) DeployProject(ctx context.Context, projectID string, usreturn fmt.Errorf("failed to update project status to deploying: %w", err)}- if perr := s.EnsureProjectImagesPresent(ctx, projectID, io.Discard, nil); perr != nil {+ progressWriter, _ := ctx.Value(projects.ProgressWriterKey{}).(io.Writer)+ if progressWriter == nil {+ progressWriter = io.Discard+ }++ if perr := s.EnsureProjectImagesPresent(ctx, projectID, progressWriter, nil); perr != nil {slog.Warn("ensure images present failed (continuing to compose up)", "projectID", projectID, "error", perr)}@@ -997,7 +1062,10 @@ func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string}// EnsureProjectImagesPresent checks all compose service images for the project and-// only pulls images that are not already available locally.+// pulls based on service pull policy:+// - always/refresh: always pull+// - missing/if_not_present/default: pull only if local image is missing+// - never: never pull (fails early if image is missing locally)func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, credentials []containerregistry.Credential) error {proj, err := s.GetProjectFromDatabaseByID(ctx, projectID)if err != nil {@@ -1023,27 +1091,34 @@ func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectreturn fmt.Errorf("failed to load compose project: %w", lerr)}- images := map[string]struct{}{}- for _, svc := range compProj.Services {- img := strings.TrimSpace(svc.Image)- if img == "" {- continue- }- images[img] = struct{}{}- }+ pullPlan := buildProjectImagePullPlan(compProj.Services)settings := s.settingsService.GetSettingsConfig()- for img := range images {+ for img, mode := range pullPlan {exists, ierr := s.imageService.ImageExistsLocally(ctx, img)- if ierr != nil {+ if ierr != nil && mode != imagePullModeAlways {slog.WarnContext(ctx, "failed to check local image existence", "image", img, "error", ierr)// Non-fatal: attempt to pull to be safe}- if exists {++ if mode == imagePullModeNever {+ if ierr != nil {+ slog.WarnContext(ctx, "pull_policy is 'never' but image presence check failed; continuing without pull", "image", img, "error", ierr)+ continue+ }+ if !exists {+ return fmt.Errorf("image %s is not available locally and pull_policy is 'never'", img)+ }+ slog.DebugContext(ctx, "pull_policy is 'never'; using local image without pull", "image", img)+ continue+ }++ if mode == imagePullModeIfMissing && exists {slog.DebugContext(ctx, "image already present locally; skipping pull", "image", img)continue}+err := func() error {pullCtx, pullCancel := timeouts.WithTimeout(ctx, settings.DockerImagePullTimeout.AsInt(), timeouts.DefaultDockerImagePull)defer pullCancel()@@ -1051,7 +1126,7 @@ func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectif errors.Is(pullCtx.Err(), context.DeadlineExceeded) {return fmt.Errorf("image pull timed out for %s (increase DOCKER_IMAGE_PULL_TIMEOUT or setting)", img)}- return fmt.Errorf("failed to pull missing image %s: %w", img, err)+ return fmt.Errorf("failed to pull image %s: %w", img, err)}return nil}()diff --git a/backend/internal/services/project_service_test.go b/backend/internal/services/project_service_test.goindex 5e9dfbdce..28bbcbc59 100644--- a/backend/internal/services/project_service_test.go+++ b/backend/internal/services/project_service_test.go@@ -5,6 +5,7 @@ import ("testing""time"+ composetypes "github.com/compose-spec/compose-go/v2/types""github.com/docker/docker/api/types/container"glsqlite "github.com/glebarez/sqlite""github.com/stretchr/testify/assert"@@ -252,3 +253,84 @@ func TestProjectService_NormalizeComposeProjectName(t *testing.T) {})}}++func TestResolveServiceImagePullMode(t *testing.T) {+ tests := []struct {+ name string+ service composetypes.ServiceConfig+ expected imagePullMode+ }{+ {+ name: "default policy is missing",+ service: composetypes.ServiceConfig{},+ expected: imagePullModeIfMissing,+ },+ {+ name: "always policy",+ service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyAlways},+ expected: imagePullModeAlways,+ },+ {+ name: "refresh policy",+ service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyRefresh},+ expected: imagePullModeAlways,+ },+ {+ name: "missing policy",+ service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyMissing},+ expected: imagePullModeIfMissing,+ },+ {+ name: "if not present policy",+ service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyIfNotPresent},+ expected: imagePullModeIfMissing,+ },+ {+ name: "never policy",+ service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyNever},+ expected: imagePullModeNever,+ },+ {+ name: "invalid policy defaults to missing behavior",+ service: composetypes.ServiceConfig{PullPolicy: "definitely_invalid"},+ expected: imagePullModeIfMissing,+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ assert.Equal(t, tt.expected, resolveServiceImagePullMode(tt.service))+ })+ }+}++func TestBuildProjectImagePullPlan(t *testing.T) {+ services := composetypes.Services{+ "web": {+ Name: "web",+ Image: "redis:latest",+ PullPolicy: composetypes.PullPolicyIfNotPresent,+ },+ "worker": {+ Name: "worker",+ Image: "redis:latest",+ PullPolicy: composetypes.PullPolicyAlways,+ },+ "api": {+ Name: "api",+ Image: "nginx:latest",+ PullPolicy: composetypes.PullPolicyNever,+ },+ "empty-image": {+ Name: "empty-image",+ Image: "",+ PullPolicy: composetypes.PullPolicyAlways,+ },+ }++ plan := buildProjectImagePullPlan(services)++ assert.Len(t, plan, 2)+ assert.Equal(t, imagePullModeAlways, plan["redis:latest"])+ assert.Equal(t, imagePullModeNever, plan["nginx:latest"])+}diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelteindex 579ca53fd..f0fc4d429 100644--- a/frontend/src/lib/components/action-buttons.svelte+++ b/frontend/src/lib/components/action-buttons.svelte@@ -329,150 +329,149 @@openedPopover = true;try {- const { pulled } = await projectService.deployProjectMaybePull(- id,- (data) => {- if (!data) return;+ await projectService.deployProject(id, (deployData) => {+ if (!deployData) return;- // Pull progress can still update the same popover.- if (isDownloadingLine(data)) {+ // Pull progress lines are streamed by backend /up before deploy when+ // image policy requires pulling (missing/always/refresh).+ if (deployData.type !== 'deploy') {+ if (isDownloadingLine(deployData)) {pullStatusText = m.images_pull_initiating();}- if (data.error) {- const errMsg = typeof data.error === 'string' ? data.error : data.error.message || m.images_pull_stream_error();+ if (deployData.error) {+ const errMsg =+ typeof deployData.error === 'string' ? deployData.error : deployData.error.message || m.images_pull_stream_error();pullError = errMsg;pullStatusText = m.images_pull_failed_with_error({ error: errMsg });hadError = true;+ deployPulling = false;return;}- if (data.status) pullStatusText = data.status;+ if (deployData.status) pullStatusText = deployData.status;- if (data.id) {- const currentLayer = layerProgress[data.id] || { current: 0, total: 0, status: '' };- currentLayer.status = data.status || currentLayer.status;- if (data.progressDetail) {- const { current, total } = data.progressDetail;+ if (deployData.id) {+ const currentLayer = layerProgress[deployData.id] || { current: 0, total: 0, status: '' };+ currentLayer.status = deployData.status || currentLayer.status;+ if (deployData.progressDetail) {+ const { current, total } = deployData.progressDetail;if (typeof current === 'number') currentLayer.current = current;if (typeof total === 'number') currentLayer.total = total;}- layerProgress[data.id] = currentLayer;+ layerProgress[deployData.id] = currentLayer;}updatePullProgress();- },- (deployData) => {- // Handle deploy streaming - health check progress- if (!deployData) return;-- // First deploy status line: switch UI from pull -> deploy.- if (!deployPhaseStarted) {- deployPhaseStarted = true;- pullProgress = 0;- layerProgress = {};- pullError = '';- deployServiceProgress = {};- deployLastNonWaitingStatus = '';- }+ return;+ }++ // First deploy status line initializes deploy-only progress state.+ if (!deployPhaseStarted) {+ deployPhaseStarted = true;+ pullProgress = 0;+ layerProgress = {};+ pullError = '';+ deployServiceProgress = {};+ deployLastNonWaitingStatus = '';+ }- // Keep the popover in "loading" state during deployment.- deployPulling = true;- if (deployData.type === 'deploy') {- switch (deployData.phase) {- case 'begin':- pullStatusText = m.progress_deploy_starting();- break;- case 'service_waiting_healthy': {+ // Keep the popover in "loading" state during deployment.+ deployPulling = true;+ if (deployData.type === 'deploy') {+ switch (deployData.phase) {+ case 'begin':+ pullStatusText = m.progress_deploy_starting();+ break;+ case 'service_waiting_healthy': {+ const service = String(deployData.service ?? '').trim();+ if (service) {+ deployServiceProgress[service] = {+ phase: 'service_waiting_healthy',+ health: String(deployData.health ?? '')+ };+ pullStatusText = deriveDeployStatusText();+ }+ break;+ }+ case 'service_healthy':+ {const service = String(deployData.service ?? '').trim();if (service) {deployServiceProgress[service] = {- phase: 'service_waiting_healthy',- health: String(deployData.health ?? '')+ phase: 'service_healthy',+ health: String(deployData.health ?? ''),+ state: String(deployData.state ?? ''),+ status: String(deployData.status ?? '')};+ deployLastNonWaitingStatus = m.progress_deploy_service_healthy({ service });pullStatusText = deriveDeployStatusText();}- break;}- case 'service_healthy':- {- const service = String(deployData.service ?? '').trim();- if (service) {- deployServiceProgress[service] = {- phase: 'service_healthy',- health: String(deployData.health ?? ''),- state: String(deployData.state ?? ''),- status: String(deployData.status ?? '')- };- deployLastNonWaitingStatus = m.progress_deploy_service_healthy({ service });- pullStatusText = deriveDeployStatusText();- }- }- break;- case 'service_state':- {- const service = String(deployData.service ?? '').trim();- if (service) {- deployServiceProgress[service] = {- phase: 'service_state',- state: String(deployData.state ?? ''),- health: String(deployData.health ?? ''),- status: String(deployData.status ?? '')- };- deployLastNonWaitingStatus = m.progress_deploy_service_state({- service,- state: String(deployData.state ?? '')- });- pullStatusText = deriveDeployStatusText();- }+ break;+ case 'service_state':+ {+ const service = String(deployData.service ?? '').trim();+ if (service) {+ deployServiceProgress[service] = {+ phase: 'service_state',+ state: String(deployData.state ?? ''),+ health: String(deployData.health ?? ''),+ status: String(deployData.status ?? '')+ };+ deployLastNonWaitingStatus = m.progress_deploy_service_state({+ service,+ state: String(deployData.state ?? '')+ });+ pullStatusText = deriveDeployStatusText();}- break;- case 'service_status':- {- const service = String(deployData.service ?? '').trim();- if (service) {- deployServiceProgress[service] = {- phase: 'service_status',- status: String(deployData.status ?? ''),- state: String(deployData.state ?? ''),- health: String(deployData.health ?? '')- };- deployLastNonWaitingStatus = m.progress_deploy_service_status({- service,- status: String(deployData.status ?? '')- });- pullStatusText = deriveDeployStatusText();- }+ }+ break;+ case 'service_status':+ {+ const service = String(deployData.service ?? '').trim();+ if (service) {+ deployServiceProgress[service] = {+ phase: 'service_status',+ status: String(deployData.status ?? ''),+ state: String(deployData.state ?? ''),+ health: String(deployData.health ?? '')+ };+ deployLastNonWaitingStatus = m.progress_deploy_service_status({+ service,+ status: String(deployData.status ?? '')+ });+ pullStatusText = deriveDeployStatusText();}- break;- case 'complete':- pullStatusText = m.progress_deploy_completed();- break;- default:- break;- }- } else if (deployData.status) {- // fallback for unexpected payloads- pullStatusText = String(deployData.status);+ }+ break;+ case 'complete':+ pullStatusText = m.progress_deploy_completed();+ break;+ default:+ break;}+ } else if (deployData.status) {+ // fallback for unexpected payloads+ pullStatusText = String(deployData.status);+ }- if (deployData.error) {- const errMsg =- typeof deployData.error === 'string' ? deployData.error : deployData.error.message || m.progress_deploy_failed();- pullError = errMsg;- pullStatusText = m.progress_deploy_failed_with_error({ error: errMsg });- hadError = true;- deployPulling = false;- return;- }+ if (deployData.error) {+ const errMsg =+ typeof deployData.error === 'string' ? deployData.error : deployData.error.message || m.progress_deploy_failed();+ pullError = errMsg;+ pullStatusText = m.progress_deploy_failed_with_error({ error: errMsg });+ hadError = true;+ deployPulling = false;+ return;+ }- // If we got "complete", stop the loading state- if (deployData.type === 'deploy' && deployData.phase === 'complete') {- deployPulling = false;- pullProgress = 100;- }+ // If we got "complete", stop the loading state+ if (deployData.type === 'deploy' && deployData.phase === 'complete') {+ deployPulling = false;+ pullProgress = 100;}- );+ });if (hadError) throw new Error(pullError || m.progress_deploy_failed());diff --git a/frontend/src/lib/services/project-service.ts b/frontend/src/lib/services/project-service.tsindex 530fdb784..8cb08eb54 100644--- a/frontend/src/lib/services/project-service.ts+++ b/frontend/src/lib/services/project-service.ts@@ -138,19 +138,7 @@ export class ProjectService extends BaseAPIService {return this.handleResponse(this.api.post(`/environments/${envId}/projects/${projectName}/redeploy`));}- private isDownloadingStatus(status?: string): boolean {- if (!status) return false;- const s = status.toLowerCase();- return (- s.includes('downloading') ||- s.includes('extracting') ||- s.includes('pull complete') ||- s.includes('download complete') ||- s.includes('pulling fs layer')- );- }-- private async streamProjectPull(projectId: string, onLine?: (data: any) => void): Promise<boolean> {+ private async streamProjectPull(projectId: string, onLine?: (data: any) => void): Promise<void> {const envId = await environmentStore.getCurrentEnvironmentId();const url = `/api/environments/${envId}/projects/${projectId}/pull`;@@ -162,7 +150,6 @@ export class ProjectService extends BaseAPIService {const reader = res.body.getReader();const decoder = new TextDecoder();let buffer = '';- let pulled = false;while (true) {const { value, done } = await reader.read();@@ -177,23 +164,12 @@ export class ProjectService extends BaseAPIService {if (!trimmed) continue;try {const obj = JSON.parse(trimmed);-- // Detect if any actual download happened- if (!pulled) {- const status = obj?.status as string | undefined;- const total = obj?.progressDetail?.total as number | undefined;- if (this.isDownloadingStatus(status) || (typeof total === 'number' && total > 0)) {- pulled = true;- }- }-onLine?.(obj);} catch {// ignore malformed line}}}- return pulled;}pullProjectImages(projectId: string): Promise<void>;@@ -202,16 +178,6 @@ export class ProjectService extends BaseAPIService {await this.streamProjectPull(projectId, onLine);}- async deployProjectMaybePull(- projectId: string,- onPullLine?: (data: any) => void,- onDeployLine?: (data: any) => void- ): Promise<{ pulled: boolean; project: Project }> {- const pulled = await this.streamProjectPull(projectId, onPullLine);- const project = onDeployLine ? await this.deployProject(projectId, onDeployLine) : await this.deployProject(projectId);- return { pulled, project };- }-async destroyProject(projectName: string, removeVolumes = false, removeFiles = false): Promise<void> {const envId = await environmentStore.getCurrentEnvironmentId();await this.handleResponse(diff --git a/tests/spec/project.spec.ts b/tests/spec/project.spec.tsindex e32663397..290c99d66 100644--- a/tests/spec/project.spec.ts+++ b/tests/spec/project.spec.ts@@ -1,17 +1,17 @@-import { test, expect, type Page } from '@playwright/test';-import { fetchProjectCountsWithRetry, fetchProjectsWithRetry } from '../utils/fetch.util';-import { Project, ProjectStatusCounts } from 'types/project.type';-import { TEST_COMPOSE_YAML, TEST_ENV_FILE } from '../setup/project.data';+import { test, expect, type Page } from "@playwright/test";+import { fetchProjectCountsWithRetry, fetchProjectsWithRetry } from "../utils/fetch.util";+import { Project, ProjectStatusCounts } from "types/project.type";+import { TEST_COMPOSE_YAML, TEST_ENV_FILE } from "../setup/project.data";const ROUTES = {- page: '/projects',- apiProjects: '/api/environments/0/projects',- newProject: '/projects/new',+ page: "/projects",+ apiProjects: "/api/environments/0/projects",+ newProject: "/projects/new",};async function navigateToProjects(page: Page) {await page.goto(ROUTES.page);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");}let realProjects: Project[] = [];@@ -28,76 +28,81 @@ test.beforeEach(async ({ page }) => {}});-test.describe('Projects Page', () => {- test('should display the main heading and description', async ({ page }) => {- await expect(page.getByRole('heading', { name: 'Projects', level: 1 })).toBeVisible();- await expect(page.getByText('View and Manage Compose Projects')).toBeVisible();+test.describe("Projects Page", () => {+ test("should display the main heading and description", async ({ page }) => {+ await expect(page.getByRole("heading", { name: "Projects", level: 1 })).toBeVisible();+ await expect(page.getByText("View and Manage Compose Projects")).toBeVisible();});- test('should display summary cards with correct counts', async ({ page }) => {+ test("should display summary cards with correct counts", async ({ page }) => {await expect(page.getByText(`${projectCounts.totalProjects} Total Projects`, { exact: true })).toBeVisible();await expect(page.getByText(`${projectCounts.runningProjects} Running`, { exact: true })).toBeVisible();await expect(page.getByText(`${projectCounts.stoppedProjects} Stopped`, { exact: true })).toBeVisible();});- test('should display projects list', async ({ page }) => {- await expect(page.locator('table')).toBeVisible();+ test("should display projects list", async ({ page }) => {+ await expect(page.locator("table")).toBeVisible();});- test('should show project actions menu', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for actions menu test');+ test("should show project actions menu", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for actions menu test");- await page.waitForLoadState('networkidle');- const firstRow = page.locator('tbody tr').first();- const menuButton = firstRow.getByRole('button', { name: 'Open menu' });+ await page.waitForLoadState("networkidle");+ const firstRow = page.locator("tbody tr").first();+ const menuButton = firstRow.getByRole("button", { name: "Open menu" });await expect(menuButton).toBeVisible();await menuButton.click();- await expect(page.getByRole('menuitem', { name: 'Edit' })).toBeVisible();+ await expect(page.getByRole("menuitem", { name: "Edit" })).toBeVisible();// Check for at least one of the state action buttons (Up/Down/Restart)- const upItem = page.getByRole('menuitem', { name: 'Up', exact: true });- const downItem = page.getByRole('menuitem', { name: 'Down', exact: true });- const restartItem = page.getByRole('menuitem', { name: 'Restart', exact: true });+ const upItem = page.getByRole("menuitem", { name: "Up", exact: true });+ const downItem = page.getByRole("menuitem", { name: "Down", exact: true });+ const restartItem = page.getByRole("menuitem", { name: "Restart", exact: true });const hasStateAction = (await upItem.count()) > 0 || (await downItem.count()) > 0 || (await restartItem.count()) > 0;expect(hasStateAction).toBe(true);- await expect(page.getByRole('menuitem', { name: 'Pull & Redeploy' })).toBeVisible();- await expect(page.getByRole('menuitem', { name: 'Destroy' })).toBeVisible();+ await expect(page.getByRole("menuitem", { name: "Pull & Redeploy" })).toBeVisible();+ await expect(page.getByRole("menuitem", { name: "Destroy" })).toBeVisible();});- test('should navigate to project details when project name is clicked', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for navigation test');+ test("should navigate to project details when project name is clicked", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for navigation test");- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Get the first project link that points to /projects/ (not the "Git" indicator link)- const firstProjectLink = page.locator('tbody tr').first().getByRole('link').filter({ hasText: /^(?!Git$)/ }).first();+ const firstProjectLink = page+ .locator("tbody tr")+ .first()+ .getByRole("link")+ .filter({ hasText: /^(?!Git$)/ })+ .first();const projectName = await firstProjectLink.textContent();await firstProjectLink.click();await expect(page).toHaveURL(/\/projects\/.+/);- await expect(page.getByRole('button', { name: new RegExp(`${projectName}`) })).toBeVisible();+ await expect(page.getByRole("button", { name: new RegExp(`${projectName}`) })).toBeVisible();});- test('should allow searching/filtering projects', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for search test');+ test("should allow searching/filtering projects", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for search test");- const searchInput = page.getByPlaceholder('Search…');+ const searchInput = page.getByPlaceholder("Search…");await expect(searchInput).toBeVisible();const firstProject = realProjects[0];if (firstProject?.name) {await searchInput.fill(firstProject.name);- await expect(page.getByRole('link', { name: firstProject.name })).toBeVisible();+ await expect(page.getByRole("link", { name: firstProject.name })).toBeVisible();await searchInput.clear();}});- test('should display project status badges', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for status badge test');+ test("should display project status badges", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for status badge test");- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const runningProjects = realProjects.filter((p) => p.status === 'running');- const stoppedProjects = realProjects.filter((p) => p.status === 'stopped');+ const runningProjects = realProjects.filter((p) => p.status === "running");+ const stoppedProjects = realProjects.filter((p) => p.status === "stopped");if (runningProjects.length > 0) {await expect(page.locator('text="Running"').first()).toBeVisible();@@ -109,68 +114,71 @@ test.describe('Projects Page', () => {});});-test.describe('New Compose Project Page', () => {+test.describe("New Compose Project Page", () => {test.beforeEach(async ({ page }) => {await page.goto(ROUTES.newProject);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");});- test('should display the create project form', async ({ page }) => {- await expect(page.getByRole('button', { name: 'My New Project' })).toBeVisible();- await expect(page.getByRole('heading', { name: 'Docker Compose File' })).toBeVisible();- await expect(page.getByRole('heading', { name: 'Environment (.env)' })).toBeVisible();+ test("should display the create project form", async ({ page }) => {+ await expect(page.getByRole("button", { name: "My New Project" })).toBeVisible();+ await expect(page.getByRole("heading", { name: "Docker Compose File" })).toBeVisible();+ await expect(page.getByRole("heading", { name: "Environment (.env)" })).toBeVisible();});- test('should validate required fields', async ({ page }) => {- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');+ test("should validate required fields", async ({ page }) => {+ const createButton = page.getByRole("button", { name: "Create Project" }).locator('[data-slot="arcane-button"]');await expect(createButton).toBeDisabled();- await page.getByRole('button', { name: 'My New Project' }).click();- await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill("test-project");+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");});- test('should enable Create Project after entering a valid name', async ({ page }) => {+ test("should enable Create Project after entering a valid name", async ({ page }) => {const observedErrors: string[] = [];- page.on('pageerror', (err) => observedErrors.push(String(err?.message ?? err)));- page.on('console', (msg) => {- if (msg.type() === 'error') observedErrors.push(msg.text());+ page.on("pageerror", (err) => observedErrors.push(String(err?.message ?? err)));+ page.on("console", (msg) => {+ if (msg.type() === "error") observedErrors.push(msg.text());});- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');+ const createButton = page.getByRole("button", { name: "Create Project" }).locator('[data-slot="arcane-button"]');await expect(createButton).toBeVisible();// Open the inline name editor and set a valid name.- await page.getByRole('button', { name: 'My New Project' }).click();- await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill("test-project");+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");// The button should become enabled once name + compose content are present.await expect(createButton).toBeEnabled();- const stateUnsafe = observedErrors.filter((e) => e.includes('state_unsafe_mutation'));- expect(stateUnsafe, `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join('\n')}`).toHaveLength(0);+ const stateUnsafe = observedErrors.filter((e) => e.includes("state_unsafe_mutation"));+ expect(stateUnsafe, `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join("\n")}`).toHaveLength(0);});- test('should create a new project successfully', async ({ page }) => {+ test("should create a new project successfully", async ({ page }) => {const projectName = `test-project-${Date.now()}`;+ const containerName = `test-redis-container-${Date.now()}`;+ const envFile = TEST_ENV_FILE.replace(/CONTAINER_NAME=.*/m, `CONTAINER_NAME=${containerName}`);let createdProjectId: string | null = null;+ let projectPullRequestCount = 0;- await page.getByRole('button', { name: 'My New Project' }).click();- await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill(projectName);+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");- const composeEditor = page.locator('.monaco-editor').first();+ const composeEditor = page.locator(".monaco-editor").first();await expect(composeEditor).toBeVisible();// Wait for Monaco to actually render its view before attempting input.- await expect(composeEditor.locator('.view-line').first()).toBeVisible();+ await expect(composeEditor.locator(".view-line").first()).toBeVisible();// Monaco may create the internal input textarea lazily (e.g. only after focus).// Click first, then wait for textarea.inputarea to appear.await composeEditor.click({ position: { x: 20, y: 20 } });- await expect(composeEditor.locator('textarea')).toHaveCount(1);+ await expect(composeEditor.locator("textarea")).toHaveCount(1);// Use page.evaluate to set the value directly in Monaco to avoid auto-indentation issues during typingawait page.evaluate(@@ -180,19 +188,19 @@ test.describe('New Compose Project Page', () => {if (!model) throw new Error(`No ${lang} model found`);model.setValue(text);},- { text: TEST_COMPOSE_YAML, lang: 'yaml' },+ { text: TEST_COMPOSE_YAML, lang: "yaml" },);// Basic sanity check that the new content rendered.- await expect(composeEditor.locator('.view-lines')).toContainText(/redis/i);+ await expect(composeEditor.locator(".view-lines")).toContainText(/redis/i);- const envEditor = page.locator('.monaco-editor').nth(1);+ const envEditor = page.locator(".monaco-editor").nth(1);await expect(envEditor).toBeVisible();- await expect(envEditor.locator('.view-line').first()).toBeVisible();+ await expect(envEditor.locator(".view-line").first()).toBeVisible();await envEditor.click({ position: { x: 20, y: 20 } });- await expect(envEditor.locator('textarea')).toHaveCount(1);+ await expect(envEditor.locator("textarea")).toHaveCount(1);// Use page.evaluate to set the value directly in Monacoawait page.evaluate(@@ -202,13 +210,13 @@ test.describe('New Compose Project Page', () => {if (!model) throw new Error(`No ${lang} model found`);model.setValue(text);},- { text: TEST_ENV_FILE, lang: 'ini' },+ { text: envFile, lang: "ini" },);- await expect(envEditor.locator('.view-lines')).toContainText(/redis/i);+ await expect(envEditor.locator(".view-lines")).toContainText(/redis/i);- await page.route('/api/environments/*/projects', async (route) => {- if (route.request().method() === 'POST') {+ await page.route("/api/environments/*/projects", async (route) => {+ if (route.request().method() === "POST") {const response = await route.fetch();const responseBody = await response.text();@@ -229,7 +237,7 @@ test.describe('New Compose Project Page', () => {}});- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');+ const createButton = page.getByRole("button", { name: "Create Project" }).locator('[data-slot="arcane-button"]');await createButton.click();await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });@@ -240,34 +248,40 @@ test.describe('New Compose Project Page', () => {await expect(page).toHaveURL(new RegExp(`/projects/[a-f0-9\\-]{36}`));}- await expect(page.getByRole('button', { name: projectName })).toBeVisible();+ await expect(page.getByRole("button", { name: projectName })).toBeVisible();- await page.getByRole('tab', { name: 'Services' }).click();- await page.waitForLoadState('networkidle');+ await page.getByRole("tab", { name: "Services" }).click();+ await page.waitForLoadState("networkidle");- const serviceNameWhenStopped = page.getByRole('table').getByText('redis', { exact: true });+ const serviceNameWhenStopped = page.getByRole("table").getByText("redis", { exact: true });await expect(serviceNameWhenStopped).toBeVisible();- const deployButton = page.getByRole('button', { name: 'Up', exact: true }).filter({ hasText: 'Up' }).last();+ await page.route("**/api/environments/*/projects/*/pull", async (route) => {+ projectPullRequestCount += 1;+ await route.continue();+ });++ const deployButton = page.getByRole("button", { name: "Up", exact: true }).filter({ hasText: "Up" }).last();await deployButton.click();await page.waitForTimeout(5000);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- await expect(page.getByRole('link', { name: 'test-redis-container' })).toBeVisible();+ expect(projectPullRequestCount).toBe(0);+ await expect(page.getByRole("link", { name: containerName })).toBeVisible({ timeout: 20000 });});- test('should destroy the project and remove files from disk', async ({ page }) => {+ test("should destroy the project and remove files from disk", async ({ page }) => {const projectName = `test-destroy-${Date.now()}`;// 1. Create the project first- await page.getByRole('button', { name: 'My New Project' }).click();- await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill(projectName);+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");- const composeEditor = page.locator('.monaco-editor').first();+ const composeEditor = page.locator(".monaco-editor").first();await expect(composeEditor).toBeVisible();- await expect(composeEditor.locator('.view-line').first()).toBeVisible();+ await expect(composeEditor.locator(".view-line").first()).toBeVisible();await composeEditor.click({ position: { x: 20, y: 20 } });await page.evaluate(@@ -277,22 +291,22 @@ test.describe('New Compose Project Page', () => {if (!model) throw new Error(`No ${lang} model found`);model.setValue(text);},- { text: TEST_COMPOSE_YAML, lang: 'yaml' },+ { text: TEST_COMPOSE_YAML, lang: "yaml" },);- const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' });+ const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" });await createButton.click();await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });- await expect(page.getByRole('button', { name: projectName })).toBeVisible();+ await expect(page.getByRole("button", { name: projectName })).toBeVisible();// 2. Destroy the project- const destroyButton = page.getByRole('button', { name: 'Destroy', exact: true });+ const destroyButton = page.getByRole("button", { name: "Destroy", exact: true });await expect(destroyButton).toBeVisible();await destroyButton.click();// 3. Handle the confirmation dialog- const dialog = page.getByRole('dialog');+ const dialog = page.getByRole("dialog");await expect(dialog).toBeVisible();// Check "Remove project files"@@ -300,82 +314,82 @@ test.describe('New Compose Project Page', () => {await removeFilesCheckbox.check();// Click "Destroy" in the dialog- const confirmDestroyButton = dialog.getByRole('button', { name: 'Destroy', exact: true });+ const confirmDestroyButton = dialog.getByRole("button", { name: "Destroy", exact: true });await confirmDestroyButton.click();// 4. Verify redirection and project removalawait page.waitForURL(ROUTES.page, { timeout: 10000 });- await expect(page.getByRole('link', { name: projectName })).not.toBeVisible();+ await expect(page.getByRole("link", { name: projectName })).not.toBeVisible();});});-test.describe('GitOps Managed Project', () => {- test('should show read-only alert when project is GitOps managed', async ({ page }) => {+test.describe("GitOps Managed Project", () => {+ test("should show read-only alert when project is GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);- test.skip(!gitOpsProject, 'No GitOps-managed projects found');+ test.skip(!gitOpsProject, "No GitOps-managed projects found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Navigate to Configuration tab- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Verify the GitOps read-only alert is visible (title contains "Git" and "Read-only")- await expect(page.getByText('Git Read-only')).toBeVisible();+ await expect(page.getByText("Git Read-only")).toBeVisible();await expect(page.getByText(/managed by Git/i)).toBeVisible();});- test('should display Sync from Git button when GitOps managed', async ({ page }) => {+ test("should display Sync from Git button when GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);- test.skip(!gitOpsProject, 'No GitOps-managed projects found');+ test.skip(!gitOpsProject, "No GitOps-managed projects found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Verify the Sync from Git button is present- await expect(page.getByRole('button', { name: 'Sync from Git' })).toBeVisible();+ await expect(page.getByRole("button", { name: "Sync from Git" })).toBeVisible();});- test('should show last sync commit when GitOps managed', async ({ page }) => {+ test("should show last sync commit when GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy && p.lastSyncCommit);- test.skip(!gitOpsProject, 'No GitOps-managed projects with sync commit found');+ test.skip(!gitOpsProject, "No GitOps-managed projects with sync commit found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// The commit hash should be visible somewhere on the pageconst commitHash = gitOpsProject!.lastSyncCommit!.substring(0, 7);await expect(page.getByText(new RegExp(commitHash))).toBeVisible();});- test('should disable name editing when GitOps managed', async ({ page }) => {+ test("should disable name editing when GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);- test.skip(!gitOpsProject, 'No GitOps-managed projects found');+ test.skip(!gitOpsProject, "No GitOps-managed projects found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// The name button should be disabled for GitOps-managed projects- const nameButton = page.getByRole('button', { name: gitOpsProject!.name });+ const nameButton = page.getByRole("button", { name: gitOpsProject!.name });await expect(nameButton).toBeDisabled();});- test('should have compose editor in read-only mode when GitOps managed', async ({ page }) => {+ test("should have compose editor in read-only mode when GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);- test.skip(!gitOpsProject, 'No GitOps-managed projects found');+ test.skip(!gitOpsProject, "No GitOps-managed projects found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Wait for Monaco editor to loadawait page.waitForTimeout(1000);@@ -386,7 +400,7 @@ test.describe('GitOps Managed Project', () => {// Find the YAML editor (compose file)const yamlEditor = editors.find((e: any) => {const model = e.getModel();- return model && model.getLanguageId() === 'yaml';+ return model && model.getLanguageId() === "yaml";});if (yamlEditor) {return yamlEditor.getOption((window as any).monaco.editor.EditorOption.readOnly);@@ -397,16 +411,16 @@ test.describe('GitOps Managed Project', () => {expect(isReadOnly).toBe(true);});- test('should have env editor in read-only mode when GitOps managed', async ({ page }) => {+ test("should have env editor in read-only mode when GitOps managed", async ({ page }) => {const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);- test.skip(!gitOpsProject, 'No GitOps-managed projects found');+ test.skip(!gitOpsProject, "No GitOps-managed projects found");await page.goto(`/projects/${gitOpsProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Wait for Monaco editor to loadawait page.waitForTimeout(1000);@@ -417,7 +431,7 @@ test.describe('GitOps Managed Project', () => {// Find the env/ini editorconst envEditor = editors.find((e: any) => {const model = e.getModel();- return model && model.getLanguageId() === 'ini';+ return model && model.getLanguageId() === "ini";});if (envEditor) {return envEditor.getOption((window as any).monaco.editor.EditorOption.readOnly);@@ -428,88 +442,88 @@ test.describe('GitOps Managed Project', () => {expect(isReadOnly).toBe(true);});- test('should allow editing for non-GitOps managed projects', async ({ page }) => {- const regularProject = realProjects.find((p) => !p.gitOpsManagedBy && p.status === 'stopped');- test.skip(!regularProject, 'No regular (non-GitOps) stopped projects found');+ test("should allow editing for non-GitOps managed projects", async ({ page }) => {+ const regularProject = realProjects.find((p) => !p.gitOpsManagedBy && p.status === "stopped");+ test.skip(!regularProject, "No regular (non-GitOps) stopped projects found");await page.goto(`/projects/${regularProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// The name button should be enabled for regular projects that are stopped- const nameButton = page.getByRole('button', { name: regularProject!.name });+ const nameButton = page.getByRole("button", { name: regularProject!.name });await expect(nameButton).toBeEnabled();// Navigate to Configuration tab- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// GitOps alert should NOT be visible- await expect(page.getByText('Git Read-only')).not.toBeVisible();+ await expect(page.getByText("Git Read-only")).not.toBeVisible();// Sync from Git button should NOT be visible- await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();+ await expect(page.getByRole("button", { name: "Sync from Git" })).not.toBeVisible();});- test('should not show GitOps alert on Configuration tab for regular projects', async ({ page }) => {+ test("should not show GitOps alert on Configuration tab for regular projects", async ({ page }) => {const regularProject = realProjects.find((p) => !p.gitOpsManagedBy);- test.skip(!regularProject, 'No regular (non-GitOps) projects found');+ test.skip(!regularProject, "No regular (non-GitOps) projects found");await page.goto(`/projects/${regularProject!.id}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");// Verify no GitOps-related UI elementsawait expect(page.getByText(/managed by Git\./i)).not.toBeVisible();- await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();+ await expect(page.getByRole("button", { name: "Sync from Git" })).not.toBeVisible();});});-test.describe('Project Detail Page', () => {- test('should display project details for existing project', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for detail page test');+test.describe("Project Detail Page", () => {+ test("should display project details for existing project", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for detail page test");const firstProject = realProjects[0];await page.goto(`/projects/${firstProject.id || firstProject.name}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- await expect(page.getByRole('button', { name: firstProject.name, exact: false })).toBeVisible();+ await expect(page.getByRole("button", { name: firstProject.name, exact: false })).toBeVisible();- await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();- await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();- await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Services/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Configuration|Config/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Logs/i })).toBeVisible();});- test('should display tabs navigation', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for navigation test');+ test("should display tabs navigation", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for navigation test");const firstProject = realProjects[0];await page.goto(`/projects/${firstProject.id || firstProject.name}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();- await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();- await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Services/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Configuration|Config/i })).toBeVisible();+ await expect(page.getByRole("tab", { name: /Logs/i })).toBeVisible();});- test('should display services tab content', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for services test');+ test("should display services tab content", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for services test");const projectWithServices = realProjects.find((p) => p.serviceCount > 0) || realProjects[0];await page.goto(`/projects/${projectWithServices.id || projectWithServices.name}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- await page.getByRole('tab', { name: /Services/i }).click();+ await page.getByRole("tab", { name: /Services/i }).click();- const nginxService = page.getByRole('heading', { name: /nginx/i });+ const nginxService = page.getByRole("heading", { name: /nginx/i });const emptyState = page.getByText(/No services found/i);if ((await nginxService.count()) > 0) {await expect(nginxService.first()).toBeVisible();} else {- const anyServiceBadge = page.locator('text=/running|stopped|unknown/i').first();+ const anyServiceBadge = page.locator("text=/running|stopped|unknown/i").first();if ((await anyServiceBadge.count()) > 0) {await expect(anyServiceBadge).toBeVisible();} else {@@ -518,79 +532,79 @@ test.describe('Project Detail Page', () => {}});- test('should display configuration editors', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for configuration test');+ test("should display configuration editors", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for configuration test");const firstProject = realProjects[0];await page.goto(`/projects/${firstProject.id || firstProject.name}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });+ const configTab = page.getByRole("tab", { name: /Configuration|Config/i });await configTab.click();// The project config editor supports two layouts:// - classic (default): side-by-side compose.yaml + .env panels// - tree view: file list on the left and a single code panel on the right- await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();+ await expect(page.getByRole("heading", { name: "compose.yaml" })).toBeVisible();- const projectFilesHeading = page.getByRole('heading', { name: /Project Files/i });+ const projectFilesHeading = page.getByRole("heading", { name: /Project Files/i });const isTreeView = await projectFilesHeading.isVisible();if (isTreeView) {- const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();- const envFileButton = page.getByRole('button', { name: '.env' }).first();+ const composeFileButton = page.getByRole("button", { name: "compose.yaml" }).first();+ const envFileButton = page.getByRole("button", { name: ".env" }).first();await expect(composeFileButton).toBeVisible();await expect(envFileButton).toBeVisible();// Switching files should update the visible code panel titleawait envFileButton.click();- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();+ await expect(page.getByRole("heading", { name: ".env" })).toBeVisible();await composeFileButton.click();- await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();+ await expect(page.getByRole("heading", { name: "compose.yaml" })).toBeVisible();- const includesFolder = page.getByRole('button', { name: 'Includes' });+ const includesFolder = page.getByRole("button", { name: "Includes" });if (await includesFolder.count()) {await expect(includesFolder.first()).toBeVisible();}} else {// Classic layout renders both editors at the same time.- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();+ await expect(page.getByRole("heading", { name: ".env" })).toBeVisible();// Also validate that we can switch to tree view and see the file list.- const layoutSwitch = page.getByRole('switch', { name: /Classic|Tree View/i });+ const layoutSwitch = page.getByRole("switch", { name: /Classic|Tree View/i });if (await layoutSwitch.count()) {await layoutSwitch.click();await expect(projectFilesHeading).toBeVisible();- const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();- const envFileButton = page.getByRole('button', { name: '.env' }).first();+ const composeFileButton = page.getByRole("button", { name: "compose.yaml" }).first();+ const envFileButton = page.getByRole("button", { name: ".env" }).first();await expect(composeFileButton).toBeVisible();await expect(envFileButton).toBeVisible();await envFileButton.click();- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();+ await expect(page.getByRole("heading", { name: ".env" })).toBeVisible();}}});- test('should show logs tab for running projects', async ({ page }) => {- test.skip(!realProjects.length, 'No projects available for logs test');+ test("should show logs tab for running projects", async ({ page }) => {+ test.skip(!realProjects.length, "No projects available for logs test");- const runningProject = realProjects.find((p) => p.status === 'running');- test.skip(!runningProject, 'No running projects found for logs test');+ const runningProject = realProjects.find((p) => p.status === "running");+ test.skip(!runningProject, "No running projects found for logs test");await page.goto(`/projects/${runningProject.id || runningProject.name}`);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");- const logsTab = page.getByRole('tab', { name: /Logs/i });+ const logsTab = page.getByRole("tab", { name: /Logs/i });await expect(logsTab).toBeEnabled();await logsTab.click();- await expect(page.getByRole('heading', { name: 'Project Logs' })).toBeVisible();- await expect(page.getByRole('button', { name: 'Start', exact: true })).toBeVisible();- await expect(page.getByRole('button', { name: 'Clear', exact: true })).toBeVisible();+ await expect(page.getByRole("heading", { name: "Project Logs" })).toBeVisible();+ await expect(page.getByRole("button", { name: "Start", exact: true })).toBeVisible();+ await expect(page.getByRole("button", { name: "Clear", exact: true })).toBeVisible();});});