Skip to content

Commit

Permalink
Merge pull request #32631 from owncloud/stable10-moveGetTitleToPageOb…
Browse files Browse the repository at this point in the history
…ject

[stable10] move getPageTitle() to pageObject
  • Loading branch information
Vincent Petry authored Sep 7, 2018
2 parents 6f9f5fc + bcd3cba commit be93d3c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 1 addition & 4 deletions tests/acceptance/features/bootstrap/WebUIGeneralContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,7 @@ public function dialogsShouldBeDisplayedOnTheWebUI(
*/
public function theUserShouldBeRedirectedToAWebUIPageWithTheTitle($title) {
$this->owncloudPage->waitForOutstandingAjaxCalls($this->getSession());
$actualTitle = $this->getSession()->getPage()->find(
'xpath', './/title'
)->getHtml();
PHPUnit_Framework_Assert::assertEquals($title, \trim($actualTitle));
PHPUnit_Framework_Assert::assertEquals($title, $this->owncloudPage->getPageTitle());
}

/**
Expand Down
16 changes: 16 additions & 0 deletions tests/acceptance/features/lib/OwncloudPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class OwncloudPage extends Page {
protected $notificationId = "notification";
protected $ocDialogXpath = ".//*[@class='oc-dialog']";
protected $avatarImgXpath = ".//div[@id='settings']//div[contains(@class, 'avatardiv')]/img";
protected $titleXpath = ".//title";

/**
* used to store the unchanged path string when $path gets changed
Expand Down Expand Up @@ -181,6 +182,21 @@ public function getNotifications() {
return $notificationsText;
}

/**
*
* @throws ElementNotFoundException
* @return string
*/
public function getPageTitle() {
$title = $this->find('xpath', $this->titleXpath);
if ($title === null) {
throw new ElementNotFoundException(
__METHOD__ . " could not find title element"
);
}
return \trim($title->getHtml());
}

/**
* Get all open oc dialogs
*
Expand Down

0 comments on commit be93d3c

Please sign in to comment.