diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-28 03:27:54 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-28 11:41:07 +0300 |
commit | 22be1a93103bc8ef7ddfd65ada12653ba757614f (patch) | |
tree | c147fb316cd225c238f024bbc88583d4e9ee1bce /tests | |
parent | c61047a075d009ffa2bfbfa28c3cacb86b28b47a (diff) |
Add acceptance tests for joining a room with a lobby
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/bootstrap/ConversationInfoContext.php | 84 | ||||
-rw-r--r-- | tests/acceptance/features/lobby.feature | 71 |
2 files changed, 155 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/ConversationInfoContext.php b/tests/acceptance/features/bootstrap/ConversationInfoContext.php index 3186bc7de..39157975b 100644 --- a/tests/acceptance/features/bootstrap/ConversationInfoContext.php +++ b/tests/acceptance/features/bootstrap/ConversationInfoContext.php @@ -127,6 +127,48 @@ class ConversationInfoContext implements Context, ActorAwareInterface { } /** + * @return Locator + */ + public static function enableForAllParticipantsRadioButton() { + // forThe()->radioButton("All participants") can not be used here; that + // would return the radio button itself, but the element that the user + // interacts with is the label. + return Locator::forThe()->css(".all-participants-label")-> + descendantOf(self::roomModerationMenu())-> + describedAs("Enable for all participants button in room moderation menu in conversation info"); + } + + /** + * @return Locator + */ + public static function enableForAllParticipantsRadioButtonInput() { + return Locator::forThe()->radioButton("All participants")-> + descendantOf(self::roomModerationMenu())-> + describedAs("Enable for all participants button input in room moderation menu in conversation info"); + } + + /** + * @return Locator + */ + public static function enableForModeratorsOnlyRadioButton() { + // forThe()->radioButton("Moderators only") can not be used here; that + // would return the radio button itself, but the element that the user + // interacts with is the label. + return Locator::forThe()->css(".moderators-only-label")-> + descendantOf(self::roomModerationMenu())-> + describedAs("Enable for moderators only button in room moderation menu in conversation info"); + } + + /** + * @return Locator + */ + public static function enableForModeratorsOnlyRadioButtonInput() { + return Locator::forThe()->radioButton("Moderators only")-> + descendantOf(self::roomModerationMenu())-> + describedAs("Enable for moderators only button input in room moderation menu in conversation info"); + } + + /** * @Given I rename the conversation to :newConversationName */ public function iRenameTheConversationTo($newConversationName) { @@ -157,6 +199,24 @@ class ConversationInfoContext implements Context, ActorAwareInterface { } /** + * @When I enable the conversation for all participants + */ + public function iEnableTheConversationForAllParticipants() { + $this->showRoomModerationMenu(); + + $this->actor->find(self::enableForAllParticipantsRadioButton(), 2)->click(); + } + + /** + * @When I enable the conversation for moderators only + */ + public function iEnableTheConversationForModeratorsOnly() { + $this->showRoomModerationMenu(); + + $this->actor->find(self::enableForModeratorsOnlyRadioButton(), 2)->click(); + } + + /** * @Then I see that the conversation is password protected */ public function iSeeThatTheConversationIsPasswordProtected() { @@ -180,6 +240,30 @@ class ConversationInfoContext implements Context, ActorAwareInterface { $this->actor->find(self::roomModerationButton(), 2)->click(); } + /** + * @Then I see that the conversation is enabled for all participants + */ + public function iSeeThatTheConversationIsEnabledForAllParticipants() { + $this->showRoomModerationMenu(); + + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::enableForAllParticipantsRadioButtonInput(), 10)->isChecked(), "Enable for all participants radio button is checked"); + + // Hide menu again after checking the button. + $this->actor->find(self::roomModerationButton(), 2)->click(); + } + + /** + * @Then I see that the conversation is enabled for moderators only + */ + public function iSeeThatTheConversationIsEnabledForModeratorsOnly() { + $this->showRoomModerationMenu(); + + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::enableForModeratorsOnlyRadioButtonInput(), 10)->isChecked(), "Enable for moderators only radio button is checked"); + + // Hide menu again after checking the button. + $this->actor->find(self::roomModerationButton(), 2)->click(); + } + private function showRoomModerationMenu() { // The room moderation menu is hidden after clicking on an action of the // menu. Therefore, if the menu is visible, wait a little just in case diff --git a/tests/acceptance/features/lobby.feature b/tests/acceptance/features/lobby.feature new file mode 100644 index 000000000..0c1a96e35 --- /dev/null +++ b/tests/acceptance/features/lobby.feature @@ -0,0 +1,71 @@ +Feature: lobby + + Scenario: join public lobby as a user + Given I act as John + And I am logged in + And I have opened the Talk app + And I create a public conversation named "Public" + And I enable the conversation for moderators only + And I see that the conversation is enabled for moderators only + And I write down the public conversation link + And I add "admin" to the participants + When I act as Jane + And I am logged in as the admin + And I visit the public conversation link I wrote down + Then I see that the "Public" conversation is active + And I see that the "Public Waiting for the conversation to be opened" empty content message is shown in the main view + And I see that the sidebar is closed + + Scenario: join public lobby as a self-joined user + Given I act as John + And I am logged in + And I have opened the Talk app + And I create a public conversation named "Public" + And I enable the conversation for moderators only + And I see that the conversation is enabled for moderators only + And I write down the public conversation link + When I act as Jane + And I am logged in as the admin + And I visit the public conversation link I wrote down + Then I see that the "Public" conversation is active + And I see that the "Public Waiting for the conversation to be opened" empty content message is shown in the main view + And I see that the sidebar is closed + + + + Scenario: join public lobby protected by password as a user + Given I act as John + And I am logged in + And I have opened the Talk app + And I create a public conversation named "Public" + And I enable the conversation for moderators only + And I see that the conversation is enabled for moderators only + And I protect the conversation with the password "abcdef" + And I see that the conversation is password protected + And I write down the public conversation link + And I add "admin" to the participants + When I act as Jane + And I am logged in as the admin + And I visit the public conversation link I wrote down + Then I see that the "Public" conversation is active + And I see that the "Public Waiting for the conversation to be opened" empty content message is shown in the main view + And I see that the sidebar is closed + + Scenario: join public lobby protected by password as a self-joined user + Given I act as John + And I am logged in + And I have opened the Talk app + And I create a public conversation named "Public" + And I enable the conversation for moderators only + And I see that the conversation is enabled for moderators only + And I protect the conversation with the password "abcdef" + And I see that the conversation is password protected + And I write down the public conversation link + When I act as Jane + And I am logged in as the admin + And I visit the public conversation link I wrote down + And I see that the current page is the Authenticate page for the public conversation link I wrote down + And I authenticate with password "abcdef" in public conversation + Then I see that the "Public" conversation is active + And I see that the "Public Waiting for the conversation to be opened" empty content message is shown in the main view + And I see that the sidebar is closed |