summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/FileListContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acceptance/features/bootstrap/FileListContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/FileListContext.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/FileListContext.php b/tests/acceptance/features/bootstrap/FileListContext.php
index 55db746c7c1..cdf2e6acc6e 100644
--- a/tests/acceptance/features/bootstrap/FileListContext.php
+++ b/tests/acceptance/features/bootstrap/FileListContext.php
@@ -133,6 +133,48 @@ class FileListContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function fileListHeader($fileListAncestor) {
+ return Locator::forThe()->css("thead")->
+ descendantOf($fileListAncestor)->
+ describedAs("Header in file list");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function selectedFilesActionsMenuButton($fileListAncestor) {
+ return Locator::forThe()->css(".actions-selected")->
+ descendantOf(self::fileListHeader($fileListAncestor))->
+ describedAs("Selected files actions menu button in file list");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function selectedFilesActionsMenu() {
+ return Locator::forThe()->css(".filesSelectMenu")->
+ describedAs("Selected files actions menu in file list");
+ }
+
+ /**
+ * @return Locator
+ */
+ private static function selectedFilesActionsMenuItemFor($itemText) {
+ return Locator::forThe()->xpath("//a[normalize-space() = '$itemText']")->
+ descendantOf(self::selectedFilesActionsMenu())->
+ describedAs($itemText . " item in selected files actions menu in file list");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function moveOrCopySelectedFilesMenuItem() {
+ return self::selectedFilesActionsMenuItemFor("Move or copy");
+ }
+
+ /**
+ * @return Locator
+ */
public static function rowForFile($fileListAncestor, $fileName) {
return Locator::forThe()->xpath("//*[@id = 'fileList']//span[contains(concat(' ', normalize-space(@class), ' '), ' nametext ') and normalize-space() = '$fileName']/ancestor::tr")->
descendantOf($fileListAncestor)->
@@ -151,6 +193,26 @@ class FileListContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function selectionCheckboxForFile($fileListAncestor, $fileName) {
+ // Note that the element that the user interacts with is the label, not
+ // the checbox itself.
+ return Locator::forThe()->css(".selection label")->
+ descendantOf(self::rowForFile($fileListAncestor, $fileName))->
+ describedAs("Selection checkbox for file $fileName in file list");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function selectionCheckboxInputForFile($fileListAncestor, $fileName) {
+ return Locator::forThe()->css(".selection input[type=checkbox]")->
+ descendantOf(self::rowForFile($fileListAncestor, $fileName))->
+ describedAs("Selection checkbox input for file $fileName in file list");
+ }
+
+ /**
+ * @return Locator
+ */
public static function favoriteMarkForFile($fileListAncestor, $fileName) {
return Locator::forThe()->css(".favorite-mark")->
descendantOf(self::rowForFile($fileListAncestor, $fileName))->
@@ -304,6 +366,24 @@ class FileListContext implements Context, ActorAwareInterface {
}
/**
+ * @Given I select :fileName
+ */
+ public function iSelect($fileName) {
+ $this->iSeeThatIsNotSelected($fileName);
+
+ $this->actor->find(self::selectionCheckboxForFile($this->fileListAncestor, $fileName), 10)->click();
+ }
+
+ /**
+ * @Given I start the move or copy operation for the selected files
+ */
+ public function iStartTheMoveOrCopyOperationForTheSelectedFiles() {
+ $this->actor->find(self::selectedFilesActionsMenuButton($this->fileListAncestor), 10)->click();
+
+ $this->actor->find(self::moveOrCopySelectedFilesMenuItem(), 2)->click();
+ }
+
+ /**
* @Given I open the details view for :fileName
*/
public function iOpenTheDetailsViewFor($fileName) {
@@ -446,6 +526,13 @@ class FileListContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that :fileName is not selected
+ */
+ public function iSeeThatIsNotSelected($fileName) {
+ PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::selectionCheckboxInputForFile($this->fileListAncestor, $fileName), 10)->isChecked());
+ }
+
+ /**
* @Then I see that :fileName is marked as favorite
*/
public function iSeeThatIsMarkedAsFavorite($fileName) {