I'm currently in the process of setting up Nightwatch.js for the very first time. I am following the tutorial provided at this link: https://github.com/dwyl/learn-nightwatch
Unfortunately, I have encountered a barrier and require assistance to resolve it.
Encountered an error while trying to retrieve a new session from the selenium server. The connection was refused! Have you started the selenium server?
https://i.sstatic.net/ot4Ou.png
nightwatch.conf.js
module.exports = {
"src_folders": [
"test"// Location where your Nightwatch e2e/UAT tests are stored
],
"output_folder": "./reports", // Output location for nightwatch reports (test outcomes)
"selenium": {
"start_process": true, // Instructs nightwatch to start/stop the selenium process
"server_path": "./node_modules/nightwatch/bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444, // Standard selenium port
"cli_args": {
"webdriver.chrome.driver" : "./node_modules/nightwatch/bin/chromedriver"
}
},
"test_settings": {
"default": {
"screenshots": {
"enabled": true, // Enable screenshots if needed
"path": './screenshots' // Save screenshots here
},
"globals": {
"waitForConditionTimeout": 5000 // Adjust timeout as per need
},
"desiredCapabilities": { // Use Chrome as default browser for tests
"browserName": "chrome"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true // Set to false to test progressive enhancement
}
}
}
}
guinea-pig.js
module.exports = { // Adapted from: https://git.io/vodU0
'Guinea Pig Assert Title': function(browser) {
browser
.url('https://saucelabs.com/test/guinea-pig')
.waitForElementVisible('body')
.assert.title('I am a page title - Sauce Labs')
.saveScreenshot('ginea-pig-test.png')
.end();
}
};
Based on the current configuration setup, I’ve kept everything quite straightforward. I seem to be unable to identify any indication that suggests another selenium server has been initiated. Any suggestions or insights?
EDIT: TIMEOUT ERROR