I’m working with an automated script for multiple checkboxes that has dependent permissions.
Given there are multiple checkboxes
Checkbox A
Checkbox B
Checkbox C
Checkbox D
Checkbox E
When I select Checkbox A
Then Checkbox C and Checkbox E is selected
I’ve handled this using a switch statement because there are multiple combinations but its kind of messy because certain checkbox(es) are not only selected but disabled as well due to the dependent permissions:
e.g.
public boolean multipleCheckboxVerification(String roleName) {
switch (roleName) {
case CheckboxA:
return permissionPage.isSelectedChkA() && permissionPage.isSelectedChkC()
&& permissionPage.isSelectedChkE() && !permissionPage.isEnabledChkC() && !permissionPage.isEnabledChk();}
May I kindly know if there is a cleaner way to return which checkbox isn’t as expected?
I’m currently just using assertTrue from TestNG but the output seems to be vague of which checkbox is actually failing.
I was looking for an output where the error message would display “Checkbox E is enabled where it should be disabled”
Source: Read More