wa4e
wa4e copied to clipboard
Grader message res-education code issue, lowercase matches an id field
Will create PR when ready, will need to test match text, in the id as below. https://www.wa4e.com/solutions/res-education/add.php After adding a record the flash message / redirect to index.php is 'Profile added' this appears to create a false positive message,
Expecting 'added' Test passed: Found success message after add Looking 'Confirms' entry in index.php
as the HTML did not redirect to index, there should be no match, as no flash message. However 'added' appears to be found in a short match, while still on add.php, in the id value 'addEdu'
<p>
Education: <input type="submit" id="addEdu" value="+">
<div id="edu_fields">
Yikes - I missed this one - is it fixed?
Ouch, don't close browser tab before saving comment. It's the common wa4e/tools/autograder/crud.php line 146 - if ( strpos(strtolower($html), 'added') !== false ) { On 1st check, course 4 JSON/JQuery - weeks 1 res-profile, 3 res-position & 4 res-education, the output message is "Profile added" course 3 BuildDB - week 5 autoscrud the output message is "Record added" So the check is only for "added" and on a code fail, it finds the id as mentioned.
Changing the id is likely the sample code, lectures. Or if crud.php could use a variable from autoscrud, res-profile, res-position, res-education.php initialization. So autoscrud is $expected_message = "Record added"; and crud.php if ( strpos(strtolower($html), $expected_message) !== false ) with the 3 x res using $expected_message = "Profile added"; possibly then remove the strtolower?
Before this course 3 w4 autosess and w2 autosdb use "Record inserted" but that is not tested.
Please review, as the match is only 'added' in lowercase. Course 4 uses "Profile added" and course 3 is "Record added". The generic CRUD grader would need to know which course to match with the string. It would not be right to make course 4 "Record added" either.