grading-harness merge requestshttps://gitlab.cs.washington.edu/cse340/grading-harness/-/merge_requests2022-01-04T14:20:42-08:00https://gitlab.cs.washington.edu/cse340/grading-harness/-/merge_requests/2Add diff tool to screenshots.py2022-01-04T14:20:42-08:00Henry HeinoAdd diff tool to screenshots.pyAdds a diff tool to the student and grader views for the HTML generated
by `screenshots.py`.
## How Tolerance Works
Suppose `p1` and `p2` represent the actual and expected values of some pixel (respectively).
Then, defining `Δr = p1.r ...Adds a diff tool to the student and grader views for the HTML generated
by `screenshots.py`.
## How Tolerance Works
Suppose `p1` and `p2` represent the actual and expected values of some pixel (respectively).
Then, defining `Δr = p1.r - p2.r, Δg = p1.g - p2.g, Δb = p1.g - p2.g, Δa = p1.a - p2.a`, if `Δr² + Δg² + Δb² + Δa² ≥ tolerance`, then the two pixels are considered different.
## Adjusting Tolerance
Tolerance can be adjusted through the HTML page's URL. For example, if viewing `file:///tmp/mozilla_selenite0/Screenshots-3-2.html`, navigate to `file:///tmp/mozilla_selenite0/Screenshots-3-2.html?tolerance=256` for a version with `tolerance=256`.
## Screenshots
![Fullscreen window: three columns for each test, logs number of different pixels](/uploads/6baab9bcc6c5619e05b7912f6751dac2/Screenshot_from_2022-01-04_10-34-26.png)
![Small window: Columns are thinner](/uploads/a4d80cb1ef6980d1b1d161116f907fe3/Screenshot_from_2022-01-03_23-11-13.png)
## To-do
☑ Test locally
☑ Test with Ed
## Example Diffs (somewhat buggy solution)
* [Example diffs with a solution that incorrectly calculates the bounding box of a circle.](/uploads/fcfb6176e4f888f000d5b4cec1bd72f6/Screenshots-3.html) (default tolerance = 64)Jasper Palmerjpalmer4@uw.eduJasper Palmerjpalmer4@uw.eduhttps://gitlab.cs.washington.edu/cse340/grading-harness/-/merge_requests/4Shrink images before embedding2022-01-18T00:04:51-08:00Henry HeinoShrink images before embeddingShrinks images using PIL prior to embedding. Output `html` files for Layout are now `≤ 3 MiB` unzipped (as low as `700 KiB`). As such, a follow-up MR can remove the zipping of the `html` file.
Example:
[student_output.html](/uploads/763...Shrinks images using PIL prior to embedding. Output `html` files for Layout are now `≤ 3 MiB` unzipped (as low as `700 KiB`). As such, a follow-up MR can remove the zipping of the `html` file.
Example:
[student_output.html](/uploads/763ae9561205b2f98cdb53ff3e36be6e/student_output.html)https://gitlab.cs.washington.edu/cse340/grading-harness/-/merge_requests/1Use GitGrade Item Specific Tags to parse testRegex2020-03-02T19:06:07-08:00Jeremy Zhangjkzhang@cs.washington.eduUse GitGrade Item Specific Tags to parse testRegexcriteria.xml is no longer required to apply automatic points using the Grading Commands systemcriteria.xml is no longer required to apply automatic points using the Grading Commands systemAdam Towersajtowers@cs.washington.eduAdam Towersajtowers@cs.washington.eduhttps://gitlab.cs.washington.edu/cse340/grading-harness/-/merge_requests/3WIP: screenshots.py: Create single-file output2022-01-17T23:50:10-08:00Henry HeinoWIP: screenshots.py: Create single-file outputThis _might_ fix the screenshot issue:
* Currently only works on Firefox (and maybe Safari) because Chrome doesn't let users `fetch`/`XMLHttpRequest` the current file (when a `file://` URL).
* Works in Chrome if using `python3 -m ht...This _might_ fix the screenshot issue:
* Currently only works on Firefox (and maybe Safari) because Chrome doesn't let users `fetch`/`XMLHttpRequest` the current file (when a `file://` URL).
* Works in Chrome if using `python3 -m http.server` to host.
* Now only generates one screenshots output file, `screenshots.html`.
* CSS-based & JS-based diff (both)
* Code is still really messy & needs to be cleaned up