Error running Karate ui test in containers - karate

I am having an issue running karate UI tests in the containers.
I am able to clearly run the tests in the local .But my test runs in container says "ERROR com.intuit.karate - driver config / start failed:"
I am using driver config as below
configure driver = { type: 'chrome', headless: true, showDriverLog: true, addOptions: ['--incognito'], httpConfig: { readTimeout: 120000 }}
I am not using any other configs.
Has anyone been in this situation

Containers are not easy and you seem to be trying some approach of your own (also headless). Please follow the Karate documentation and use the recommended Docker containers.
https://github.com/intuit/karate/tree/master/karate-core#karate-chrome
If still stuck kindly follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and help up improve / fix the framework (and provide more details).

Related

Karate UI & Selenium standalone server input commands not working [duplicate]

This question already has answers here:
Run tests with Karate-Chrome (Connection refused exception)
(3 answers)
Closed 1 year ago.
I am running selenium-standalone server locally and trying to run this example feature against it.
Scenario: try to login to github and then do a google search
Given driver 'https://github.com/login'
And input('#login_field', 'dummy')
And input('#password', 'world')
When submit().click("input[name=commit]")
Then match html('#js-flash-container') contains 'Incorrect username or password.'
Given driver 'https://google.com'
And input("input[name=q]", 'karate dsl')
When submit().click("input[name=btnI]")
Then waitForUrl('https://github.com/intuit/karate')
I have configured my driver as such
* configure driver = { type: 'chromedriver', start: false, webDriverUrl: 'http://localhost:4444/wd/hub' }
Chromedriver is running:
ChromeDriver 2.46.628411 on port 9515
The chrome browser displays and navigates to Google. The input command/method attempts to write the login id and password and clicks the Commit button. The error message expected by the test does display so the test passes.
The issue is input command/method attempts while running in this configuration. It does not input dummy or world into the appropriate fields they are just left empty.
If I run the feature with this driver configuration * configure driver = { type: 'chrome', showDriverLog: true } it works just fine.
I am not very familiar with this configuration and just starting to use Karate UI but we do use selenium-standalone server and chromedriver with other projects and do not experience this issue.
I did search for a solution but wasn't able to find anything useful.
Has anyone else run into this issue before and if so how did you resolve it?
Thank you
Very well can be an old version of Selenium server. Just checked and this works with Chrome / ChromeDriver 83
It would help if you can follow this process: https://github.com/intuit/karate/tree/develop/examples/ui-test

ERROR:process_metrics.cc(105)] NOT IMPLEMENTED [duplicate]

