Skip to content

Commit

Permalink
Merge pull request #28814 from owncloud/ui-tests-navigate-into-folder
Browse files Browse the repository at this point in the history
UI tests structure to open a subfolder
  • Loading branch information
individual-it authored Aug 29, 2017
2 parents 6002f15 + 9f81f70 commit 8e08a69
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ui/features/bootstrap/FilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ public function iMarkTheseFilesForBatchAction(TableNode $files) {
}
}

/**
* @When I open the file/folder :name
* @param string $name
* @return void
*/
public function iOpenTheFolder($name) {
$this->filesPage->waitTillPageIsLoaded($this->getSession());
$this->filesPage->openFile($name, $this->getSession());
$this->filesPage->waitTillPageIsLoaded($this->getSession());
}

/**
* @Then the file/folder :name should be listed
* @param string $name
Expand Down
11 changes: 11 additions & 0 deletions tests/ui/features/lib/FilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ public function findFileActionMenuElement() {
}
}

/**
* opens a file or navigates into a folder
*
* @param string $name
* @param Session $session
* @return void
*/
public function openFile($name, Session $session) {
$fileRow = $this->findFileRowByName($name, $session);
$fileRow->openFileFolder();
}
/**
* renames a file
* @param string|array $fromFileName
Expand Down
26 changes: 26 additions & 0 deletions tests/ui/features/lib/FilesPageElement/FileRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class FileRow extends OwnCloudPage {
protected $fileBusyIndicatorXpath = ".//*[@class='thumbnail' and contains(@style,'loading')]";
protected $fileTooltipXpath = ".//*[@class='tooltip-inner']";
protected $thumbnailXpath = "//*[@class='thumbnail']";
protected $fileLinkXpath = "//span[@class='nametext']";

/**
* sets the NodeElement for the current file row
Expand Down Expand Up @@ -235,4 +236,29 @@ public function findThumbnail() {
public function selectForBatchAction() {
$this->findThumbnail()->click();
}

/**
* find and return the link to the file/folder
*
* @throws ElementNotFoundException
* @return \Behat\Mink\Element\NodeElement
*/
public function findFileLink() {
$linkElement = $this->rowElement->find("xpath", $this->fileLinkXpath);
if (is_null($linkElement)) {
throw new ElementNotFoundException(
"could not find link to " . $this->name
);
}
return $linkElement;
}

/**
* opens the current file or folder by clicking on the link
*
* @return void
*/
public function openFileFolder() {
$this->findFileLink()->click();
}
}
3 changes: 3 additions & 0 deletions tests/ui/features/other/sharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Feature: Sharing
And the folder "simple-folder (2)" should be marked as shared by "User Two"
And the file "testimage (2).jpg" should be listed
And the file "testimage (2).jpg" should be marked as shared by "User Two"
And I open the folder "simple-folder (2)"
Then the file "lorem.txt" should be listed
But the folder "simple-folder (2)" should not be listed

Scenario: share a folder with an internal group
And I logout
Expand Down

0 comments on commit 8e08a69

Please sign in to comment.