Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Meet/RoomSecurityTest.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public function testRoomPassword(): void | ||||
// Join the room as an owner (authenticate) | // Join the room as an owner (authenticate) | ||||
$owner->visit(new RoomPage('john')) | $owner->visit(new RoomPage('john')) | ||||
->click('@setup-button') | ->click('@setup-button') | ||||
->submitLogon('john@kolab.org', 'simple123') | ->submitLogon('john@kolab.org', 'simple123') | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->assertMissing('@setup-password-input') | ->assertMissing('@setup-password-input') | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitFor('@session') | ->waitFor('@session') | ||||
// Enter Security option dialog | // Enter Security option dialog | ||||
->click('@menu button.link-security') | ->click('@menu button.link-security') | ||||
->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ||||
$browser->assertSeeIn('@title', 'Security options') | $browser->assertSeeIn('@title', 'Security options') | ||||
->assertSeeIn('@button-action', 'Close') | ->assertSeeIn('@button-action', 'Close') | ||||
->assertElementsCount('.modal-footer button', 1) | ->assertElementsCount('.modal-footer button', 1) | ||||
->assertSeeIn('#password-input .label', 'Password:') | ->assertSeeIn('#password-input .label', 'Password:') | ||||
Show All 27 Lines | public function testRoomPassword(): void | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->assertSeeIn('@setup-status-message', "Please, provide a valid password.") | ->assertSeeIn('@setup-status-message', "Please, provide a valid password.") | ||||
->assertVisible('@setup-form .input-group:nth-child(4) svg') | ->assertVisible('@setup-form .input-group:nth-child(4) svg') | ||||
->assertAttribute('@setup-form .input-group:nth-child(4) .input-group-text', 'title', 'Password') | ->assertAttribute('@setup-form .input-group:nth-child(4) .input-group-text', 'title', 'Password') | ||||
->assertAttribute('@setup-password-input', 'placeholder', 'Password') | ->assertAttribute('@setup-password-input', 'placeholder', 'Password') | ||||
->assertValue('@setup-password-input', '') | ->assertValue('@setup-password-input', '') | ||||
->assertSeeIn('@setup-button', "JOIN") | ->assertSeeIn('@setup-button', "JOIN") | ||||
// Try to join w/o password | // Try to join w/o password | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitFor('#setup-password.is-invalid') | ->waitFor('#setup-password.is-invalid') | ||||
// Try to join with a valid password | // Try to join with a valid password | ||||
->type('#setup-password', 'pass') | ->type('#setup-password', 'pass') | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitFor('@session'); | ->waitFor('@session'); | ||||
// Test removing the password | // Test removing the password | ||||
$owner->click('@menu button.link-security') | $owner->click('@menu button.link-security') | ||||
->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ||||
$browser->assertSeeIn('@title', 'Security options') | $browser->assertSeeIn('@title', 'Security options') | ||||
->assertSeeIn('#password-input-text:not(.text-muted)', 'pass') | ->assertSeeIn('#password-input-text:not(.text-muted)', 'pass') | ||||
->assertSeeIn('#password-clear-btn.btn-outline-danger', 'Clear password') | ->assertSeeIn('#password-clear-btn.btn-outline-danger', 'Clear password') | ||||
Show All 28 Lines | public function testLockedRoom(): void | ||||
// Join the room as an owner (authenticate) | // Join the room as an owner (authenticate) | ||||
$owner->visit(new RoomPage('john')) | $owner->visit(new RoomPage('john')) | ||||
// ->click('@setup-button') | // ->click('@setup-button') | ||||
// ->submitLogon('john@kolab.org', 'simple123') | // ->submitLogon('john@kolab.org', 'simple123') | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->type('@setup-nickname-input', 'John') | ->type('@setup-nickname-input', 'John') | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitFor('@session') | ->waitFor('@session') | ||||
// Enter Security option dialog | // Enter Security option dialog | ||||
->click('@menu button.link-security') | ->click('@menu button.link-security') | ||||
->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | ||||
$browser->assertSeeIn('@title', 'Security options') | $browser->assertSeeIn('@title', 'Security options') | ||||
->assertSeeIn('#room-lock label', 'Locked room:') | ->assertSeeIn('#room-lock label', 'Locked room:') | ||||
->assertVisible('#room-lock input[type=checkbox]:not(:checked)') | ->assertVisible('#room-lock input[type=checkbox]:not(:checked)') | ||||
->assertVisible('#room-lock + small') | ->assertVisible('#room-lock + small') | ||||
// Test setting the lock | // Test setting the lock | ||||
->click('#room-lock input') | ->click('#room-lock input') | ||||
->assertToast(Toast::TYPE_SUCCESS, "Room configuration updated successfully.") | ->assertToast(Toast::TYPE_SUCCESS, "Room configuration updated successfully.") | ||||
->click('@button-action'); | ->click('@button-action'); | ||||
$this->assertSame('true', $room->fresh()->getSetting('locked')); | $this->assertSame('true', $room->fresh()->getSetting('locked')); | ||||
}); | }); | ||||
// In another browser act as a guest | // In another browser act as a guest | ||||
$guest->visit(new RoomPage('john')) | $guest->visit(new RoomPage('john')) | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->assertButtonEnabled('@setup-button') | ->assertButtonEnabled('@setup-button') | ||||
->assertSeeIn('@setup-button.btn-success', 'JOIN NOW') | ->assertSeeIn('@setup-button.btn-success', 'JOIN NOW') | ||||
// try without the nickname | // try without the nickname | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitFor('@setup-nickname-input.is-invalid') | ->waitFor('@setup-nickname-input.is-invalid') | ||||
->assertSeeIn( | ->assertSeeIn( | ||||
'@setup-status-message', | '@setup-status-message', | ||||
"The room is locked. Please, enter your name and try again." | "The room is locked. Please, enter your name and try again." | ||||
) | ) | ||||
->assertMissing('@setup-password-input') | ->assertMissing('@setup-password-input') | ||||
->assertButtonEnabled('@setup-button') | ->assertButtonEnabled('@setup-button') | ||||
->assertSeeIn('@setup-button.btn-success', 'JOIN NOW') | ->assertSeeIn('@setup-button.btn-success', 'JOIN NOW') | ||||
->type('@setup-nickname-input', 'Guest<p>') | ->type('@setup-nickname-input', 'Guest<p>') | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->assertMissing('@setup-nickname-input.is-invalid') | ->assertMissing('@setup-nickname-input.is-invalid') | ||||
->waitForText("Waiting for permission to join the room.") | ->waitForText("Waiting for permission to join the room.") | ||||
->assertButtonDisabled('@setup-button'); | ->assertButtonDisabled('@setup-button'); | ||||
// Test denying the request (this will also test custom toasts) | // Test denying the request (this will also test custom toasts) | ||||
$owner | $owner | ||||
->whenAvailable(new Toast(Toast::TYPE_CUSTOM), function ($browser) { | ->whenAvailable(new Toast(Toast::TYPE_CUSTOM), function ($browser) { | ||||
$browser->assertToastTitle('Join request') | $browser->assertToastTitle('Join request') | ||||
Show All 9 Lines | public function testLockedRoom(): void | ||||
->pause(10 * 1000) | ->pause(10 * 1000) | ||||
->assertMissing('.toast'); | ->assertMissing('.toast'); | ||||
// Test accepting the request | // Test accepting the request | ||||
$guest->refresh() | $guest->refresh() | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->type('@setup-nickname-input', 'guest') | ->type('@setup-nickname-input', 'guest') | ||||
->click('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->waitForText("Waiting for permission to join the room.") | ->waitForText("Waiting for permission to join the room.") | ||||
->assertButtonDisabled('@setup-button'); | ->assertButtonDisabled('@setup-button'); | ||||
$owner | $owner | ||||
->whenAvailable(new Toast(Toast::TYPE_CUSTOM), function ($browser) { | ->whenAvailable(new Toast(Toast::TYPE_CUSTOM), function ($browser) { | ||||
$browser->assertToastTitle('Join request') | $browser->assertToastTitle('Join request') | ||||
->assertSeeIn('@message', 'guest requested to join.') | ->assertSeeIn('@message', 'guest requested to join.') | ||||
->click('@message button.accept'); | ->click('@message button.accept'); | ||||
Show All 30 Lines |