diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-26 00:08:48 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2019-08-28 10:09:38 +0200 |
commit | 7a2e19553f57e9d7792adf0e4d3913a00ffca30e (patch) | |
tree | 624d6b7582347cd75ff21b5f23876528a533bb9f /tests/acceptance | |
parent | 039a0e8968ecab43ec1a7020fbaa81e8826b20f3 (diff) |
Move password from its own menu to the room moderation menu
The password input is no longer the only element of the menu so pressing
"Esc" does not close the menu.
There is no longer a password button in the CallInfoView, so now the
acceptance tests need to open the room moderation menu to know if the
conversation is password protected or not.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance')
-rw-r--r-- | tests/acceptance/features/bootstrap/ConversationInfoContext.php | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/tests/acceptance/features/bootstrap/ConversationInfoContext.php b/tests/acceptance/features/bootstrap/ConversationInfoContext.php index 29a7e4d34..3186bc7de 100644 --- a/tests/acceptance/features/bootstrap/ConversationInfoContext.php +++ b/tests/acceptance/features/bootstrap/ConversationInfoContext.php @@ -84,10 +84,19 @@ class ConversationInfoContext implements Context, ActorAwareInterface { /** * @return Locator */ - public static function passwordButton() { - return Locator::forThe()->css(".password-button")-> + public static function roomModerationButton() { + return Locator::forThe()->css(".room-moderation-button")-> descendantOf(self::conversationInfoContainer())-> - describedAs("Password button in conversation info"); + describedAs("Room moderation button in conversation info"); + } + + /** + * @return Locator + */ + public static function roomModerationMenu() { + return Locator::forThe()->css(".menu")-> + descendantOf(self::roomModerationButton())-> + describedAs("Room moderation menu in conversation info"); } /** @@ -95,8 +104,8 @@ class ConversationInfoContext implements Context, ActorAwareInterface { */ public static function passwordIcon() { return Locator::forThe()->css(".icon-password")-> - descendantOf(self::passwordButton())-> - describedAs("Password icon in conversation info"); + descendantOf(self::roomModerationMenu())-> + describedAs("Password icon in room moderation menu in conversation info"); } /** @@ -104,8 +113,8 @@ class ConversationInfoContext implements Context, ActorAwareInterface { */ public static function noPasswordIcon() { return Locator::forThe()->css(".icon-no-password")-> - descendantOf(self::passwordButton())-> - describedAs("No password icon in conversation info"); + descendantOf(self::roomModerationMenu())-> + describedAs("No password icon in room moderation menu in conversation info"); } /** @@ -113,8 +122,8 @@ class ConversationInfoContext implements Context, ActorAwareInterface { */ public static function passwordField() { return Locator::forThe()->css(".password-input")-> - descendantOf(self::conversationInfoContainer())-> - describedAs("Password field in conversation info"); + descendantOf(self::roomModerationMenu())-> + describedAs("Password field in room moderation menu in conversation info"); } /** @@ -142,7 +151,7 @@ class ConversationInfoContext implements Context, ActorAwareInterface { * @When I protect the conversation with the password :password */ public function iProtectTheConversationWithThePassword($password) { - $this->actor->find(self::passwordButton(), 2)->click(); + $this->showRoomModerationMenu(); $this->actor->find(self::passwordField(), 2)->setValue($password . "\r"); } @@ -151,14 +160,38 @@ class ConversationInfoContext implements Context, ActorAwareInterface { * @Then I see that the conversation is password protected */ public function iSeeThatTheConversationIsPasswordProtected() { + $this->showRoomModerationMenu(); + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordIcon(), 10)->isVisible(), "Password icon is visible"); + + // Hide menu again after checking the icon. + $this->actor->find(self::roomModerationButton(), 2)->click(); } /** * @Then I see that the conversation is not password protected */ public function iSeeThatTheConversationIsNotPasswordProtected() { + $this->showRoomModerationMenu(); + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::noPasswordIcon(), 10)->isVisible(), "No password icon is visible"); + + // Hide menu again after checking the icon. + $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 + // it is in the process of being hidden due to a previous action. + if (!WaitFor::elementToBeEventuallyNotShown( + $this->actor, + self::roomModerationMenu(), + $timeout = 5 * $this->actor->getFindTimeoutMultiplier())) { + PHPUnit_Framework_Assert::fail("The room moderation menu is still shown after $timeout seconds"); + } + + $this->actor->find(self::roomModerationButton(), 10)->click(); } } |