Running nightwatch tests in a browser with CORS disables
See original GitHub issueI 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:
- Created 7 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@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?This worked for me in nightwatch.json:
"test_settings": { "chrome":{ "desiredCapabilities": { "chromeOptions" : { "args" : ["--disable-web-security"] } } } }