Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.

Conversation

@kyoto
Copy link
Contributor

@kyoto kyoto commented Feb 9, 2018

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.

@coreosbot
Copy link

Can one of the admins verify this patch?

@@ -0,0 +1,14 @@
const fs = require('fs');

exports.command = function (selector, text, textSelector = undefined) {
Copy link
Contributor

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

Copy link
Contributor Author

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.
@kyoto kyoto force-pushed the nightwatch-file-tests branch from a210d0e to 6d8794b Compare February 13, 2018 02:06
@kyoto
Copy link
Contributor Author

kyoto commented Feb 13, 2018

@squat Could you take another look please?

@@ -1,3 +1,5 @@
const fs = require('fs');

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kyoto kyoto merged commit 8e2f03c into coreos:master Feb 19, 2018
@kyoto kyoto deleted the nightwatch-file-tests branch February 19, 2018 11:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants