Error while running .navigateTo() protocol action: timeout - nightwatch.js

I updated the Nightwatch version to 1.0.19.
While Executing the script I have the following timeout issue in navigate() function.
here is the console output:
{ sessionId: '2aeb3cd9367d3580ae4ae705abca2a80',
status: 21,
value:
{ message: 'timeout',
error:
[ ' (Session info: chrome=63.0.3239.132)',
' (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-1038-aws x86_64)' ] } }
Error while running .navigateTo() protocol action: timeout
..........................

Related

ECONNREFUSED using nightwatch-accessibility library

I'm trying to use the nightwatch-accessibility library, but keep getting error
POST /session/b4e18278544c74b9213c030b8119ee7e/timeouts/async_script - ECONNREFUSED
Error: connect ECONNREFUSED 127.0.0.1:9515
Error while running .setTimeoutsAsyncScript() protocol action: An unknown error has occurred.
POST /session/b4e18278544c74b9213c030b8119ee7e/execute_async - ECONNREFUSED
Error: connect ECONNREFUSED 127.0.0.1:9515
Error while running .executeScriptAsync() protocol action: An unknown error has occurred.
Normal tests work fine. As far as I can tell I am following the example correctly. The test assertions work correctly it just appears at the end of the test run.
nightwatch.json
{
"src_folders": ["test"],
"page_objects_path": "page-objects",
"globals_path": "./globals.js",
"custom_commands_path": ["./node_modules/nightwatch-accessibility/commands"],
"custom_assertions_path": ["./node_modules/nightwatch-accessibility/assertions"],
"end_session_on_fail": false,
"skip_testcases_on_fail": false,
"selenium": {
"start_process": false
},
"webdriver": {
"start_process": true,
"server_path": "node_modules/chromedriver/lib/chromedriver/chromedriver.exe",
"port": 9515
},
"test_settings": {
"default": {
"webdriver.port": 9515,
"desiredCapabilities": {
"browserName": "chrome"
}
}
}
}
globals.js
const chromedriver = require('chromedriver');
module.exports = {
before: function (done) {
chromedriver.start();
done();
},
after: function (done) {
chromedriver.stop();
done();
}
};
First test
module.exports = {
'#tags': ['accessibility'],
'First test': function (browser) {
browser
.url(`http://www.google.com`)
.pause(3000)
.initAccessibility()
.assert.accessibility('html', {
verbose: true
})
.end()
}
}
Executing by typing nightwatch from the terminal like I would other tests. Any ideas and is this the best accessibility assertion library for NightwatchJS?
I ended up using nightwatch-axe-verbose instead. Usage details included on this web accessibility testing using nightwatch blog post.

What could cause a HPE_INVALID_METHOD error using fastify and nunjucks?

I disabled all plugins on the server except point-of-view.
fastify.register(require('point-of-view'), {
engine: {
nunjucks: require('nunjucks')
},
templates: 'server/views',
includeViewExtension: true
})
The handler is calling the view function.
reply.view('/v1/main', {
nonce: nanoid(1),
token: nanoid(1)
})
The complete error message is:
{"level":50,"time":1547208496144,"msg":"client error","pid":16013,"hostname":"jer-ryzentwo","err":{"type":"Error","message":"Parse Error","stack":"Error: Parse Error","bytesParsed":0,"code":"HPE_INVALID_METHOD","rawPacket":{"type":"Buffer","data":[22,3,1,2,0,1,0,1,105,3,3,167,247,206,59,236,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"v":1}
{"level":50,"time":1547208496145,"msg":"client error","pid":16013,"hostname":"jer-ryzentwo","err":{"type":"Error","message":"Parse Error","stack":"Error: Parse Error","bytesParsed":0,"code":"HPE_INVALID_METHOD","rawPacket":{"type":"Buffer","data":[10,0,1,0,2,2,20]}},"v":1}
I cannot pinpoint the source of this issue.
Any idea what and why a HPE_INVALID_METHOD error is being generated?

Firefox browser disconnect issue when running tests via testem

I am trying to run my ember tests in parallel using ember exam. However when I run the tests I am frequently getting browser disconnect issue, with following log:
[16:41:10][Step 6/6] not ok 561 Firefox - error
[16:41:10][Step 6/6] ---
[16:41:10][Step 6/6] message: >
[16:41:10][Step 6/6] Error: Browser disconnected
[16:41:10][Step 6/6] Stderr:
[16:41:10][Step 6/6] *** You are running in headless mode.
[16:41:10][Step 6/6] [Parent 12706, Gecko_IOThread] WARNING: pipe error (45): Connection reset by peer: file /build/firefox-8HKHfQ/firefox-57.0+build4/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
[16:41:10][Step 6/6]
[16:41:10][Step 6/6] ###!!! [Parent][MessageChannel] Error: (msgtype=0x24001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv
[16:41:10][Step 6/6]
[16:41:10][Step 6/6]
[16:41:10][Step 6/6] ###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
[16:41:10][Step 6/6]
[16:41:10][Step 6/6]
[16:41:10][Step 6/6] ###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
[16:41:10][Step 6/6]
[16:41:10][Step 6/6]
[16:41:10][Step 6/6]
[16:41:10][Step 6/6] Log: |
[16:41:10][Step 6/6] { type: 'error', text: 'Error: Browser disconnected' }
[16:41:10][Step 6/6] { type: 'error',
[16:41:10][Step 6/6] text: '*** You are running in headless mode.\n[Parent 12706, Gecko_IOThread] WARNING: pipe error (45): Connection reset by peer: file /build/firefox-8HKHfQ/firefox-57.0+build4/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353\n\n###!!! [Parent][MessageChannel] Error: (msgtype=0x24001F,name=PContent::Msg_PreferenceUpdate) Channel error: cannot send/recv\n\n\n###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv\n\n\n###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv\n\n' }
[16:41:10][Step 6/6] ...
I am running firefox version 57, version 59 is better but even there I see this issue quite frequently, chrome however seems to fare well but on occasion it fails too. Initially I thought its because I am running in headless mode, but even in non-headless mode things do not get any better. And my testem.js file is:
let today = new Date();
const testWindowWidth = 1920;
const testWindowHeight = 1080;
/**
* Exports configuration to run tests via testem.
* There are issues with running the test in firefox in headless mode.
* Chrome however works fine with the provided configuration.
* #see : https://github.com/testem/testem/issues/1117
* */
module.exports = {
'framework': 'qunit',
'test_page': [
'tests/index.html?hidepassed&nojshint'
],
'disable_watching': true,
'parallel': -1,//sky is the limit
'launch_in_ci': [
'Firefox'
],
'launch_in_dev': [
'Chrome'
],
'browser_args': {
'Firefox': [
`-headless`,//comment this line out for debugging purpose
`-width ${testWindowWidth}`,
`-height ${testWindowHeight}`
],
'Chrome': [
'--headless',//comment this line out for debugging purpose
'--disable-gpu',
'--remote-debugging-port=9222',
'--remote-debugging-address=0.0.0.0',
'--no-sandbox',
'--user-data-dir=/tmp',
`--window-size=${testWindowWidth},${testWindowHeight}`
]
},
'browser_start_timeout': 2 * 60,
'report_file': `tests/logs/${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()}/${today}.txt`,
'browser_disconnect_timeout': 2 * 60
};
I don't know if the problem is with testem configuration or the browser itself! Your help/suggestions will be much appreciated, thanks.
I was not able to solve the issue but I was able to avoid the browser disconnect issue via ember-exam. The trick was to figure out the no of partitions to split out the tests and run just subset of it in parallel such that each ember run has about 200 tests top. We have fairly large ember application with upwards of 3k tests, so I ended up creating shell script to manage the split.
//run-tests.sh
const exec = require('child_process').exec;
var split = 100;//total no of partitions to split the tests into
var parallelRuns = 4;//total no of partitions to run in parallel at a time
var runTestModule = function(partitionNo) {
if (partitionNo > split) {
return;
}
var _partitions = [];
for (var i = 0; i < parallelRuns; i++) {
_partitions.push(++partitionNo);
}
var partitions = _partitions.map(function(index) {
return "--partition=" + index;
}).join(" ");
var command = "./node_modules/.bin/ember exam --path=./dist --split=" + split + " " + partitions + " --parallel";
console.log(
"\n===============================================RUNNING COMMAND===============================================================\n" +
command +
"\n=============================================================================================================================\n");
exec(command, function(e, stdout, stderr) {
if (e instanceof Error) {
console.error(e);
//throw e;
}
console.log('stdout ', stdout);
console.log('stderr ', stderr);
runTestModule(partitionNo);
});
};
runTestModule(0);

Unable to print the locator (webelement) in Console Log

I'm new to Protractor.
I'm declaring an element as a variable like :
txtSearch : element(by.xpath('//input[#type="search"]')),
In some point I want to log the locator as :
var clickOn = function(webElement)
{
webElement.click();
console.log("Successfully clicked on the " + webElement);
};
I'm calling this function from Spec file like - clickOn (txtSearch)
In Console.log I am getting like - Successfully clicked on the [object Object].
Please find the required details below :
Node Version: 7.5.0
Protractor Version: 5.1.1
Browser(s): Chrome
Protractor configuration file :
exports.config = {
capabilities: {
browserName: 'chrome',
},
onPrepare: function(){
jasmine.getEnv().addReporter(reporter);
global.isAngularSite = function(flag) {
browser.ignoreSynchronization = !flag;
};
browser.manage().timeouts().setScriptTimeout(60000);
browser.driver.manage().window().maximize();
},
seleniumServerJar: '../../protractor/selenium/selenium-server-standalone-2.52.0.jar',
chromeDriver: '../../protractor/selenium/chromedriver_2.27.exe',
directConnect: true,
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['../PoC_Protractor/spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 600000,
isVerbose: true
}
I tried with webElement.locator().toString() but it is throwing-
Failed: webElement.locator is not a function
You can always output the locator used using webElement.locator().toString(). Check the output for the below code snipper.
Protractor spec:
describe('Locator testing by model', function(){
it('automate user register form', function(){
browser.get('http://www.way2automation.com/angularjs-protractor/registeration/#/login');
var search = element(by.model('Auth.user.name'))
console.log(search.locator())
console.log("Successfully clicked on the " + search.locator().toString());
console.log(search.locator().toString())
});
});
Output:
[14:01:48] I/local - Starting selenium standalone server...
[14:01:48] I/launcher - Running 1 instances of WebDriver
[14:01:49] I/local - Selenium standalone server started at http://10.96.61.119:56341/wd/hub
Started
{ findElementsOverride: [Function], toString: [Function] }
Successfully clicked on the by.model("Auth.user.name")
by.model("Auth.user.name")
.
1 spec, 0 failures
Finished in 0.942 seconds
[14:01:53] I/local - Shutting down selenium standalone server.
[14:01:53] I/launcher - 0 instance(s) of WebDriver still running
[14:01:53] I/launcher - internet explorer #01 passed
Hey it seems like you may not be resolving the promise in the correct way, try using -
webElement.click().then(function(element){
console.log(""Successfully clicked on the " + element);
};

Cargo Tomcat 7.X not stopping

Here is my configuration in gradle file for cargo.
cargo {
containerId = 'tomcat7x'
port = httpPort.toInteger()
local {
homeDir = file(cargoHome)
configHomeDir = file(cargoHome)
jvmArgs = 'Dcom.sun.management.jmxremote.port=9092
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -'
installer {
installUrl = 'https://installdirectory/content/groups/public/org/apache/tomcat/tomcat/7.0.57/tomcat-7.0.57.zip'
downloadDir = file("$buildDir/download")
extractDir = file("$buildDir/extract")
}
containerProperties { property 'cargo.tomcat.ajp.port', portFinder.nextAvailable}
extraClasspath = files("../service/service-1.0.0-LOCAL-local.jar",configurations.cargoruntime) }}
Following error it's shows in log while running cargoStopLocal task
WARNING: StandardServer.await: Invalid command '' received
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9092; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
Nov 20, 2015 4:32:34 PM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
can anyone guide me how to handle this issue , it's not stopping cargo server so my build is failing?

Resources