Commit cce00b6b authored by catch's avatar catch
Browse files

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

(cherry picked from commit e0c8ce15)
parent a5a13278
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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');
    }
  }
+1 −2
Original line number Diff line number Diff line
@@ -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.
+1 −2
Original line number Diff line number Diff line
@@ -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.
+1 −2
Original line number Diff line number Diff line
@@ -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.
+1 −2
Original line number Diff line number Diff line
@@ -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.
Loading