commit 6981415356d2fd12941c94950a7bace47f689638 Author: Pieter Frenssen Date: Sun Mar 13 11:35:32 2016 +0200 195 diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php index e917829..2559bb4 100644 --- a/core/modules/simpletest/src/BrowserTestBase.php +++ b/core/modules/simpletest/src/BrowserTestBase.php @@ -1356,6 +1356,53 @@ protected function drupalUserIsLoggedIn(UserInterface $account) { } /** + * Asserts that the element with the given CSS selector is present. + * + * @param string $css_selector + * The CSS selector identifying the element to check. + * @param string $message + * Optional message to show alongside the assertion. + */ + protected function assertElementPresent($css_selector, $message = '') { + $this->assertNotEmpty($this->getSession()->getDriver()->find($this->selectorToXpath($css_selector)), $message); + } + + /** + * Asserts that the element with the given CSS selector is not present. + * + * @param string $css_selector + * The CSS selector identifying the element to check. + * @param string $message + * Optional message to show alongside the assertion. + */ + protected function assertElementNotPresent($css_selector, $message = '') { + $this->assertEmpty($this->getSession()->getDriver()->find($this->selectorToXpath($css_selector)), $message); + } + + /** + * Clicks the element with the given CSS selector. + * + * @param string $css_selector + * The CSS selector identifying the element to click. + */ + protected function click($css_selector) { + $this->getSession()->getDriver()->click($this->selectorToXpath($css_selector)); + } + + /** + * Converts the given CSS selector to an XPath expression. + * + * @param string $css_selector + * The CSS selector to convert. + * + * @return string + * The converted XPath expression. + */ + protected function selectorToXpath($css_selector) { + return $this->getSession()->getSelectorsHandler()->selectorToXpath('css', $css_selector); + } + + /** * Prevents serializing any properties. * * Browser tests are run in a separate process. To do this PHPUnit creates a diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php index 043ba84..29eb744 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php @@ -58,40 +58,6 @@ protected function assertElementNotVisible($css_selector, $message = '') { } /** - * Asserts that the element with the given CSS selector is present. - * - * @param string $css_selector - * The CSS selector identifying the element to check. - * @param string $message - * Optional message to show alongside the assertion. - */ - protected function assertElementPresent($css_selector, $message = '') { - $this->assertNotEmpty($this->getSession()->getDriver()->find($this->selectorToXpath($css_selector)), $message); - } - - /** - * Asserts that the element with the given CSS selector is not present. - * - * @param string $css_selector - * The CSS selector identifying the element to check. - * @param string $message - * Optional message to show alongside the assertion. - */ - protected function assertElementNotPresent($css_selector, $message = '') { - $this->assertEmpty($this->getSession()->getDriver()->find($this->selectorToXpath($css_selector)), $message); - } - - /** - * Clicks the element with the given CSS selector. - * - * @param string $css_selector - * The CSS selector identifying the element to click. - */ - protected function click($css_selector) { - $this->getSession()->getDriver()->click($this->selectorToXpath($css_selector)); - } - - /** * Waits for the given time or until the given JS condition becomes TRUE. * * @param int $timeout @@ -106,17 +72,4 @@ protected function wait($timeout, $condition = FALSE) { return $this->getSession()->getDriver()->wait($timeout, $condition); } - /** - * Converts the given CSS selector to an XPath expression. - * - * @param string $css_selector - * The CSS selector to convert. - * - * @return string - * The converted XPath expression. - */ - protected function selectorToXpath($css_selector) { - return $this->getSession()->getSelectorsHandler()->selectorToXpath('css', $css_selector); - } - }