Fixes found by axe: the chart axis captions are darker and larger, the period heading keeps its heading role with the live region inside it, and scrollable tables are focusable regions named by their table. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
65 lines
3.5 KiB
PHP
65 lines
3.5 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Catalog\Application\UseCases\SetInternalHourlyCost;
|
|
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\ProductModel;
|
|
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
|
|
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
|
|
use App\Modules\Expenses\Infrastructure\Persistence\Eloquent\ExpenseModel;
|
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
|
|
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
|
|
use App\Modules\Sales\Infrastructure\Persistence\Eloquent\QuickSaleModel;
|
|
use App\Modules\TimeTracking\Infrastructure\Persistence\Eloquent\TimeEntryModel;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->actingAs(User::factory()->management()->create(['name' => 'Maija Johtaja']));
|
|
$worker = User::factory()->employee()->create(['name' => 'Aino Tekijä']);
|
|
|
|
app(SetInternalHourlyCost::class)->execute('40');
|
|
$editing = WorkTypeModel::factory()->create(['name' => 'Editointi', 'hourly_rate_cents' => 8000]);
|
|
$customer = CustomerModel::factory()->company()->create(['name' => 'Asiakas Oy']);
|
|
$job = CustomerJobModel::factory()->create(['name' => 'Mainosvideo', 'customer_id' => $customer->id, 'payment_basis' => 'hourly']);
|
|
$task = TaskModel::factory()->create(['customer_job_id' => $job->id, 'work_type_id' => $editing->id]);
|
|
|
|
TimeEntryModel::factory()->approved()->create(['user_id' => $worker->id, 'task_id' => $task->id, 'hours' => 6, 'worked_on' => now()->startOfMonth()->toDateString()]);
|
|
ExpenseModel::factory()->paidByEmployee()->mileage(12.5)->create(['user_id' => $worker->id, 'customer_job_id' => $job->id, 'spent_on' => now()->subMonthNoOverflow()->startOfMonth()->toDateString()]);
|
|
ExpenseModel::factory()->create(['customer_job_id' => $job->id, 'spent_on' => now()->startOfMonth()->toDateString(), 'description' => 'Muistikortti']);
|
|
QuickSaleModel::factory()->withLine(ProductModel::factory()->create(['name' => 'Passikuvat', 'price_cents' => 1990]), 2)->create(['user_id' => $worker->id]);
|
|
});
|
|
|
|
it('has no accessibility issues on the report pages', function (string $report, string $device, string $colorScheme) {
|
|
$visit = visit(route('reports.'.$report));
|
|
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
|
|
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
|
|
|
|
$visit->assertSee(match ($report) {
|
|
'hours' => 'Aino Tekijä',
|
|
'unbilled' => 'Mainosvideo',
|
|
'profitability' => 'Kate palveluyksiköittäin',
|
|
'sales' => 'Passikuvat',
|
|
'reimbursements' => 'Tampere',
|
|
})
|
|
->assertNoJavaScriptErrors()
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
})->with(['hours', 'unbilled', 'profitability', 'sales', 'reimbursements'])->with([
|
|
'desktop, light' => ['desktop', 'light'],
|
|
'desktop, dark' => ['desktop', 'dark'],
|
|
'mobile, light' => ['mobile', 'light'],
|
|
'mobile, dark' => ['mobile', 'dark'],
|
|
]);
|
|
|
|
it('changes the period with a quick choice and opens a breakdown with the keyboard', function () {
|
|
visit(route('reports.hours'))
|
|
->assertSee('Aino Tekijä')
|
|
->click('Edellinen vuosi')
|
|
->assertSee('Aikavälillä ei ole kirjattuja tunteja.')
|
|
->click('Tämä kuukausi')
|
|
->assertSee('Aino Tekijä')
|
|
->keys('details > summary', 'Enter')
|
|
->assertSee('Työtehtävittäin')
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
});
|