Everyone sees their open tasks on an agenda, their open jobs, this week's hours and quick links. Admin and management also get a lazily loaded management panel: things to do, the month so far against the previous month, jobs and late work, and everyone's workload. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
46 lines
2.3 KiB
PHP
46 lines
2.3 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
|
|
use App\Modules\Jobs\Domain\Enums\JobStatus;
|
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
|
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
|
|
use App\Modules\TimeTracking\Infrastructure\Persistence\Eloquent\TimeEntryModel;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->worker = User::factory()->employee()->create(['name' => 'Aino Tekijä']);
|
|
$job = CustomerJobModel::factory()->create([
|
|
'name' => 'Mainosvideo',
|
|
'customer_id' => CustomerModel::factory()->company()->create()->id,
|
|
'status' => JobStatus::InProduction,
|
|
'responsible_user_id' => $this->worker->id,
|
|
'due_on' => now()->subDays(3)->toDateString(),
|
|
]);
|
|
$task = TaskModel::factory()->create(['customer_job_id' => $job->id, 'title' => 'Leikkaus', 'assignee_user_id' => $this->worker->id, 'due_on' => now()->subDay()->toDateString()]);
|
|
TaskModel::factory()->create(['customer_job_id' => $job->id, 'title' => 'Värimäärittely', 'assignee_user_id' => $this->worker->id, 'due_on' => now()->toDateString()]);
|
|
TimeEntryModel::factory()->create(['user_id' => $this->worker->id, 'task_id' => $task->id, 'worked_on' => now()->toDateString(), 'hours' => 2]);
|
|
});
|
|
|
|
it('has no accessibility issues on the home page', function (string $role, string $device, string $colorScheme) {
|
|
$this->actingAs($role === 'management' ? User::factory()->management()->create(['name' => 'Maija Johtaja']) : $this->worker);
|
|
|
|
$visit = visit(route('home'));
|
|
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
|
|
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
|
|
|
|
$role === 'management'
|
|
? $visit->assertSee('Henkilöiden kuormitus')->assertSee('Leikkaus')
|
|
: $visit->assertSee('Leikkaus')->assertSee('Värimäärittely')->assertDontSee('Johtajapaneeli');
|
|
|
|
$visit->assertNoJavaScriptErrors()
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
})->with(['employee', 'management'])->with([
|
|
'desktop, light' => ['desktop', 'light'],
|
|
'desktop, dark' => ['desktop', 'dark'],
|
|
'mobile, light' => ['mobile', 'light'],
|
|
'mobile, dark' => ['mobile', 'dark'],
|
|
]);
|