question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running nightwatch tests in a browser with CORS disables

See original GitHub issue

I am writing a selection of end to end tests using nightwatch. These tests call out to an external API, which has CORS settings that deny requests from localhost accessing the API.

For development on localhost I have installed a browser plugin that allows me to turn of the requirement of CORS. In chrome I can pass.

I have found an alternative method of handling the CORS settings and that is to start the browser with flags as follows. chromium-browser --disable-web-security --user-data-dir. Is there anyway to tell nightwatch to pass this arguments when it starts up chrome/chromium

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mattjg908commented, Jan 9, 2018

@beatfactor , I followed your link and I set: "desiredCapabilities" : { "chromeOptions" : { "args" : ["disable-web-security"] } } And, it doesn’t work. I’ve tried several variations, such as "desiredCapabilities" : { "chromeOptions" : { "args" : ["--disable-web-security"] } } and placing it inside Chrome, test_settings and selenium hashes. Does Nightwatch actualy allow disable-web-security?

2reactions
michaelscheurercommented, Jan 20, 2019

This worked for me in nightwatch.json:

"test_settings": { "chrome":{ "desiredCapabilities": { "chromeOptions" : { "args" : ["--disable-web-security"] } } } }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Skipping or disabling tests | Developer Guide - Nightwatch.js
Learn how to skip/disable a test module or individual test cases with Nightwatch.
Read more >
Run Selenium tests with Nightwatch | BrowserStack Docs
A guide to running automated Selenium tests with Nightwatch on BrowserStack Automate.
Read more >
Disable cross domain web security in Firefox - Stack Overflow
This is temporary to test. I know the security implications. I can't turn on CORS on the server and I especially would never...
Read more >
How to run Google Chrome without CORS? - YouTube
How to disable CORS in Chrome browser ?How to run Google Chrome without CORS ?How to disable CORS in Google Chrome ? Disable...
Read more >
Debugging SDKs - Percy Docs
Since Percy re-renders the DOM in a browser outside of your test suite, you may need to ... By default, all snapshots are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found