Commit cce00b6b authored by catch's avatar catch

Issue #3184632 by longwave: Convert assertions involving use of xpath on submit inputs to WebAssert

(cherry picked from commit e0c8ce15)
parent a5a13278
......@@ -16,10 +16,6 @@ trait AssertButtonsTrait {
* Whether to check if the buttons are in a dropbutton widget or not.
*/
public function assertButtons(array $buttons, $dropbutton = TRUE) {
// Try to find a Save button.
$save_button = $this->xpath('//input[@type="submit"][@value="Save"]');
// Verify that the number of buttons passed as parameters is
// available in the dropbutton widget.
if ($dropbutton) {
......@@ -27,7 +23,7 @@ public function assertButtons(array $buttons, $dropbutton = TRUE) {
$count = count($buttons);
// Assert there is no save button.
$this->assertTrue(empty($save_button));
$this->assertSession()->buttonNotExists('Save');
// Dropbutton elements.
/** @var \Behat\Mink\Element\NodeElement[] $elements */
......@@ -41,7 +37,7 @@ public function assertButtons(array $buttons, $dropbutton = TRUE) {
}
else {
// Assert there is a save button.
$this->assertTrue(!empty($save_button));
$this->assertSession()->buttonExists('Save');
$this->assertNoRaw('dropbutton-wrapper');
}
}
......
......@@ -89,8 +89,7 @@ protected function setUpProfile() {
protected function setUpSettings() {
// The language should have been automatically detected, all following
// screens should be translated already.
$elements = $this->xpath('//input[@type="submit"]/@value');
$this->assertEqual(current($elements)->getText(), 'Save and continue de');
$this->assertSession()->buttonExists('Save and continue de');
$this->translations['Save and continue'] = 'Save and continue de';
// Check the language direction.
......
......@@ -80,8 +80,7 @@ protected function setUpProfile() {
protected function setUpSettings() {
// The language should have been automatically detected, all following
// screens should be translated already.
$elements = $this->xpath('//input[@type="submit"]/@value');
$this->assertEqual(current($elements)->getText(), 'Save and continue de');
$this->assertSession()->buttonExists('Save and continue de');
$this->translations['Save and continue'] = 'Save and continue de';
// Check the language direction.
......
......@@ -32,8 +32,7 @@ protected function setUpLanguage() {
parent::setUpLanguage();
// After selecting a different language than English, all following screens
// should be translated already.
$elements = $this->xpath('//input[@type="submit"]/@value');
$this->assertEqual(current($elements)->getText(), 'Save and continue Arabic');
$this->assertSession()->buttonExists('Save and continue Arabic');
$this->translations['Save and continue'] = 'Save and continue Arabic';
// Verify that language direction is right-to-left.
......
......@@ -37,8 +37,7 @@ protected function visitInstaller() {
// The language should have been automatically detected, all following
// screens should be translated already.
$elements = $this->xpath('//input[@type="submit"]/@value');
$this->assertEqual(current($elements)->getText(), 'Save and continue de');
$this->assertSession()->buttonExists('Save and continue de');
$this->translations['Save and continue'] = 'Save and continue de';
// Check the language direction.
......
......@@ -36,8 +36,7 @@ protected function setUpLanguage() {
// After selecting a different language than English, all following screens
// should be translated already.
$elements = $this->xpath('//input[@type="submit"]/@value');
$this->assertEqual(current($elements)->getText(), 'Save and continue de');
$this->assertSession()->buttonExists('Save and continue de');
$this->translations['Save and continue'] = 'Save and continue de';
// Check the language direction.
......
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