Recently, we've started to get these kind of warnings on the console when running Protractor tests:
[12252:14584:1207/223118.187:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[12252:14584:1207/223118.187:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[12252:14584:1207/223318.188:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
It feels like they happen randomly but doesn't affect the test execution.
The only problem is that they pollute the output console making it more difficult to keep track of tests being executed and test results reported by jasmine/protractor.
Is there a way to turn off this kind of chromedriver warnings?
Using Protractor 5.2.2, ChromeDriver 2.34.
We've found this --silent flag that can be passed to chromedriver executable, but could not find a way to configure protractor to pass this flag when launching chromedriver..
It seems to be an issue with chrome v63
https://github.com/SeleniumHQ/selenium/issues/5189#issuecomment-351605839
You should be able to pass the --silent flag to chromedriver in your conf file. Something like:
capabilities: {
browserName' : 'chrome',
'chromeOptions' : {
args: ['--silent']
}
}
}
"This warning message was generated by a bug in Chrome v63.
Upgrading to v64 (64.0.3282.167 as of this morning) resolves it."

Selenium doesn't start webdriver

versions
"nightwatch": "^0.9.16"
"chromedriver": "^2.30.1"
"selenium-server-standalone-jar": "^3.4.0"
I'm using nightwatch but that sh
I also tried with
I'm using nightwatch to run Selenium in this repo and I've tried with chrome and firefox drivers, no luck on either.
I have selenium standalone and chromedriver packages, and I know the path is right on nightwatch.conf.js:
const jar = require('selenium-server-standalone-jar')
console.log(jar.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.4.0.jar
const chromedriver = require('chromedriver')
console.log(chromedriver.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/chromedriver/lib/chromedriver/chromedriver
'selenium': {
'start_process': true,
'server_path': jar.path,
'log_path': '',
'port': 4444,
'cli_args': {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.ie.driver': '',
},
},
'test_settings': {
'chrome': {
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
},
},
yet when I run the test it times out and hangs:
$ yarn e2e:ui
yarn e2e:ui v0.24.6
$ nightwatch -e chrome
Starting selenium server... started - PID: 12936
[App E2e Ui] Test Suite
===========================
✖ Timed out while waiting for element <body> to be present for 5000 milliseconds. - expected "visible" but got: "not found"
at Object.before (/home/goldylucks/apps/ci-workshop/test/ui/app.e2e-ui.js:9:8)
I tried it with the following combinations:
1. with the express server which serves the app on another terminal
2. without the express server
3. each of the above with chromedriver manually started at another terminal (I really don't think it should matter and that I should do this, just wanted to be thorough ...)
running the chromedriver manually yields the following and hangs:
$ node_modules/chromedriver/lib/chromedriver/chromedriver
Starting ChromeDriver 2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5) on port 9515
Only local connections are allowed.
I also tried running with firefox and it didn't work, which leads me to believe the problem is deeper than the chromedriver, i.e. related to selenium interacting with nightwatch.
I recall this happening a while back. I think it was that a previous instance Selenium had not closed freed port 4444 when shutting down. Try shutting down selenium and restarting.
To do that, open the following webpage manually, in the browser of your choice.
http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer
Then try running the script again as normal.

PhantomJS over HTTPS

I need to run Protractor tests using PhantomJS for a site using https. It's a development environment, the certs are self-signed and are not recognized by PhantomJS. I'm starting PhantomJS with the --ignore-ssl-errors flag, which supposed to make it accept invalid certs, but this isn't working. In CLI:
phantomjs --webdriver=localhost:4444 --web-security=false --ignore-ssl-errors=true --ssl-protocol=any
In spite of these settings, the acceptSslCerts property of the webdriver is still set to false. From the logs:
Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"mac-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
In a relevant GhostDriver repo issue (https://github.com/detro/ghostdriver/pull/388) the following code is listed:
const capabilities = webdriver.Capabilities.phantomjs();
capabilities.set(webdriver.Capability.ACCEPT_SSL_CERTS, true);
capabilities.set(webdriver.Capability.SECURE_SSL, false);
capabilities.set('phantomjs.cli.args', ['--web-security=no', '--ssl-protocol=any', '--ignore-ssl-errors=yes']);
const driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome(), capabilities).build();
I tried setting this in protractor.conf.js:
capabilities: {
browserName: 'phantomjs',
'webdriver.Capability.ACCEPT_SSL_CERTS': true,
'webdriver.Capability.SECURE_SSL': false
}
but this has no effect.
Has anyone figured out how to run PhatomJS in https mode?
I'm currently facing the same problem. Tried all alternatives you told and nothing seems to work.
Only thing that actually worked (not viable to my project, but maybe for yours) was to instantiate the webdriver passing the service_args like below:
Python:
webdriver.PhantomJS(executable_path='/home/rodrigo/bin/phantomjs-2.1.1-linux-x86_64/bin/phantomjs',
desired_capabilities=dict(DesiredCapabilities.PHANTOMJS),
service_args=['--web-security=no', '--ssl-protocol=any', '--ignore-ssl-errors=yes'])
Hope it helps you more than helped me.

Test browser code with Intern through Grunt and Phantomjs

I have been playing with Intern and made my tests work in the browser. To better integrate with my current workflow I'm trying to run my tests through grunt with phantomjs. However all my attempts have failed. I've been looking at this question as a reference Intern WebDriver and PhantomJS but can't figure out all of the steps to make it work.
First of all: Is it even possible to run the tests through grunt and phantomjs?
A little bit of info:
I don't want/can't connect to Sauce Labs or a Selenium testing environment.
I want to test browser code while having jQuery as a shimmed dependency
I have Grunt 0.4.1 and phantomjs 1.9.1 installed
I'm not testing any ajax request (as the linked question is having problem with)
I'm not familiar with neither Selenium nor Sauce Lab
If it is possible to test through grunt and phanomjs, how would I go about doing it?
I guess that I have to start the GhostDriver
phantomjs --webdriver=8910
But then what are the important pieces of info in the Intern config to make this work?
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
environments: [
{
browserName: 'phantom',
version: '1.9.0',
platform: 'Linux'
}
],
webdriver: {
host: 'localhost',
port: 8910
},
maxConcurrency: 3,
useSauceConnect: false,
// ...
});
How does the environments browserName map to phantomjs? I've tried the browserNames 'phantom' as well as 'phanomjs' with different versions and platforms (running Mac 10.7)
My Gruntfile section for intern looks like:
intern: {
phantom: {
options: {
config: 'tests/intern',
reporters: ['webdriver']
}
}
}
Running this setup without any test-suite that includes browser code outputs
'ReferenceError: document is not defined' in 'node_modules/intern/lib/reporters/webdriver.js:41:19'
Adding browser tests gives 'ReferenceError: window is not defined' in 'src/vendor/jquery/jquery-1.9.1.js:9597:5'
Running it through node gives the same 'window is not defined' error.
node node_modules/intern/client.js config=tests/intern
What am I doing wrong/missing here?
There are two problems with your Gruntfile configuration:
The default run type for the Grunt task is 'client', which means it runs the Node.js client by default, not the test runner. You need to set runType: 'runner' in your Gruntfile options to run tests against your specified environments.
The webdriver reporter is for use in a browser client only and is specified automatically by the test runner when it is needed. You should typically never use it directly. The reporter you specify in the Gruntfile should be the one you want the test runner to use; the console default is usually appropriate.
These two things in combination mean that you’ve configured Intern to try to use a reporter that only works in a browser in conjunction with the test runner inside the Node.js client, hence the error. Once corrected, the remaining configuration should work properly to run on PhantomJS, assuming it is already running on localhost at port 8910.