Browse Source

Improve selection in behat tests.

40-behatfixes
Dan Marsden 3 years ago
parent
commit
4a7dd530d6
  1. 8
      renderer.php
  2. 4
      tests/behat/attendance_mod.feature

8
renderer.php

@ -2669,7 +2669,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
if ($st->setunmarked) {
$checked = ' checked ';
}
$cells[] = $this->construct_text_input('studentavailability['.$st->id.']', 4, 5, $st->studentavailability);
$cells[] = $this->construct_text_input('studentavailability['.$st->id.']', 4, 5,
$st->studentavailability, 'studentavailability_'.$st->acronym);
$cells[] = '<input type="radio" name="setunmarked" value="'.$st->id.'"'.$checked.'>';
$cells[] = $this->construct_preferences_actions_icons($st, $prefdata);
@ -2729,16 +2730,17 @@ class mod_attendance_renderer extends plugin_renderer_base {
* @param integer $size
* @param integer $maxlength
* @param string $value
* @param string $extraclass
* @return string
*/
private function construct_text_input($name, $size, $maxlength, $value='') {
private function construct_text_input($name, $size, $maxlength, $value='', $extraclass='') {
$attributes = array(
'type' => 'text',
'name' => $name,
'size' => $size,
'maxlength' => $maxlength,
'value' => $value,
'class' => 'form-control');
'class' => 'form-control '.$extraclass);
return html_writer::empty_tag('input', $attributes);
}

4
tests/behat/attendance_mod.feature

@ -54,7 +54,7 @@ Feature: Teachers and Students can record session attendance
And I log out
And I am on the "Attendance" "mod_attendance > View" page logged in as "teacher1"
And I follow "Status set"
And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[3]/td[5]/input" to "0"
And I set the field with xpath "//*[@id='preferencesform']/input[@class='studentavailability_E']" to "0"
And I press "Update"
And I log out
And I am on the "Attendance" "mod_attendance > View" page logged in as "student1"
@ -85,7 +85,7 @@ Feature: Teachers and Students can record session attendance
And I click on "Send a message" "button"
And I should see "Message body"
And I should see "student1@asd.com"
And I follow "Course 1"
And I am on "Course 1" course homepage
And I expand "Reports" node
And I follow "Logs"
And I click on "Get these logs" "button"

Loading…
Cancel
Save