Sauce Labs upload files with nightwatch.js

412 views Asked by At

I have tests written with nightwatchJs that are run with remote sauce labs selenium (aka ondemand.saucelabs.com). In the tests flow, I need to upload a local file. When I run tests locally, I use setValue method. But this approach does not seem to be a good one with sauce labs. Is there a proper way to upload local files with nightwatch and sauce labs?

2

There are 2 answers

0
MisterMe On BEST ANSWER

I've came up with this solution: https://github.com/nightwatchjs/nightwatch/issues/890.

Unfortunately, there is a PR for this feature, but it has not been merged yet. So I forked nightwatch repo and added uploadFileToSeleniumServer method.

1
walkerlj0 On

Looks like solution to this was that a custom command was created for this: https://github.com/RohanImmanuel/NightwatchJS-Remote-File-Upload.

You can also see a full repo of nightwatch examples here: https://github.com/saucelabs-training/demo-js/tree/main/nightwatch