Files
SealShare/tests/Feature/ShareCreatedTest.php
T
Andreas Reinhold / reiniandClaude Opus 5 1352533667 Offer a new share as a QR code and through the share sheet
The share created page gets "Show QR code", a dialog with the link as a
QR code (black on white, full screen on a phone) that downloads as a PNG
drawn in the browser, with a password reminder for protected shares; and
"Share…", which opens the device's share sheet where there is one. Both
carry only the link.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
2026-09-13 11:46:07 +02:00

28 lines
1.0 KiB
PHP

<?php
use App\Models\Share;
use App\Services\QrCodeService;
test('the share created page offers the link as a QR code and through the share sheet', function () {
$share = Share::factory()->create();
$url = route('share.download', $share);
$response = $this->get(route('share.created', $share));
$response->assertOk()
->assertSee($url, false)
->assertSee('data-test="show-qr-code"', false)
->assertSee('data-test="share-sheet"', false)
->assertSee('share-'.$share->token.'.png')
->assertSee('<div data-qr-code class="mx-auto aspect-square w-full max-w-80 rounded-corner-lg bg-white p-2 [&>svg]:size-full">'.app(QrCodeService::class)->svg($url).'</div>', false)
->assertDontSee('Recipients also need the password.');
});
test('the QR code dialog reminds that a protected share also needs its password', function () {
$share = Share::factory()->withPassword()->create();
$this->get(route('share.created', $share))
->assertOk()
->assertSee('Recipients also need the password.');
});