]*data-test="page"[^>]*>/', $html, $matches);
return $matches[0] ?? '';
}
test('every page is one page template, one h1 and the same width', function (Closure $visit) {
$html = $visit($this)->assertOk()->getContent();
expect(substr_count($html, 'data-test="page"'))->toBe(1)
->and(preg_match_all('/
]/', $html))->toBe(1)
->and(pageTag($html))->toContain('data-md-width="narrow"');
})->with([
'upload' => [fn (TestCase $test): TestResponse => $test->get(route('upload'))],
'download' => [fn (TestCase $test): TestResponse => $test->get(route('share.download', Share::factory()->withPassword()->create()))],
'share created' => [fn (TestCase $test): TestResponse => $test->get(route('share.created', Share::factory()->create()))],
'login' => [fn (TestCase $test): TestResponse => $test->get(route('login'))],
'forgot password' => [fn (TestCase $test): TestResponse => $test->get(route('password.request'))],
'reset password' => [fn (TestCase $test): TestResponse => $test->get(route('password.reset', 'token'))],
'two-factor challenge' => [fn (TestCase $test): TestResponse => $test->withSession(['login.id' => User::factory()->withTwoFactor()->create()->id])->get(route('two-factor.login'))],
'setup' => [function (TestCase $test): TestResponse {
User::query()->where('is_admin', true)->delete();
return $test->get(route('setup'));
}],
'system password' => [function (TestCase $test): TestResponse {
Setting::set('system_password', bcrypt('system-secret'));
return $test->get(route('system-password'));
}],
'verify email' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->unverified()->create())->get(route('verification.notice'))],
'confirm password' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->create())->get(route('password.confirm'))],
'profile' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->create())->get(route('profile.edit'))],
'password' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->create())->get(route('user-password.edit'))],
'two-factor settings' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->create())->withSession(['auth.password_confirmed_at' => time()])->get(route('two-factor.show'))],
'appearance' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->create())->get(route('appearance.edit'))],
'admin settings' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->admin()->create())->get(route('admin.settings'))],
'admin dashboard' => [fn (TestCase $test): TestResponse => $test->actingAs(User::factory()->admin()->create())->get(route('admin.dashboard'))],
]);
test("a brand page is headed by the site's own logo, title and description", function () {
Setting::set('site_title', 'Acme Files');
Setting::set('site_description', 'Send files to Acme Engineering.');
Setting::set('site_logo', 'branding/acme.png');
$html = $this->get(route('login'))
->assertOk()
->assertSeeInOrder(['data-test="page-logo"', 'assertSee(Storage::disk('public')->url('branding/acme.png'), false)
->getContent();
expect($html)->toMatch('/]*>\s*Acme Files\s*<\/h1>/');
});
test('a brand page falls back to the app name and SealShare\'s own line without branding', function () {
$html = $this->get(route('upload'))
->assertOk()
->assertSeeInOrder(['assertDontSee('data-test="page-logo"', false)
->getContent();
expect($html)->toMatch('/]*>\s*'.preg_quote(config('app.name'), '/').'\s*<\/h1>/');
});