aboutsummaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/FilesAppContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acceptance/features/bootstrap/FilesAppContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php136
1 files changed, 95 insertions, 41 deletions
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index 631eb60393d..bb088c0a2c3 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -44,31 +44,6 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
- public static function appNavigation() {
- return Locator::forThe()->id("app-navigation")->
- describedAs("App navigation");
- }
-
- /**
- * @return Locator
- */
- public static function appNavigationSectionItemFor($sectionText) {
- return Locator::forThe()->xpath("//li[normalize-space() = '$sectionText']")->
- descendantOf(self::appNavigation())->
- describedAs($sectionText . " section item in App Navigation");
- }
-
- /**
- * @return Locator
- */
- public static function appNavigationCurrentSectionItem() {
- return Locator::forThe()->css(".active")->descendantOf(self::appNavigation())->
- describedAs("Current section item in App Navigation");
- }
-
- /**
- * @return Locator
- */
public static function mainViewForSection($section) {
$sectionId = self::sections()[$section];
@@ -123,7 +98,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
- public static function inputFieldForTagsInCurrentSectionDetails() {
+ public static function inputFieldForTagsInCurrentSectionDetailsView() {
return Locator::forThe()->css(".systemTagsInfoView")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Input field for tags in current section details view in Files app");
@@ -132,6 +107,41 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag) {
+ return Locator::forThe()->xpath("//span[normalize-space() = '$tag']")->
+ descendantOf(self::inputFieldForTagsInCurrentSectionDetailsView())->
+ describedAs("Item in input field for tags in current section details view for tag $tag in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function itemInDropdownForTag($tag) {
+ return Locator::forThe()->xpath("//*[contains(concat(' ', normalize-space(@class), ' '), ' select2-result-label ')]//span[normalize-space() = '$tag']/ancestor::li")->
+ descendantOf(self::select2Dropdown())->
+ describedAs("Item in dropdown for tag $tag in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function checkmarkInItemInDropdownForTag($tag) {
+ return Locator::forThe()->css(".checkmark")->
+ descendantOf(self::itemInDropdownForTag($tag))->
+ describedAs("Checkmark in item in dropdown for tag $tag in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ private static function select2Dropdown() {
+ return Locator::forThe()->css("#select2-drop")->
+ describedAs("Select2 dropdown in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function tabHeaderInCurrentSectionDetailsViewNamed($tabHeaderName) {
return Locator::forThe()->xpath("//li[normalize-space() = '$tabHeaderName']")->
descendantOf(self::tabHeadersInCurrentSectionDetailsView())->
@@ -355,13 +365,6 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
- * @Given I open the :section section
- */
- public function iOpenTheSection($section) {
- $this->actor->find(self::appNavigationSectionItemFor($section), 10)->click();
- }
-
- /**
* @Given I open the details view for :fileName
*/
public function iOpenTheDetailsViewFor($fileName) {
@@ -428,6 +431,24 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @When I check the tag :tag in the dropdown for tags in the details view
+ */
+ public function iCheckTheTagInTheDropdownForTagsInTheDetailsView($tag) {
+ $this->iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($tag);
+
+ $this->actor->find(self::itemInDropdownForTag($tag), 10)->click();
+ }
+
+ /**
+ * @When I uncheck the tag :tag in the dropdown for tags in the details view
+ */
+ public function iUncheckTheTagInTheDropdownForTagsInTheDetailsView($tag) {
+ $this->iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsChecked($tag);
+
+ $this->actor->find(self::itemInDropdownForTag($tag), 10)->click();
+ }
+
+ /**
* @When I protect the shared link with the password :password
*/
public function iProtectTheSharedLinkWithThePassword($password) {
@@ -446,13 +467,6 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
- * @Then I see that the current section is :section
- */
- public function iSeeThatTheCurrentSectionIs($section) {
- PHPUnit_Framework_Assert::assertEquals($this->actor->find(self::appNavigationCurrentSectionItem(), 10)->getText(), $section);
- }
-
- /**
* @Then I see that the details view for :section section is open
*/
public function iSeeThatTheDetailsViewForSectionIsOpen($section) {
@@ -511,7 +525,47 @@ class FilesAppContext implements Context, ActorAwareInterface {
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {
PHPUnit_Framework_Assert::assertTrue(
- $this->actor->find(self::inputFieldForTagsInCurrentSectionDetails(), 10)->isVisible());
+ $this->actor->find(self::inputFieldForTagsInCurrentSectionDetailsView(), 10)->isVisible());
+ }
+
+ /**
+ * @Then I see that the input field for tags in the details view contains the tag :tag
+ */
+ public function iSeeThatTheInputFieldForTagsInTheDetailsViewContainsTheTag($tag) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag), 10)->isVisible());
+ }
+
+ /**
+ * @Then I see that the input field for tags in the details view does not contain the tag :tag
+ */
+ public function iSeeThatTheInputFieldForTagsInTheDetailsViewDoesNotContainTheTag($tag) {
+ $this->iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown();
+
+ try {
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::itemInInputFieldForTagsInCurrentSectionDetailsViewForTag($tag))->isVisible());
+ } catch (NoSuchElementException $exception) {
+ }
+ }
+
+ /**
+ * @Then I see that the tag :tag in the dropdown for tags in the details view is checked
+ */
+ public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsChecked($tag) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::checkmarkInItemInDropdownForTag($tag), 10)->isVisible());
+ }
+
+ /**
+ * @Then I see that the tag :tag in the dropdown for tags in the details view is not checked
+ */
+ public function iSeeThatTheTagInTheDropdownForTagsInTheDetailsViewIsNotChecked($tag) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::itemInDropdownForTag($tag), 10)->isVisible());
+
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::checkmarkInItemInDropdownForTag($tag))->isVisible());
}
/**