]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add locator for apps list
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 5 Mar 2021 20:33:29 +0000 (21:33 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 8 Mar 2021 07:59:35 +0000 (07:59 +0000)
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tests/acceptance/features/bootstrap/AppsManagementContext.php

index 2b53ee3222b026846f7c53f9087bc4d47034d3bc..449030e81a86461eec53b065da02ec99332f015e 100644 (file)
@@ -28,6 +28,14 @@ use Behat\Behat\Context\Context;
 class AppsManagementContext implements Context, ActorAwareInterface {
        use ActorAware;
 
+       /**
+        * @return Locator
+        */
+       public static function appsList() {
+               return Locator::forThe()->xpath("//main[@id='app-content' or contains(@class, 'app-content')]//div[@id='apps-list']")->
+                               describedAs("Apps list in Apps Management");
+       }
+
        /**
         * @return Locator
         */
@@ -59,7 +67,8 @@ class AppsManagementContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function bundleButton($bundle) {
-               return Locator::forThe()->xpath("//main[@id='app-content' or contains(@class, 'app-content')]//div[@class='apps-header']/h2[normalize-space() = '$bundle']/input")->
+               return Locator::forThe()->xpath("//div[@class='apps-header']/h2[normalize-space() = '$bundle']/input")->
+                               descendantOf(self::appsList())->
                                describedAs("Button to enable / disable bundles");
        }
 
@@ -67,7 +76,8 @@ class AppsManagementContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function rowForApp($app) {
-               return Locator::forThe()->xpath("//main[@id='app-content' or contains(@class, 'app-content')]//div[@class='app-name'][normalize-space() = '$app']/..")->
+               return Locator::forThe()->xpath("//div[@class='app-name'][normalize-space() = '$app']/..")->
+                               descendantOf(self::appsList())->
                                describedAs("Row for app $app in Apps Management");
        }
 
@@ -75,7 +85,8 @@ class AppsManagementContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function emptyAppList() {
-               return Locator::forThe()->xpath("//main[@id='app-content' or contains(@class, 'app-content')]//div[@id='apps-list-empty']")->
+               return Locator::forThe()->xpath("//div[@id='apps-list-empty']")->
+                               descendantOf(self::appsList())->
                                describedAs("Empty apps list view");
        }
 
@@ -83,7 +94,8 @@ class AppsManagementContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function appEntries() {
-               return Locator::forThe()->xpath("//main[@id='app-content' or contains(@class, 'app-content')]//div[@class='section']")->
+               return Locator::forThe()->xpath("//div[@class='section']")->
+                               descendantOf(self::appsList())->
                                describedAs("Entries in apps list");
        }