Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2021-03-05 23:39:37 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2021-03-06 03:34:43 +0300
commitf87473e410258fb24ca1391783ec1bc8bf759e9e (patch)
treeb15570195a7befd0c22b9d0466e8255681eec6a3 /tests
parent6d145ea54a4a1a9e83f2c024aa639d92dcc4c39b (diff)
Find elements through the actor rather than the driver
"Actor::find" is a more robust way to look for elements, as it handles some exceptions that may be thrown. Therefore, even if the elements are not actually used and it is only checked whether they exist or not using the actor is the preferred way when possible (and it also makes it consistent with the rest of the acceptance tests). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/features/bootstrap/AppsManagementContext.php34
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/acceptance/features/bootstrap/AppsManagementContext.php b/tests/acceptance/features/bootstrap/AppsManagementContext.php
index 449030e81a8..56ec7c6b85f 100644
--- a/tests/acceptance/features/bootstrap/AppsManagementContext.php
+++ b/tests/acceptance/features/bootstrap/AppsManagementContext.php
@@ -48,6 +48,15 @@ class AppsManagementContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function enableButtonForAnyApp() {
+ return Locator::forThe()->button("Enable")->
+ descendantOf(self::appsList())->
+ describedAs("Enable button in the app list for any app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function downloadAndEnableButtonForApp($app) {
return Locator::forThe()->button("Download and enable")->
descendantOf(self::rowForApp($app))->
@@ -66,6 +75,15 @@ class AppsManagementContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function disableButtonForAnyApp() {
+ return Locator::forThe()->button("Disable")->
+ descendantOf(self::appsList())->
+ describedAs("Disable button in the app list for any app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function bundleButton($bundle) {
return Locator::forThe()->xpath("//div[@class='apps-header']/h2[normalize-space() = '$bundle']/input")->
descendantOf(self::appsList())->
@@ -195,16 +213,24 @@ class AppsManagementContext implements Context, ActorAwareInterface {
* @Given /^I see that there are only disabled apps$/
*/
public function iSeeThatThereAreOnlyDisabledApps() {
- $buttons = $this->actor->getSession()->getDriver()->find("//input[@value = 'Disable']");
- PHPUnit\Framework\Assert::assertEmpty($buttons, 'Found disabled apps');
+ try {
+ $this->actor->find(self::disableButtonForAnyApp(), 2);
+
+ PHPUnit_Framework_Assert::fail("Found enabled apps");
+ } catch (NoSuchElementException $exception) {
+ }
}
/**
* @Given /^I see that there are only enabled apps$/
*/
public function iSeeThatThereAreOnlyEnabledApps() {
- $buttons = $this->actor->getSession()->getDriver()->find("//input[@value = 'Enable']");
- PHPUnit\Framework\Assert::assertEmpty($buttons, 'Found disabled apps');
+ try {
+ $this->actor->find(self::enableButtonForAnyApp(), 2);
+
+ PHPUnit_Framework_Assert::fail("Found disabled apps");
+ } catch (NoSuchElementException $exception) {
+ }
}
/**