Fix console hours, sign-in landing and counter usage races
- Hours the counter reading cannot parse (",5") no longer fail after
they are saved; they just get no hour counter suggestion.
- The console's sign-in falls back to a console machine list
(machines::console-picker at /console/machines) instead of /machines,
so it stays in the console's own session.
- Recording counter usage locks the counter first, so usage saved at
the same time from two devices is not lost.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -49,7 +49,7 @@ it('asks a signed-out console to sign in on the console\'s own page and keeps /l
|
||||
|
||||
$this->actingAs($this->user, 'console');
|
||||
$this->get(route('login'))->assertOk();
|
||||
$this->get(route('console.login'))->assertRedirect(route('machines.index'));
|
||||
$this->get(route('console.login'))->assertRedirect(route('machines.console-picker'));
|
||||
});
|
||||
|
||||
it('signs out of the console without signing out of the normal user interface', function () {
|
||||
@@ -83,6 +83,24 @@ it('signs in to the console with a PIN code or a password', function () {
|
||||
->assertRedirect($this->console);
|
||||
});
|
||||
|
||||
it('goes to the console\'s machine list, in the console\'s own session, when no machine asked for the sign-in', function () {
|
||||
$this->user->forceFill(['pin_hash' => Hash::make('2468')])->save();
|
||||
|
||||
Livewire::test('users::console-login')
|
||||
->set('userId', (string) $this->user->id)
|
||||
->set('pin', '2468')
|
||||
->call('loginWithPin')
|
||||
->assertRedirect(route('machines.console-picker'));
|
||||
|
||||
expect(UseConsoleSession::isConsoleUrl(route('machines.console-picker')))->toBeTrue();
|
||||
|
||||
$this->actingAs($this->user, 'console')
|
||||
->get(route('machines.console-picker'))
|
||||
->assertOk()
|
||||
->assertSee('Suurkuvatulostin')
|
||||
->assertSee($this->console);
|
||||
});
|
||||
|
||||
it('tells console requests by their path or by where their Livewire component was rendered', function () {
|
||||
$livewire = fn (string $path): Request => tap(
|
||||
Request::create('/livewire-1234/update', 'POST', ['components' => [['snapshot' => json_encode(['memo' => ['path' => $path]])]]]),
|
||||
|
||||
Reference in New Issue
Block a user