test(auth): cover the 2FA duplicate submit guard

This commit is contained in:
peaklabs-dev 2026-09-08 12:12:59 +02:00
parent 9eace1529a
commit aff973cce9
No known key found for this signature in database

View file

@ -70,7 +70,7 @@
->screenshot(filename: 'login-invalid-credentials');
});
it('prevents Enter from duplicating the automatic two factor challenge submission', function () {
it('submits the automatic two factor challenge only once', function () {
config(['app.maintenance.driver' => 'file']);
$user = createRootUser();
@ -97,11 +97,11 @@
});
JS);
foreach (str_split('123456') as $index => $digit) {
$page->keys(sprintf('[aria-label="Digit %d"]', $index + 1), $digit);
}
$page->keys('[aria-label="Digit 6"]', 'Enter')
$page->fill('code', '123456')
->keys('code', 'Enter')
->assertScript('window.acceptedTwoFactorSubmissions', 1)
->assertDisabled('Verify and continue')
->fill('code', '654321')
->assertScript('window.acceptedTwoFactorSubmissions', 1)
->assertNoJavaScriptErrors()
->screenshot(filename: 'login-two-factor-enter-single-submission');