MDL-53810 behat: Zoom in Rubric before filling form.

div is now overflow, selenium can't get element
in viewport, zoom in before entering the value
This commit is contained in:
Rajesh Taneja 2016-05-05 14:48:28 +08:00 committed by Andrew Nicols
parent a8abd53a32
commit c5fe77ffe4

View File

@ -281,6 +281,11 @@ class behat_gradingform_rubric extends behat_base {
$stepusage = '"I grade by filling the rubric with:" step needs you to provide a table where each row is a criterion' . $stepusage = '"I grade by filling the rubric with:" step needs you to provide a table where each row is a criterion' .
' and each criterion has 3 different values: | Criterion name | Number of points | Remark text |'; ' and each criterion has 3 different values: | Criterion name | Number of points | Remark text |';
// If running Javascript, ensure we zoom in before filling the grades.
if ($this->running_javascript()) {
$this->execute('behat_general::click_link', get_string('togglezoom', 'mod_assign'));
}
// First element -> name, second -> points, third -> Remark. // First element -> name, second -> points, third -> Remark.
foreach ($criteria as $name => $criterion) { foreach ($criteria as $name => $criterion) {
@ -326,6 +331,11 @@ class behat_gradingform_rubric extends behat_base {
$textarea = $this->get_node_in_container('css_element', 'textarea', 'table_row', $name); $textarea = $this->get_node_in_container('css_element', 'textarea', 'table_row', $name);
$this->execute('behat_forms::i_set_the_field_to', array($textarea->getAttribute('name'), $criterion[1])); $this->execute('behat_forms::i_set_the_field_to', array($textarea->getAttribute('name'), $criterion[1]));
} }
// If running Javascript, then ensure to close zoomed rubric.
if ($this->running_javascript()) {
$this->execute('behat_general::click_link', get_string('togglezoom', 'mod_assign'));
}
} }
/** /**