Commit c4506b22 authored by Vincent Petry's avatar Vincent Petry Committed by GitHub

Merge pull request #27407 from owncloud/ui_tests_better_waiting

better waiting for the filesPage to be loaded during UI tests
parents e3fc1376 e5d1c36e
......@@ -46,6 +46,7 @@ class FeatureContext extends RawMinkContext implements Context
{
$this->loginPage->open();
$this->filesPage = $this->loginPage->loginAs("admin", "admin");
$this->filesPage->waitTillPageIsloaded(10);
}
/**
......
......@@ -53,7 +53,7 @@ class LoginContext extends RawMinkContext implements Context
public function iLoginWithUsernameAndPassword($username, $password)
{
$this->filesPage = $this->loginPage->loginAs($username, $password);
$this->loginPage->waitTillPageIsloaded(10);
$this->filesPage->waitTillPageIsloaded(10);
}
/**
......
......@@ -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);
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment