/** * @param string $rows * * @throws ExpectationException * * @Then /^the rows? "([^"]*)" should be checked$/ */ public function theRowShouldBeChecked($rows) { $rows = $this->getMainContext()->listToArray($rows); foreach ($rows as $row) { $gridRow = $this->datagrid->getRow($row); $checkbox = $gridRow->find('css', 'td.boolean-cell input[type="checkbox"]:not(:disabled)'); if (!$checkbox) { throw $this->createExpectationException(sprintf('Unable to find a checkbox for row %s', $row)); } if (!$checkbox->isChecked()) { throw $this->createExpectationException(sprintf('Expecting row %s to be checked', $row)); } } }
/** * @param string $rows * * @throws ExpectationException * * @Then /^the rows? "([^"]*)" should not be checked$/ */ public function theRowShouldBeUnchecked($rows) { $rows = $this->getMainContext()->listToArray($rows); foreach ($rows as $row) { $this->spin(function () use($row) { $gridRow = $this->datagrid->getRow($row); $checkbox = $gridRow->find('css', 'td.boolean-cell input[type="checkbox"]:not(:disabled)'); if (!$checkbox) { return false; } return !$checkbox->isChecked(); }, sprintf('Fail asserting that "%s" row was unchecked', $row)); } }