-
Notifications
You must be signed in to change notification settings - Fork 262
tests/frontend: Better tests for file upload fields and clean up temporary files when tests complete #2926
Conversation
|
Can one of the admins verify this patch? |
| @@ -0,0 +1,14 @@ | |||
| const fs = require('fs'); | |||
|
|
|||
| exports.command = function (selector, text, textSelector = undefined) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we explicitly setting a default to undefined? this is the default value of any parameter that was not set. moreover, we don't do this anywhere else, I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just meant to indicate that the parameter is optional, but after looking at it again, I think it's better to move the textarea tests to testFileTextCombo and remove the textSelector parameter completely.
Add setFileField() and testFileTextCombo() custom commands for testing
file upload inputs.
Use the same temporary file location for all file upload tests and
delete that file at the end of the test run. This should prevent
temporary files being left on the file system when the tests exit.
Also improves testing of upload / textarea combos:
- Test that the textarea is populated with the file contents
- Test textarea field validation
- Stop using xpath selectors because all combos now have id attributes
that we can use instead.
a210d0e to
6d8794b
Compare
|
@squat Could you take another look please? |
| @@ -1,3 +1,5 @@ | |||
| const fs = require('fs'); | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this extra newline wanted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're generally putting a newline between package imports and imports from the same repo.
squat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Add
setFileField()andtestFileTextCombo()custom commands for testing file upload inputs.Use the same temporary file location for all file upload tests and delete that file at the end of the test run. This should prevent temporary files being left on the file system when the tests exit.
Also improves testing of upload / textarea combos:
idattributes that we can use instead.