Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -2240,6 +2240,40 @@ JS; ...@@ -2240,6 +2240,40 @@ JS;
$this->getSession()->executeScript("window.scrollTo(0,document.body.scrollHeight)"); $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. * Check if the Image media browser opened.
* *
......
...@@ -7,8 +7,9 @@ The welcome message is made possible by having Varbase Tour module ...@@ -7,8 +7,9 @@ The welcome message is made possible by having Varbase Tour module
And I go to "/admin/config/varbase/settings" And I go to "/admin/config/varbase/settings"
Then I should see "Varbase general settings" Then I should see "Varbase general settings"
And I should see "Allow site to show welcome message" And I should see "Allow site to show welcome message"
And I check the box "Allow site to show welcome message" When I check the box "Allow site to show welcome message"
And I press "Save configuration" Then I should see the "Allow site to show welcome message" checkbox checked
When I press "Save configuration"
And I wait And I wait
Then I should see "The configuration options have been saved." 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 ...@@ -38,4 +39,4 @@ The welcome message is made possible by having Varbase Tour module
And I go to "/admin/config/varbase/settings" And I go to "/admin/config/varbase/settings"
Then I should see "Varbase general settings" Then I should see "Varbase general settings"
And I should see "Allow site to show welcome message" 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment