Streamline status page tests - #462
Conversation
Consolidate overlapping page and render-hook coverage while retaining the stable theme selector contract. Assert user-visible behavior and accessibility semantics without coupling tests to serialized markup.
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea4e4584ef
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $viewData = app(Cachet::class)->render()->getData(); | ||
|
|
||
| expect($viewData) | ||
| ->title->toBe('Acme Status') | ||
| ->description->toBe('A private production system.'); |
There was a problem hiding this comment.
Verify metadata in the rendered response
Calling render()->getData() bypasses resources/views/components/cachet.blade.php, so this test remains green if the layout stops emitting the <title> or description <meta> tags. The request-level assertions that previously covered those tags were removed, and no other status-page test checks the rendered metadata; retain a feature assertion against the response HTML.
Useful? React with 馃憤聽/ 馃憥.
| $this->get(route('cachet.status-page.incident', $incident)) | ||
| ->assertOk() | ||
| ->assertSeeText('API connectivity') | ||
| ->assertSee(__('cachet::incident.affected_components_header')) |
There was a problem hiding this comment.
Preserve detail-page heading semantics
When an incident or schedule name remains visible but is changed from an <h1> to a non-heading element, these consolidated text assertions still pass. The previous incident and schedule tests explicitly protected the pages' primary-heading semantics, and no replacement assertion checks them; keep a DOM-level <h1> assertion for both detail pages.
Useful? React with 馃憤聽/ 馃憥.
| $this->get(route('cachet.status-page')) | ||
| ->assertOk() | ||
| ->assertSee('<strong>primary</strong>', escape: false) | ||
| ->assertSeeText('primary') | ||
| ->assertDontSee('<script>alert(1)</script>', escape: false); |
There was a problem hiding this comment.
Verify Markdown reaches the rendered response
If the component or incident view accidentally renders the escaped raw field instead of its formatted Markdown accessor, assertSeeText('primary') still passes because **primary** contains that text, while the script assertion also passes because escaping removes the literal tag. The helper unit tests only verify Markdown conversion in isolation, not the model-to-view wiring that the removed <strong> assertions covered; retain an HTML assertion for the rendered emphasis.
Useful? React with 馃憤聽/ 馃憥.
Summary
Testing
php -d memory_limit=512M vendor/bin/pest --ci --compactcomposer test:lintvendor/bin/phpstan analyse --no-progress --memory-limit=512MFull suite: 1,121 passed, 2 todos, 4,115 assertions.