Merged
Conversation
Map unit tests to matching feature domains: - Unit/Models/CompanyTest -> Feature/CRM/CompanyModelTest - Unit/Models/TeamTest -> Feature/Teams/TeamModelTest - Unit/Models/UserTest -> Feature/Auth/UserModelTest - Unit/Services/AvatarServiceTest -> Feature/Profile/AvatarServiceTest - Unit/Services/GitHubServiceTest -> Feature/Profile/GitHubServiceTest Remove empty tests/Unit/ directory.
Replace Unit/Feature/Arch suites with Arch/Smoke/Feature/Browser layout. Point Arch testsuite to tests/Arch/ directory. Remove invalid Laravel 12 exclude entries (Kernel.php, Handler.php).
Replace Unit/Feature in() bindings with Feature/Smoke/Browser. Remove unused toBeOne() expectation boilerplate. Add layer documentation header.
- Raise type-coverage min to 100% - Remove test:coverage (coverage --min=80) - Remove test:pest:ci:shard (consolidated into test:pest:ci with --shard) - Add --exclude-testsuite=Browser to pest/pest:shard/pest:ci - Add test:browser script for isolated browser test runs - test:pest:ci now uses --compact --parallel and accepts $SHARD env var
There was a problem hiding this comment.
Pull request overview
Introduces a more structured Pest/PHPUnit test suite layout (Arch/Smoke/Browser), and adds new model/service tests to expand coverage across core CRM/team/profile behaviors.
Changes:
- Reorganizes/expands PHPUnit testsuites (Arch, Smoke, Browser) and updates Pest bootstrap configuration.
- Adds new Feature tests for Team, Company, User models and profile services (GitHubService, AvatarService).
- Adds a new architecture test suite under
tests/Arch.
Reviewed changes
Copilot reviewed 4 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Pest.php | Updates Pest bootstrap and documents the intended “testing trophy” structure. |
| tests/Feature/Teams/TeamModelTest.php | Adds Team relationship/event/slug-observer tests. |
| tests/Feature/Profile/GitHubServiceTest.php | Adds caching/API and formatting tests for GitHub stars service. |
| tests/Feature/Profile/AvatarServiceTest.php | Adds tests for avatar generation logic and edge cases. |
| tests/Feature/CRM/CompanyModelTest.php | Adds relationship/trait/interface coverage for Company model. |
| tests/Feature/Auth/UserModelTest.php | Adds relationship and Filament tenancy-method tests for User model. |
| tests/Arch/ArchTest.php | Adds architecture rules (strict types, final/readonly, dependency boundaries). |
| phpunit.xml | Adds Arch/Smoke/Browser testsuites and updates source excludes. |
| phpunit.ci.xml | Mirrors phpunit.xml suite changes for CI. |
| composer.json | Updates test scripts (type coverage min=100, excludes Browser suite, adds browser script). |
| tests/Smoke/.gitkeep | Creates Smoke tests directory placeholder. |
| tests/Browser/.gitkeep | Creates Browser tests directory placeholder. |
| tests/Datasets/.gitkeep | Creates Datasets directory placeholder. |
Uses spatie/pest-plugin-route-testing to auto-test every registered GET route returns a non-500 response. Routes with missing bindings are skipped automatically; infrastructure/external-service routes are excluded.
Playwright-powered test verifying login -> dashboard journey.
- Add arch tests to quality checks job - Add Job 3 for Playwright browser tests - Update tests job to use consolidated test:pest:ci script
Every test file now declares which source classes it covers for mutation testing tracking.
Replace Mockery mocks with Laravel fakes in: - AvatarServiceTest: replace Mockery::mock(Cache) with ArrayStore, remove ReflectionClass usage by testing through public API (generate/generateAuto) - SocialiteLoginTest: replace Mockery::mock(SocialiteUser/AbstractProvider) with Socialite::fake() and Two\User instances - EntityLinkValidatorTest: replace Mockery::mock(BaseImporter) with real CompanyImporter instances
Test widgets through their public Livewire interface instead of invoking private methods via reflection.
… tests Verify observer behavior (creator_id/team_id auto-assignment) and policy authorization (cross-team access denial) for all CRM entities through their Filament resource workflows.
Type the $q and $field closure parameters to satisfy the --min=100 type coverage threshold.
- Fix TypeError in ExecuteImportJob: eager loading callback receives HasMany, not Builder - Add --exclude-testsuite=Browser to test:arch composer script to prevent PlaywrightNotInstalledException in quality checks - Add playwright npm package to devDependencies so browser tests CI job can install Playwright browsers
- Use pest tests/Arch/ instead of --filter=arch to avoid running unrelated tests in the no-database quality checks job - Use phpunit.ci.xml for browser tests in CI for DB credentials
- Remove --parallel from test:pest:ci to match main branch convention and prevent SQLite I/O race conditions in ImportWizard tests - Use vendor/bin/pest for browser tests CI step (pest not in PATH)
- Add dummy Pusher credentials to phpunit.ci.xml to prevent Filament echo.js initialization error in browser tests - Set BROADCAST_CONNECTION=log in CI config - Increase browser test timeout to 15s for CI environments
Browser tests fail due to Filament echo.js loading Pusher without credentials. This is a CI environment configuration issue, not a test architecture issue. Mark as continue-on-error until resolved.
- Add VITE_PUSHER_APP_KEY to .env.ci so Pusher JS initializes without error - Reorder browser-tests CI steps so .env is copied before npm run build - Increase Playwright timeout to 30s for slower CI environments - Limit smoke browser test to homepage only (Filament pages need full config)
Filament renders Pusher JS when broadcasting.echo config exists, but CI has no real Pusher key. The fake ci-placeholder key caused Pusher to throw "You must pass your app key", breaking Livewire/Alpine.js and causing all browser tests to timeout. Fix: make broadcasting config conditional on VITE_PUSHER_APP_KEY being set. When absent (CI), config returns empty array so Filament skips the Echo script tag entirely. Also removes continue-on-error from browser tests job now that the root cause is fixed.
The Pest Browser plugin's GuessLocator treats 'data.email' as an explicit CSS selector (tag 'data' with class 'email') due to the dot matching its class-name regex. Using [id="data.email"] attribute selectors correctly matches Filament-rendered input elements by their exact id attribute value, preventing 30s timeouts.
Filament renders input IDs as form.<fieldname> (from the Form component's id), not data.<fieldname>. Update all attribute selectors accordingly.
press('Sign in') matched both the <h1>Sign in</h1> heading and the
<button>Sign in</button> via getByText(), clicking the heading (no-op).
Use click('button.fi-btn') to target only the Filament action button.
…tecture # Conflicts: # package-lock.json
- CompanyBrowserTest: use mountedActionSchema0.name for action modal form fields - ImportWizardBrowserTest: assert actual page text instead of non-existent "Upload CSV" - OnboardingBrowserTest: use gmail.com for DNS validation, fix button to "Create Team" - TeamBrowserTest: fix submit button text from "Register" to "Create Team"
- OnboardingBrowserTest: use press('Sign up') for register button, fill slug explicitly
- TeamBrowserTest: fill slug field explicitly since Playwright fill() doesn't trigger blur
The registration form uses email:rfc,dns validation which calls checkdnsrr() - this fails in CI environments without DNS resolution. Instead, create a user without teams and test the onboarding flow (team creation) directly after login.
…ation Login redirect to /app/new doesn't fully initialize the Livewire component, causing form submission to fail. Use navigate() after asserting the redirect path, matching the pattern used by TeamBrowserTest.
- Remove unused datasets (CrmEntities, Roles) not consumed by any test - Add trailing newline to phpunit.ci.xml - Replace fragile regex HTML parsing with invade() in UserRetentionChartWidgetTest - Guard Playwright::setTimeout with class_exists to prevent boot crash without npm install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.