Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Meet/RoomSetupTest.php
<?php | <?php | ||||
namespace Tests\Browser\Meet; | namespace Tests\Browser\Meet; | ||||
use App\OpenVidu\Room; | use App\Meet\Room; | ||||
use Tests\Browser; | use Tests\Browser; | ||||
use Tests\Browser\Components\Dialog; | use Tests\Browser\Components\Dialog; | ||||
use Tests\Browser\Components\Menu; | use Tests\Browser\Components\Menu; | ||||
use Tests\Browser\Pages\Meet\Room as RoomPage; | use Tests\Browser\Pages\Meet\Room as RoomPage; | ||||
use Tests\TestCaseDusk; | use Tests\TestCaseDusk; | ||||
class RoomSetupTest extends TestCaseDusk | class RoomSetupTest extends TestCaseDusk | ||||
{ | { | ||||
Show All 10 Lines | class RoomSetupTest extends TestCaseDusk | ||||
{ | { | ||||
$this->resetTestRoom(); | $this->resetTestRoom(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
/** | /** | ||||
* Test non-existing room | * Test non-existing room | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
*/ | */ | ||||
public function testRoomNonExistingRoom(): void | public function testRoomNonExistingRoom(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new RoomPage('unknown')) | $browser->visit(new RoomPage('unknown')) | ||||
->within(new Menu(), function ($browser) { | ->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | ||||
}); | }); | ||||
Show All 17 Lines | public function testRoomNonExistingRoom(): void | ||||
->assertSeeIn('@setup-status-message', "The room does not exist.") | ->assertSeeIn('@setup-status-message', "The room does not exist.") | ||||
->assertButtonDisabled('@setup-button'); | ->assertButtonDisabled('@setup-button'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test the room setup page | * Test the room setup page | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
*/ | */ | ||||
public function testRoomSetup(): void | public function testRoomSetup(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser) { | $this->browse(function (Browser $browser) { | ||||
$browser->visit(new RoomPage('john')) | $browser->visit(new RoomPage('john')) | ||||
->within(new Menu(), function ($browser) { | ->within(new Menu(), function ($browser) { | ||||
$browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']); | ||||
}); | }); | ||||
Show All 36 Lines | public function testRoomSetup(): void | ||||
) | ) | ||||
->assertSeeIn('@setup-button', "I'm the owner"); | ->assertSeeIn('@setup-button', "I'm the owner"); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test two users in a room (joining/leaving and some basic functionality) | * Test two users in a room (joining/leaving and some basic functionality) | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
* @depends testRoomSetup | * @depends testRoomSetup | ||||
*/ | */ | ||||
public function testTwoUsersInARoom(): void | public function testTwoUsersInARoom(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser, Browser $guest) { | $this->browse(function (Browser $browser, Browser $guest) { | ||||
// In one browser window act as a guest | // In one browser window act as a guest | ||||
$guest->visit(new RoomPage('john')) | $guest->visit(new RoomPage('john')) | ||||
->assertMissing('@toolbar') | ->assertMissing('@toolbar') | ||||
Show All 32 Lines | public function testTwoUsersInARoom(): void | ||||
} | } | ||||
$browser->assertMissing('@login-form') | $browser->assertMissing('@login-form') | ||||
->waitUntilMissing('@setup-status-message.loading') | ->waitUntilMissing('@setup-status-message.loading') | ||||
->waitFor('@setup-status-message') | ->waitFor('@setup-status-message') | ||||
->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.") | ->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.") | ||||
->assertSeeIn('@setup-button', "JOIN") | ->assertSeeIn('@setup-button', "JOIN") | ||||
->type('@setup-nickname-input', 'john') | ->type('@setup-nickname-input', 'john') | ||||
// Join the room (click the button twice, to make sure it does not | |||||
// produce redundant participants/subscribers in the room) | |||||
->clickWhenEnabled('@setup-button') | ->clickWhenEnabled('@setup-button') | ||||
->pause(5) | |||||
->click('@setup-button') | |||||
->waitFor('@session') | ->waitFor('@session') | ||||
->assertMissing('@setup-form') | ->assertMissing('@setup-form') | ||||
->whenAvailable('div.meet-video.self', function (Browser $browser) { | ->whenAvailable('div.meet-video.self', function (Browser $browser) { | ||||
$browser->waitFor('video') | $browser->waitFor('video') | ||||
->assertSeeIn('.meet-nickname', 'john') | ->assertSeeIn('.meet-nickname', 'john') | ||||
->assertVisible('.controls button.link-fullscreen') | ->assertVisible('.controls button.link-fullscreen') | ||||
->assertMissing('.controls button.link-audio') | ->assertMissing('.controls button.link-audio') | ||||
->assertMissing('.status .status-audio') | ->assertMissing('.status .status-audio') | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public function testTwoUsersInARoom(): void | ||||
->assertMissing('#leave-dialog') | ->assertMissing('#leave-dialog') | ||||
->waitForLocation('/login'); | ->waitForLocation('/login'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test two subscribers-only users in a room | * Test two subscribers-only users in a room | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
* @depends testTwoUsersInARoom | * @depends testTwoUsersInARoom | ||||
*/ | */ | ||||
public function testSubscribers(): void | public function testSubscribers(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser, Browser $guest) { | $this->browse(function (Browser $browser, Browser $guest) { | ||||
// Join the room as the owner | // Join the room as the owner | ||||
$browser->visit(new RoomPage('john')) | $browser->visit(new RoomPage('john')) | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | public function testSubscribers(): void | ||||
// Expect the participant removed from other users windows | // Expect the participant removed from other users windows | ||||
$browser->waitUntilMissing('@session .meet-subscriber:not(.self)'); | $browser->waitUntilMissing('@session .meet-subscriber:not(.self)'); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test demoting publisher to a subscriber | * Test demoting publisher to a subscriber | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
* @depends testSubscribers | * @depends testSubscribers | ||||
*/ | */ | ||||
public function testDemoteToSubscriber(): void | public function testDemoteToSubscriber(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser, Browser $guest1, Browser $guest2) { | $this->browse(function (Browser $browser, Browser $guest1, Browser $guest2) { | ||||
// Join the room as the owner | // Join the room as the owner | ||||
$browser->visit(new RoomPage('john')) | $browser->visit(new RoomPage('john')) | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | public function testDemoteToSubscriber(): void | ||||
->assertElementsCount('@session video', 2) | ->assertElementsCount('@session video', 2) | ||||
->assertElementsCount('@session div.meet-subscriber', 0); | ->assertElementsCount('@session div.meet-subscriber', 0); | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Test the media setup dialog | * Test the media setup dialog | ||||
* | * | ||||
* @group openvidu | * @group meet | ||||
* @depends testDemoteToSubscriber | * @depends testDemoteToSubscriber | ||||
*/ | */ | ||||
public function testMediaSetupDialog(): void | public function testMediaSetupDialog(): void | ||||
{ | { | ||||
$this->browse(function (Browser $browser, $guest) { | $this->browse(function (Browser $browser, $guest) { | ||||
// Join the room as the owner | // Join the room as the owner | ||||
$browser->visit(new RoomPage('john')) | $browser->visit(new RoomPage('john')) | ||||
->waitFor('@setup-form') | ->waitFor('@setup-form') | ||||
Show All 39 Lines | public function testMediaSetupDialog(): void | ||||
->select('form > div:nth-child(3) select', '') | ->select('form > div:nth-child(3) select', '') | ||||
->click('@button-action'); | ->click('@button-action'); | ||||
}) | }) | ||||
->assertMissing('#media-setup-dialog') | ->assertMissing('#media-setup-dialog') | ||||
->assertVisible('@session .meet-video .status .status-audio') | ->assertVisible('@session .meet-video .status .status-audio') | ||||
->assertVisible('@session .meet-video .status .status-video'); | ->assertVisible('@session .meet-video .status .status-video'); | ||||
$guest->waitFor('@session video') | $guest->waitFor('@session video') | ||||
->assertVisible('@session .meet-video .status .status-audio') | ->waitFor('@session .meet-video .status .status-audio') | ||||
->assertVisible('@session .meet-video .status .status-video'); | ->assertVisible('@session .meet-video .status .status-video'); | ||||
}); | }); | ||||
} | } | ||||
} | } |