Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F174695
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
46 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/tests/Browser/Meet/RoomSetupTest.php b/src/tests/Browser/Meet/RoomSetupTest.php
index ec38fb19..24011a34 100644
--- a/src/tests/Browser/Meet/RoomSetupTest.php
+++ b/src/tests/Browser/Meet/RoomSetupTest.php
@@ -1,568 +1,568 @@
<?php
namespace Tests\Browser\Meet;
use App\Meet\Room;
use Tests\Browser;
use Tests\Browser\Components\Dialog;
use Tests\Browser\Components\Menu;
use Tests\Browser\Pages\Meet\Room as RoomPage;
use Tests\TestCaseDusk;
class RoomSetupTest extends TestCaseDusk
{
/**
* {@inheritDoc}
*/
public function setUp(): void
{
parent::setUp();
$this->resetTestRoom();
}
public function tearDown(): void
{
$this->resetTestRoom();
parent::tearDown();
}
/**
* Test non-existing room
*
* @group meet
*/
public function testRoomNonExistingRoom(): void
{
$this->browse(function (Browser $browser) {
$browser->visit(new RoomPage('unknown'))
->within(new Menu(), function ($browser) {
- $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']);
+ $browser->assertMenuItems(['support', 'signup', 'login', 'lang']);
});
if ($browser->isDesktop()) {
$browser->within(new Menu('footer'), function ($browser) {
- $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'tos', 'login']);
+ $browser->assertMenuItems(['support', 'signup', 'login']);
});
} else {
$browser->assertMissing('#footer-menu .navbar-nav');
}
// FIXME: Maybe it would be better to just display the usual 404 Not Found error page?
$browser->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->assertVisible('@setup-form')
->assertSeeIn('@setup-status-message', "The room does not exist.")
->assertButtonDisabled('@setup-button');
});
}
/**
* Test the room setup page
*
* @group meet
*/
public function testRoomSetup(): void
{
$this->browse(function (Browser $browser) {
$browser->visit(new RoomPage('john'))
->within(new Menu(), function ($browser) {
- $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'login', 'lang']);
+ $browser->assertMenuItems(['support', 'signup', 'login', 'lang']);
});
if ($browser->isDesktop()) {
$browser->within(new Menu('footer'), function ($browser) {
- $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'tos', 'login']);
+ $browser->assertMenuItems(['support', 'signup', 'login']);
});
} else {
$browser->assertMissing('#footer-menu .navbar-nav');
}
// Note: I've found out that if I have another Chrome instance running
// that uses media, here the media devices will not be available
// TODO: Test enabling/disabling cam/mic in the setup widget
$browser->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->assertVisible('@setup-form')
->assertSeeIn('@setup-title', 'Set up your session')
->assertVisible('@setup-video')
->assertVisible('@setup-form .input-group:nth-child(1) svg')
->assertAttribute('@setup-form .input-group:nth-child(1) .input-group-text', 'title', 'Microphone')
->assertVisible('@setup-mic-select')
->assertVisible('@setup-form .input-group:nth-child(2) svg')
->assertAttribute('@setup-form .input-group:nth-child(2) .input-group-text', 'title', 'Camera')
->assertVisible('@setup-cam-select')
->assertVisible('@setup-form .input-group:nth-child(3) svg')
->assertAttribute('@setup-form .input-group:nth-child(3) .input-group-text', 'title', 'Nickname')
->assertValue('@setup-nickname-input', '')
->assertAttribute('@setup-nickname-input', 'placeholder', 'Your name')
->assertMissing('@setup-password-input')
->assertSeeIn(
'@setup-status-message',
"The room is closed. Please, wait for the owner to start the session."
)
->assertSeeIn('@setup-button', "I'm the owner");
});
}
/**
* Test two users in a room (joining/leaving and some basic functionality)
*
* @group meet
* @depends testRoomSetup
*/
public function testTwoUsersInARoom(): void
{
$this->browse(function (Browser $browser, Browser $guest) {
// In one browser window act as a guest
$guest->visit(new RoomPage('john'))
->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
->assertSeeIn(
'@setup-status-message',
"The room is closed. Please, wait for the owner to start the session."
)
->assertSeeIn('@setup-button', "I'm the owner");
// In another window join the room as the owner (authenticate)
$browser->on(new RoomPage('john'))
->assertSeeIn('@setup-button', "I'm the owner")
->clickWhenEnabled('@setup-button')
->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@setup-form')
->assertVisible('@login-form')
->submitLogon('john@kolab.org', 'simple123')
->waitFor('@setup-form')
->within(new Menu(), function ($browser) {
- $browser->assertMenuItems(['explore', 'blog', 'support', 'dashboard', 'logout', 'lang']);
+ $browser->assertMenuItems(['support', 'dashboard', 'logout', 'lang']);
});
if ($browser->isDesktop()) {
$browser->within(new Menu('footer'), function ($browser) {
- $browser->assertMenuItems(['explore', 'blog', 'support', 'tos', 'dashboard', 'logout']);
+ $browser->assertMenuItems(['support', 'dashboard', 'logout']);
});
}
$browser->assertMissing('@login-form')
->waitUntilMissing('@setup-status-message.loading')
->waitFor('@setup-status-message')
->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.")
->assertSeeIn('@setup-button', "JOIN")
->type('@setup-nickname-input', 'john')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->whenAvailable('div.meet-video.self', function (Browser $browser) {
$browser->waitFor('video')
->assertSeeIn('.meet-nickname', 'john')
->assertVisible('.controls button.link-fullscreen')
->assertMissing('.controls button.link-audio')
->assertMissing('.status .status-audio')
->assertMissing('.status .status-video');
})
->assertMissing('#header-menu')
->assertSeeIn('@counter', 1);
if (!$browser->isPhone()) {
$browser->assertMissing('#footer-menu');
} else {
$browser->assertVisible('#footer-menu');
}
// After the owner "opened the room" guest should be able to join
$guest->waitUntilMissing('@setup-status-message', 10)
->assertSeeIn('@setup-button', "JOIN")
// Join the room, disable cam/mic
->select('@setup-mic-select', '')
//->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->whenAvailable('div.meet-video.self', function (Browser $browser) {
$browser->waitFor('video')
->assertVisible('.meet-nickname')
->assertVisible('.controls button.link-fullscreen')
->assertMissing('.controls button.link-audio')
->assertVisible('.status .status-audio')
->assertMissing('.status .status-video');
})
->whenAvailable('div.meet-video:not(.self)', function (Browser $browser) {
$browser->waitFor('video')
->assertSeeIn('.meet-nickname', 'john')
->assertVisible('.controls button.link-fullscreen')
->assertVisible('.controls button.link-audio')
->assertMissing('.status .status-audio')
->assertMissing('.status .status-video');
})
->assertElementsCount('@session div.meet-video', 2)
->assertSeeIn('@counter', 2);
// Check guest's elements in the owner's window
$browser
->whenAvailable('div.meet-video:not(.self)', function (Browser $browser) {
$browser->waitFor('video')
->assertVisible('.meet-nickname')
->assertVisible('.controls button.link-fullscreen')
->assertVisible('.controls button.link-audio')
->assertMissing('.controls button.link-setup')
->assertVisible('.status .status-audio')
->assertMissing('.status .status-video');
})
->assertElementsCount('@session div.meet-video', 2);
// Test leaving the room
// Guest is leaving
$guest->click('@menu button.link-logout')
->waitForLocation('/login')
->assertVisible('#header-menu');
// Expect the participant removed from other users windows
$browser->waitUntilMissing('@session div.meet-video:not(.self)')
->assertSeeIn('@counter', 1);
// Join the room as guest again
$guest->visit(new RoomPage('john'))
->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
->assertMissing('@setup-status-message')
->assertSeeIn('@setup-button', "JOIN")
// Join the room, disable cam/mic
->select('@setup-mic-select', '')
//->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session');
// Leave the room as the room owner
// TODO: Test leaving the room by closing the browser window,
// it should not destroy the session
$browser->click('@menu button.link-logout')
->waitForLocation('/dashboard');
// Expect other participants be informed about the end of the session
$guest->with(new Dialog('#leave-dialog'), function (Browser $browser) {
$browser->assertSeeIn('@title', 'Room closed')
->assertSeeIn('@body', "The session has been closed by the room owner.")
->assertSeeIn('@button-cancel', 'Close')
->click('@button-cancel');
})
->assertMissing('#leave-dialog')
->waitForLocation('/login');
});
}
/**
* Test two subscribers-only users in a room
*
* @group meet
* @depends testTwoUsersInARoom
*/
public function testSubscribers(): void
{
$this->browse(function (Browser $browser, Browser $guest) {
// Join the room as the owner
$browser->visit(new RoomPage('john'))
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
->waitFor('@setup-status-message')
->type('@setup-nickname-input', 'john')
->select('@setup-mic-select', '')
->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->whenAvailable('@subscribers .meet-subscriber.self', function (Browser $browser) {
$browser->assertSeeIn('.meet-nickname', 'john');
})
->assertElementsCount('@session div.meet-video', 0)
->assertElementsCount('@session video', 0)
->assertElementsCount('@session .meet-subscriber', 1)
->assertToolbar([
'audio' => RoomPage::BUTTON_ACTIVE | RoomPage::BUTTON_DISABLED,
'video' => RoomPage::BUTTON_ACTIVE | RoomPage::BUTTON_DISABLED,
'screen' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_DISABLED,
'hand' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_ENABLED,
'chat' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_ENABLED,
'fullscreen' => RoomPage::BUTTON_ENABLED,
'options' => RoomPage::BUTTON_ENABLED,
'logout' => RoomPage::BUTTON_ENABLED,
]);
// After the owner "opened the room" guest should be able to join
// In one browser window act as a guest
$guest->visit(new RoomPage('john'))
->waitUntilMissing('@setup-status-message', 10)
->assertSeeIn('@setup-button', "JOIN")
// Join the room, disable cam/mic
->select('@setup-mic-select', '')
->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->whenAvailable('@subscribers .meet-subscriber.self', function (Browser $browser) {
$browser->assertVisible('.meet-nickname');
})
->whenAvailable('@subscribers .meet-subscriber:not(.self)', function (Browser $browser) {
$browser->assertSeeIn('.meet-nickname', 'john');
})
->assertElementsCount('@session div.meet-video', 0)
->assertElementsCount('@session video', 0)
->assertElementsCount('@session div.meet-subscriber', 2)
->assertSeeIn('@counter', 2)
->assertToolbar([
'audio' => RoomPage::BUTTON_ACTIVE | RoomPage::BUTTON_DISABLED,
'video' => RoomPage::BUTTON_ACTIVE | RoomPage::BUTTON_DISABLED,
'screen' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_DISABLED,
'hand' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_ENABLED,
'chat' => RoomPage::BUTTON_INACTIVE | RoomPage::BUTTON_ENABLED,
'fullscreen' => RoomPage::BUTTON_ENABLED,
'logout' => RoomPage::BUTTON_ENABLED,
]);
// Check guest's elements in the owner's window
$browser
->whenAvailable('@subscribers .meet-subscriber:not(.self)', function (Browser $browser) {
$browser->assertVisible('.meet-nickname');
})
->assertElementsCount('@session div.meet-video', 0)
->assertElementsCount('@session video', 0)
->assertElementsCount('@session .meet-subscriber', 2)
->assertSeeIn('@counter', 2);
// Test leaving the room
// Guest is leaving
$guest->click('@menu button.link-logout')
->waitForLocation('/login');
// Expect the participant removed from other users windows
$browser->waitUntilMissing('@session .meet-subscriber:not(.self)');
});
}
/**
* Test demoting publisher to a subscriber
*
* @group meet
* @depends testSubscribers
*/
public function testDemoteToSubscriber(): void
{
$this->browse(function (Browser $browser, Browser $guest1, Browser $guest2) {
// Join the room as the owner
$browser->visit(new RoomPage('john'))
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
->waitFor('@setup-status-message')
->type('@setup-nickname-input', 'john')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->waitFor('@session video');
// In one browser window act as a guest
$guest1->visit(new RoomPage('john'))
->waitUntilMissing('@setup-status-message', 10)
->assertSeeIn('@setup-button', "JOIN")
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->waitFor('div.meet-video.self')
->waitFor('div.meet-video:not(.self)')
->assertElementsCount('@session div.meet-video', 2)
->assertElementsCount('@session video', 2)
->assertElementsCount('@session div.meet-subscriber', 0)
// assert there's no moderator-related features for this guess available
->click('@session .meet-video.self .meet-nickname')
->whenAvailable('@session .meet-video.self .dropdown-menu', function (Browser $browser) {
$browser->assertMissing('.permissions');
})
->click('@session .meet-video:not(.self) .meet-nickname')
->pause(50)
->assertMissing('.dropdown-menu');
// Demote the guest to a subscriber
$browser
->waitFor('div.meet-video.self video')
->waitFor('div.meet-video:not(.self) video')
->assertElementsCount('@session div.meet-video', 2)
->assertElementsCount('@session video', 2)
->assertElementsCount('@session .meet-subscriber', 0)
->click('@session .meet-video:not(.self) .meet-nickname')
->whenAvailable('@session .meet-video:not(.self) .dropdown-menu', function (Browser $browser) {
$browser->assertSeeIn('.action-role-publisher', 'Audio & Video publishing')
->click('.action-role-publisher')
->waitUntilMissing('.dropdown-menu');
})
->waitUntilMissing('@session .meet-video:not(.self)')
->waitFor('@session div.meet-subscriber')
->assertElementsCount('@session div.meet-video', 1)
->assertElementsCount('@session video', 1)
->assertElementsCount('@session div.meet-subscriber', 1);
$guest1
->waitUntilMissing('@session .meet-video.self')
->waitFor('@session div.meet-subscriber')
->assertElementsCount('@session div.meet-video', 1)
->assertElementsCount('@session video', 1)
->assertElementsCount('@session div.meet-subscriber', 1);
// Join as another user to make sure the role change is propagated to new connections
$guest2->visit(new RoomPage('john'))
->waitUntilMissing('@setup-status-message', 10)
->assertSeeIn('@setup-button', "JOIN")
->select('@setup-mic-select', '')
->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->waitFor('div.meet-subscriber:not(.self)')
->assertElementsCount('@session div.meet-video', 1)
->assertElementsCount('@session video', 1)
->assertElementsCount('@session div.meet-subscriber', 2)
->click('@toolbar .link-logout');
// Promote the guest back to a publisher
$browser
->click('@session .meet-subscriber .meet-nickname')
->whenAvailable('@session .meet-subscriber .dropdown-menu', function (Browser $browser) {
$browser->assertSeeIn('.action-role-publisher', 'Audio & Video publishing')
->assertNotChecked('.action-role-publisher input')
->click('.action-role-publisher')
->waitUntilMissing('.dropdown-menu');
})
->waitFor('@session .meet-video:not(.self) video')
->assertElementsCount('@session div.meet-video', 2)
->assertElementsCount('@session video', 2)
->assertElementsCount('@session div.meet-subscriber', 0);
$guest1
->with(new Dialog('#media-setup-dialog'), function (Browser $browser) {
$browser->assertSeeIn('@title', 'Media setup')
->click('@button-cancel');
})
->waitFor('@session .meet-video.self')
->assertElementsCount('@session div.meet-video', 2)
->assertElementsCount('@session video', 2)
->assertElementsCount('@session div.meet-subscriber', 0);
// Demote the owner to a subscriber
$browser
->click('@session .meet-video.self .meet-nickname')
->whenAvailable('@session .meet-video.self .dropdown-menu', function (Browser $browser) {
$browser->assertSeeIn('.action-role-publisher', 'Audio & Video publishing')
->assertChecked('.action-role-publisher input')
->click('.action-role-publisher')
->waitUntilMissing('.dropdown-menu');
})
->waitUntilMissing('@session .meet-video.self')
->waitFor('@session div.meet-subscriber.self')
->assertElementsCount('@session div.meet-video', 1)
->assertElementsCount('@session video', 1)
->assertElementsCount('@session div.meet-subscriber', 1);
// Promote the owner to a publisher
$browser
->click('@session .meet-subscriber.self .meet-nickname')
->whenAvailable('@session .meet-subscriber.self .dropdown-menu', function (Browser $browser) {
$browser->assertSeeIn('.action-role-publisher', 'Audio & Video publishing')
->assertNotChecked('.action-role-publisher input')
->click('.action-role-publisher')
->waitUntilMissing('.dropdown-menu');
})
->waitUntilMissing('@session .meet-subscriber.self')
->with(new Dialog('#media-setup-dialog'), function (Browser $browser) {
$browser->assertSeeIn('@title', 'Media setup')
->click('@button-cancel');
})
->waitFor('@session div.meet-video.self')
->assertElementsCount('@session div.meet-video', 2)
->assertElementsCount('@session video', 2)
->assertElementsCount('@session div.meet-subscriber', 0);
});
}
/**
* Test the media setup dialog
*
* @group meet
* @depends testDemoteToSubscriber
*/
public function testMediaSetupDialog(): void
{
$this->browse(function (Browser $browser, $guest) {
// Join the room as the owner
$browser->visit(new RoomPage('john'))
->waitFor('@setup-form')
->waitUntilMissing('@setup-status-message.loading')
->waitFor('@setup-status-message')
->type('@setup-nickname-input', 'john')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form');
// In one browser window act as a guest
$guest->visit(new RoomPage('john'))
->waitUntilMissing('@setup-status-message', 10)
->assertSeeIn('@setup-button', "JOIN")
->select('@setup-mic-select', '')
->select('@setup-cam-select', '')
->clickWhenEnabled('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form');
$browser->waitFor('@session video')
->click('.controls button.link-setup')
->with(new Dialog('#media-setup-dialog'), function (Browser $browser) {
$browser->assertSeeIn('@title', 'Media setup')
->assertVisible('form video')
->assertVisible('form > div:nth-child(1) video')
->assertVisible('form > div:nth-child(1) .volume')
->assertVisible('form > div:nth-child(2) svg')
->assertAttribute('form > div:nth-child(2) .input-group-text', 'title', 'Microphone')
->assertVisible('form > div:nth-child(2) select')
->assertVisible('form > div:nth-child(3) svg')
->assertAttribute('form > div:nth-child(3) .input-group-text', 'title', 'Camera')
->assertVisible('form > div:nth-child(3) select')
->assertSeeIn('@button-cancel', 'Close')
->click('@button-cancel');
})
->assertMissing('#media-setup-dialog')
// Test mute audio and video
->click('.controls button.link-setup')
->with(new Dialog('#media-setup-dialog'), function (Browser $browser) {
$browser->select('form > div:nth-child(2) select', '')
->select('form > div:nth-child(3) select', '')
->click('@button-cancel');
})
->assertMissing('#media-setup-dialog')
->assertVisible('@session .meet-video .status .status-audio')
->assertVisible('@session .meet-video .status .status-video');
$guest->waitFor('@session video')
->waitFor('@session .meet-video .status .status-audio')
->assertVisible('@session .meet-video .status .status-video');
});
}
}
diff --git a/src/tests/Browser/Meet/RoomsTest.php b/src/tests/Browser/Meet/RoomsTest.php
index 6a6382be..2b199a94 100644
--- a/src/tests/Browser/Meet/RoomsTest.php
+++ b/src/tests/Browser/Meet/RoomsTest.php
@@ -1,395 +1,398 @@
<?php
namespace Tests\Browser\Meet;
use App\Meet\Room;
use Tests\Browser;
use Tests\Browser\Components\SubscriptionSelect;
use Tests\Browser\Components\Toast;
use Tests\Browser\Pages\Dashboard;
use Tests\Browser\Pages\Home;
use Tests\Browser\Pages\Meet\Room as RoomPage;
use Tests\Browser\Pages\Meet\RoomInfo;
use Tests\Browser\Pages\Meet\RoomList;
use Tests\Browser\Pages\UserInfo;
use Tests\TestCaseDusk;
class RoomsTest extends TestCaseDusk
{
/**
* {@inheritDoc}
*/
public function setUp(): void
{
parent::setUp();
Room::withTrashed()->whereNotIn('name', ['shared', 'john'])->forceDelete();
}
/**
* {@inheritDoc}
*/
public function tearDown(): void
{
Room::withTrashed()->whereNotIn('name', ['shared', 'john'])->forceDelete();
$room = $this->resetTestRoom('shared', ['acl' => ['jack@kolab.org, full']]);
parent::tearDown();
}
/**
* Test rooms page (unauthenticated)
*/
public function testRoomsUnauth(): void
{
// Test that the page requires authentication
$this->browse(function (Browser $browser) {
$browser->visit('/rooms')
->on(new Home())
->submitLogon('john@kolab.org', 'simple123', false)
->on(new RoomList());
});
}
/**
* Test rooms list page
*
* @group meet
*/
public function testRooms(): void
{
$this->browse(function (Browser $browser) {
$john = $this->getTestUser('john@kolab.org');
$browser->visit('/login')
->on(new Home())
->submitLogon('john@kolab.org', 'simple123', true)
->on(new Dashboard())
->assertSeeIn('@links a.link-chat', 'Video chat')
// Test Video chat page
->click('@links a.link-chat')
->on(new RoomList())
->whenAvailable('@table', function ($browser) {
$browser->assertElementsCount('tbody tr', 2)
->assertElementsCount('thead th', 3)
->with('tbody tr:nth-child(1)', function ($browser) {
$browser->assertSeeIn('td:nth-child(1) a', 'john')
->assertSeeIn('td:nth-child(2) a', "Standard room")
->assertElementsCount('td.buttons button', 2)
->assertAttribute('td.buttons button:nth-child(1)', 'title', 'Copy room location')
->assertAttribute('td.buttons button:nth-child(2)', 'title', 'Enter the room');
})
->with('tbody tr:nth-child(2)', function ($browser) {
$browser->assertSeeIn('td:nth-child(1) a', 'shared')
->assertSeeIn('td:nth-child(2) a', "Shared room")
->assertElementsCount('td.buttons button', 2)
->assertAttribute('td.buttons button:nth-child(1)', 'title', 'Copy room location')
->assertAttribute('td.buttons button:nth-child(2)', 'title', 'Enter the room');
})
->click('tbody tr:nth-child(1) button:nth-child(2)');
});
$newWindow = collect($browser->driver->getWindowHandles())->last();
$browser->driver->switchTo()->window($newWindow);
$browser->on(new RoomPage('john'))
// check that entering the room skips the logon form
->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->assertVisible('@setup-form')
->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.")
->assertSeeIn('@setup-button', "JOIN")
->click('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form');
});
}
/**
* Test rooms create and edit and delete
*/
public function testRoomCreateAndEditAndDelete(): void
{
$john = $this->getTestUser('john@kolab.org');
$this->browse(function (Browser $browser) {
// Test room creation
$browser->visit(new RoomList())
->assertSeeIn('button.room-new', 'Create room')
->click('button.room-new')
->on(new RoomInfo())
->assertVisible('@intro p')
->assertElementsCount('@nav li', 1)
->assertSeeIn('@nav li a', 'General')
->with('@general form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Description')
->assertFocused('.row:nth-child(1) input')
->assertSeeIn('.row:nth-child(2) label', 'Subscriptions')
->with(new SubscriptionSelect('@skus'), function ($browser) {
$browser->assertElementsCount('tbody tr', 2)
->assertSubscription(
0,
"Standard conference room",
"Audio & video conference room",
"0,00 CHF/month"
)
->assertSubscriptionState(0, true)
->assertSubscription(
1,
"Group conference room",
"Shareable audio & video conference room",
"0,00 CHF/month"
)
->assertSubscriptionState(1, false)
->clickSubscription(1)
->assertSubscriptionState(0, false)
->assertSubscriptionState(1, true);
})
->type('.row:nth-child(1) input', 'test123');
})
->click('@general button[type=submit]')
->assertToast(Toast::TYPE_SUCCESS, "Room created successfully.")
->on(new RoomList())
->whenAvailable('@table', function ($browser) {
$browser->assertElementsCount('tbody tr', 3);
});
$room = Room::where('description', 'test123')->first();
$this->assertTrue($room->hasSKU('group-room'));
// Test room editing
$browser->click("a[href=\"/room/{$room->id}\"]")
->on(new RoomInfo())
->assertSeeIn('.card-title', "Room: {$room->name}")
->assertVisible('@intro p')
->assertVisible("@intro a[href=\"/meet/{$room->name}\"]")
->assertElementsCount('@nav li', 2)
->assertSeeIn('@nav li:first-child a', 'General')
->with('@general form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Description')
->assertFocused('.row:nth-child(1) input')
->type('.row:nth-child(1) input', 'test321')
->assertSeeIn('.row:nth-child(2) label', 'Subscriptions')
->with(new SubscriptionSelect('@skus'), function ($browser) {
$browser->assertElementsCount('tbody tr', 2)
->assertSubscription(
0,
"Standard conference room",
"Audio & video conference room",
"0,00 CHF/month"
)
->assertSubscriptionState(0, false)
->assertSubscription(
1,
"Group conference room",
"Shareable audio & video conference room",
"0,00 CHF/month"
)
->assertSubscriptionState(1, true)
->clickSubscription(0)
->assertSubscriptionState(0, true)
->assertSubscriptionState(1, false);
});
})
->click('@general button[type=submit]')
->assertToast(Toast::TYPE_SUCCESS, "Room updated successfully.")
->on(new RoomList());
$room->refresh();
$this->assertSame('test321', $room->description);
$this->assertFalse($room->hasSKU('group-room'));
// Test room deleting
$browser->visit('/room/' . $room->id)
->on(new Roominfo())
->assertSeeIn('button.button-delete', 'Delete room')
->click('button.button-delete')
->assertToast(Toast::TYPE_SUCCESS, "Room deleted successfully.")
->on(new RoomList())
->whenAvailable('@table', function ($browser) {
$browser->assertElementsCount('tbody tr', 2);
});
});
}
/**
* Test room settings
*/
public function testRoomSettings(): void
{
$this->browse(function (Browser $browser) {
$john = $this->getTestUser('john@kolab.org');
$room = $this->getTestRoom('test', $john->wallets()->first());
// Test that there's no Moderators for non-group rooms
$browser->visit('/room/' . $room->id)
->on(new RoomInfo())
->assertSeeIn('@nav li:last-child a', 'Settings')
->click('@nav li:last-child a')
->with('@settings form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Password')
->assertValue('.row:nth-child(1) input', '')
->assertVisible('.row:nth-child(1) .form-text')
->assertSeeIn('.row:nth-child(2) label', 'Locked room')
->assertNotChecked('.row:nth-child(2) input')
->assertVisible('.row:nth-child(2) .form-text')
->assertSeeIn('.row:nth-child(3) label', 'Subscribers only')
->assertNotChecked('.row:nth-child(3) input')
->assertVisible('.row:nth-child(3) .form-text')
->assertMissing('.row:nth-child(4)'); // no Moderators section on a standard room
});
$room->forceDelete();
$room = $this->getTestRoom('test', $john->wallets()->first(), [], [], 'group-room');
// Now we can assert and change all settings
$browser->visit('/room/' . $room->id)
->on(new RoomInfo())
->assertSeeIn('@nav li:last-child a', 'Settings')
->click('@nav li:last-child a')
->with('@settings form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(4) label', 'Moderators')
->assertVisible('.row:nth-child(4) .form-text')
->type('#acl .input-group:first-child input', 'jack')
->click('#acl a.btn');
})
->click('@settings button[type=submit]')
->assertToast(Toast::TYPE_ERROR, "Form validation error")
->assertSeeIn('#acl + .invalid-feedback', "The specified email address is invalid.")
->with('@settings form', function ($browser) {
$browser->type('.row:nth-child(1) input', 'pass')
->click('.row:nth-child(2) input')
->click('.row:nth-child(3) input')
->click('#acl .input-group:last-child a.btn')
->type('#acl .input-group:first-child input', 'jack@kolab.org')
->click('#acl a.btn');
})
->click('@settings button[type=submit]')
->assertToast(Toast::TYPE_SUCCESS, "Room configuration updated successfully.");
$config = $room->getConfig();
$this->assertSame('pass', $config['password']);
$this->assertSame(true, $config['locked']);
$this->assertSame(true, $config['nomedia']);
$this->assertSame(['jack@kolab.org, full'], $config['acl']);
});
}
/**
* Test acting as a non-controller user
*
* @group meet
*/
public function testNonControllerRooms(): void
{
$jack = $this->getTestUser('jack@kolab.org');
$john = $this->getTestUser('john@kolab.org');
$room = $this->resetTestRoom('shared', [
'password' => 'pass',
'locked' => true,
'nomedia' => true,
'acl' => ['jack@kolab.org, full']
]);
$this->browse(function (Browser $browser) use ($room, $jack) {
$browser->visit(new Home())
->submitLogon('jack@kolab.org', 'simple123', true)
->on(new Dashboard())
->click('@links a.link-chat')
->on(new RoomList())
->assertMissing('button.room-new')
->whenAvailable('@table', function ($browser) {
$browser->assertElementsCount('tbody tr', 2); // one shared room, one owned room
});
// the owned room
$owned = $jack->rooms()->first();
$browser->visit('/room/' . $owned->id)
->on(new RoomInfo())
->assertSeeIn('.card-title', "Room: {$owned->name}")
->assertVisible('@intro p')
->assertVisible("@intro a[href=\"/meet/{$owned->name}\"]")
->assertMissing('button.button-delete')
->assertElementsCount('@nav li', 2)
->with('@general form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Description')
->assertFocused('.row:nth-child(1) input')
+ ->assertMissing('.row:nth-child(2)');
+ /*
->assertSeeIn('.row:nth-child(2) label', 'Subscriptions')
->with(new SubscriptionSelect('@skus'), function ($browser) {
$browser->assertElementsCount('tbody tr', 1)
->assertSubscription(
0,
"Standard conference room",
"Audio & video conference room",
"0,00 CHF/month"
)
->assertSubscriptionState(0, true);
});
+ */
})
->click('@nav li:last-child a')
->with('@settings form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Password')
->assertValue('.row:nth-child(1) input', '')
->assertSeeIn('.row:nth-child(2) label', 'Locked room')
->assertNotChecked('.row:nth-child(2) input')
->assertSeeIn('.row:nth-child(3) label', 'Subscribers only')
->assertNotChecked('.row:nth-child(3) input')
->assertMissing('.row:nth-child(4)');
});
// Shared room
$browser->visit('/room/' . $room->id)
->on(new RoomInfo())
->assertSeeIn('.card-title', "Room: {$room->name}")
->assertVisible('@intro p')
->assertVisible("@intro a[href=\"/meet/{$room->name}\"]")
->assertMissing('button.button-delete')
->assertElementsCount('@nav li', 1)
// Test room settings
->assertSeeIn('@nav li:last-child a', 'Settings')
->with('@settings form', function ($browser) {
$browser->assertSeeIn('.row:nth-child(1) label', 'Password')
->assertValue('.row:nth-child(1) input', 'pass')
->assertSeeIn('.row:nth-child(2) label', 'Locked room')
->assertChecked('.row:nth-child(2) input')
->assertSeeIn('.row:nth-child(3) label', 'Subscribers only')
->assertChecked('.row:nth-child(3) input')
->assertMissing('.row:nth-child(4)')
->type('.row:nth-child(1) input', 'pass123')
->click('.row:nth-child(2) input')
->click('.row:nth-child(3) input');
})
->click('@settings button[type=submit]')
->assertToast(Toast::TYPE_SUCCESS, "Room configuration updated successfully.");
$config = $room->getConfig();
$this->assertSame('pass123', $config['password']);
$this->assertSame(false, $config['locked']);
$this->assertSame(false, $config['nomedia']);
$this->assertSame(['jack@kolab.org, full'], $config['acl']);
$browser->click("@intro a[href=\"/meet/shared\"]")
->on(new RoomPage('shared'))
// check that entering the room skips the logon form
->assertMissing('@toolbar')
->assertMissing('@menu')
->assertMissing('@session')
->assertMissing('@chat')
->assertMissing('@login-form')
->assertVisible('@setup-form')
->assertSeeIn('@setup-status-message', "The room is closed. It will be open for others after you join.")
->assertSeeIn('@setup-button', "JOIN")
->click('@setup-button')
->waitFor('@session')
->assertMissing('@setup-form')
->waitFor('a.meet-nickname svg.moderator');
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 1:07 AM (17 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
119903
Default Alt Text
(46 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment