Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Meet/RoomSecurityTest.php
Show All 17 Lines | class RoomSecurityTest extends TestCaseDusk | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
$this->clearMeetEntitlements(); | $this->clearMeetEntitlements(); | ||||
$this->assignMeetEntitlement('john@kolab.org'); | $this->assignMeetEntitlement('john@kolab.org'); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->setSettings(['password' => null, 'locked' => null]); | $room->setSettings(['password' => null, 'locked' => null]); | ||||
if ($room->session_id) { | |||||
$room->session_id = null; | |||||
$room->save(); | |||||
} | |||||
} | } | ||||
public function tearDown(): void | public function tearDown(): void | ||||
{ | { | ||||
$this->clearMeetEntitlements(); | $this->clearMeetEntitlements(); | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
$room->setSettings(['password' => null, 'locked' => null]); | $room->setSettings(['password' => null, 'locked' => null]); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test password protected room | * Test password protected room | ||||
* | * | ||||
* @group openvidu | * @group openvidu | ||||
*/ | */ | ||||
public function testRoomPassword(): void | public function testRoomPassword(): void | ||||
{ | { | ||||
$this->browse(function (Browser $owner, Browser $guest) { | $this->browse(function (Browser $owner, Browser $guest) { | ||||
// Make sure there's no session yet | |||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
if ($room->session_id) { | |||||
$room->session_id = null; | |||||
$room->save(); | |||||
} | |||||
// 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') | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | public function testRoomPassword(): void | ||||
->click('@button-action'); | ->click('@button-action'); | ||||
$this->assertSame(null, $room->fresh()->getSetting('password')); | $this->assertSame(null, $room->fresh()->getSetting('password')); | ||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test locked room | * Test locked room (denying the join request) | ||||
* | * | ||||
* @group openvidu | * @group openvidu | ||||
*/ | */ | ||||
public function testLockedRoom(): void | public function testLockedRoomDeny(): void | ||||
{ | { | ||||
$this->browse(function (Browser $owner, Browser $guest) { | $this->browse(function (Browser $owner, Browser $guest) { | ||||
// Make sure there's no session yet | // Make sure there's no session yet | ||||
$room = Room::where('name', 'john')->first(); | $room = Room::where('name', 'john')->first(); | ||||
if ($room->session_id) { | |||||
$room->session_id = null; | |||||
$room->save(); | |||||
} | |||||
// 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') | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | public function testLockedRoomDeny(): void | ||||
->assertSeeIn('@message button.accept.btn-success', 'Accept') | ->assertSeeIn('@message button.accept.btn-success', 'Accept') | ||||
->assertSeeIn('@message button.deny.btn-danger', 'Deny') | ->assertSeeIn('@message button.deny.btn-danger', 'Deny') | ||||
->click('@message button.deny'); | ->click('@message button.deny'); | ||||
}) | }) | ||||
->waitUntilMissing('.toast') | ->waitUntilMissing('.toast') | ||||
// wait 10 seconds to make sure the request message does not show up again | // wait 10 seconds to make sure the request message does not show up again | ||||
->pause(10 * 1000) | ->pause(10 * 1000) | ||||
->assertMissing('.toast'); | ->assertMissing('.toast'); | ||||
}); | |||||
} | |||||
/** | |||||
* Test locked room (accepting the join request, and dismissing a user) | |||||
* | |||||
* @group openvidu | |||||
*/ | |||||
public function testLockedRoomAcceptAndDismiss(): void | |||||
{ | |||||
$this->browse(function (Browser $owner, Browser $guest) { | |||||
// Make sure there's no session yet | |||||
$room = Room::where('name', 'john')->first(); | |||||
// Join the room as an owner (authenticate) | |||||
$owner->visit(new RoomPage('john')) | |||||
// ->click('@setup-button') | |||||
// ->submitLogon('john@kolab.org', 'simple123') | |||||
->waitFor('@setup-form') | |||||
->waitUntilMissing('@setup-status-message.loading') | |||||
->type('@setup-nickname-input', 'John') | |||||
->clickWhenEnabled('@setup-button') | |||||
->waitFor('@session') | |||||
// Enter Security option dialog | |||||
->click('@menu button.link-security') | |||||
->with(new Dialog('#security-options-dialog'), function (Browser $browser) use ($room) { | |||||
$browser->assertSeeIn('@title', 'Security options') | |||||
->assertSeeIn('#room-lock label', 'Locked room:') | |||||
->assertVisible('#room-lock input[type=checkbox]:not(:checked)') | |||||
->assertVisible('#room-lock + small') | |||||
// Test setting the lock | |||||
->click('#room-lock input') | |||||
->assertToast(Toast::TYPE_SUCCESS, "Room configuration updated successfully.") | |||||
->click('@button-action'); | |||||
$this->assertSame('true', $room->fresh()->getSetting('locked')); | |||||
}); | |||||
// Test accepting the request | // In another browser act as a guest | ||||
$guest->refresh() | $guest->visit(new RoomPage('john')) | ||||
->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') | ||||
->clickWhenEnabled('@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 | ||||
Show All 34 Lines |