wa4e icon indicating copy to clipboard operation
wa4e copied to clipboard

Grader message res-education code issue, lowercase matches an id field

Open srcatto opened this issue 3 years ago • 3 comments

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">

srcatto avatar Sep 16 '21 18:09 srcatto

Yikes - I missed this one - is it fixed?

csev avatar Mar 24 '22 16:03 csev

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.

srcatto avatar Oct 21 '22 18:10 srcatto

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.

srcatto avatar May 30 '23 20:05 srcatto