Full-Stack Web Development with Vue.js and Node

(singke) #1
Testing an MEVN Application Chapter 9

Let's run the package using the following command:


$ npx selenium-standalone start -- -port 5555

The npx is a command that runs the npm packages.


Since we are using the 5555 port, we will need to update it in the nightwatch.conf.js


file as well.


Update the Selenium config in nightwatch.conf.js with the following code:


...
selenium: {
start_process: false,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 5555 ,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},

test_settings: {
default: {
selenium_port: 5555 ,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:8081'
}
},
...

Since we are using the 8081 port to run the node server, make sure that you update


the devServerURL attribute as well, as was done in the preceding piece of code.


Now, we are all set to run the tests with the following command:


$ npm run e2e

The test should fail with the following output:

Free download pdf