Skip to content

Commit

Permalink
better waiting for the filesPage to be loaded during UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed Mar 17, 2017
1 parent 648e749 commit e5d1c36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/ui/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function setUpScenario()
{
$this->loginPage->open();
$this->filesPage = $this->loginPage->loginAs("admin", "admin");
$this->filesPage->waitTillPageIsloaded(10);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/features/bootstrap/LoginContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function iAmOnLoginPage()
public function iLoginWithUsernameAndPassword($username, $password)
{
$this->filesPage = $this->loginPage->loginAs($username, $password);
$this->loginPage->waitTillPageIsloaded(10);
$this->filesPage->waitTillPageIsloaded(10);
}

/**
Expand Down
20 changes: 20 additions & 0 deletions tests/ui/features/lib/FilesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,28 @@ class FilesPage extends OwnCloudPage
* @var string $path
*/
protected $path = '/index.php/apps/files/';

protected $emptyContentXpath = ".//*[@id='emptycontent']";
public function findFileInList($filename)
{
return $this->findLink($filename);
}

//there is no reliable loading indicator on the files page, so waiting for
//the table or the Emplty Folder message to be shown
public function waitTillPageIsloaded($timeout)
{
for ($counter = 0; $counter <= $timeout; $counter ++) {

$fileList = $this->findById("fileList");

if ($fileList !== null &&
($fileList->has("xpath", "//a") || ! $this->find("xpath",
$this->emptyContentXpath)->hasClass("hidden"))) {
break;
}

sleep(1);
}
}
}

0 comments on commit e5d1c36

Please sign in to comment.