Commit aaed39d0 authored by Alaa Jwiehan's avatar Alaa Jwiehan Committed by Rajab Natshah
Browse files

Issue #3298632 by Alaa Jwiehan: Functional Automated Testing: Step Definition...

Issue #3298632 by Alaa Jwiehan: Functional Automated Testing: Step Definition to validate if a checkbox input is checked or unchecked
parent 2401e61b
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -2240,6 +2240,40 @@ JS;
    $this->getSession()->executeScript("window.scrollTo(0,document.body.scrollHeight)");
  }

  /**
   * Check if a checkbox is unchecked
   * 
   * Varbase Context #varbase
   * 
   * Example #1: And I should see the "Accept" checkbox unchecked
   * Example #1: Then I should see the "Enable" checkbox unchecked
   * 
   * @Then I should see the :label checkbox unchecked
   */
  public function iShouldSeeTheCheckboxUnchecked($label) {
    $isChecked = (boolean) $this->getSession()->getDriver()->isChecked("//label[contains(text(), '${label}')]/preceding-sibling::input");
    if ($isChecked) {
      throw new \Exception("The '" . $label . "' checkbox is checked");
    } 
  }

  /**
   * Check if a checkbox is checked
   * 
   * Varbase Context #varbase
   * 
   * Example #1: And I should see the "Site Admin" checkbox checked
   * Example #1: Then I should see the "Enable" checkbox checked
   * 
   * @Then I should see the :label checkbox checked
   */
  public function iShouldSeeTheCheckboxChecked($label) {
    $isChecked = (boolean) $this->getSession()->getDriver()->isChecked("//label[contains(text(), '${label}')]/preceding-sibling::input");
    if (!$isChecked) {
      throw new \Exception("The '" . $label . "' checkbox is unchecked");
    } 
  }

  /**
   * Check if the Image media browser opened.
   *
+4 −3
Original line number Diff line number Diff line
@@ -7,8 +7,9 @@ The welcome message is made possible by having Varbase Tour module
      And I go to "/admin/config/varbase/settings"
     Then I should see "Varbase general settings"
      And I should see "Allow site to show welcome message"
      And I check the box "Allow site to show welcome message"
      And I press "Save configuration"
     When I check the box "Allow site to show welcome message"
     Then I should see the "Allow site to show welcome message" checkbox checked
     When I press "Save configuration"
      And I wait
     Then I should see "The configuration options have been saved."

@@ -38,4 +39,4 @@ The welcome message is made possible by having Varbase Tour module
      And I go to "/admin/config/varbase/settings"
     Then I should see "Varbase general settings"
      And I should see "Allow site to show welcome message"
      And the "Allow site to show welcome message" checkbox is unchecked
      And I should see the "Allow site to show welcome message" checkbox unchecked