I would like to run Karate UI tests using the driverTarget
options to test my Java Play app which is running locally during the same job with sbt run
.
I have a simple assertion to check for a property but whenever the tests runs I keep getting "description":"TypeError: Cannot read property 'getAttribute' of null
This is my karate-config.js
:
if (env === 'ci') {
karate.log('using environment:', env);
karate.configure('driverTarget',
{
docker: 'justinribeiro/chrome-headless',
showDriverLog: true
});
}
This is my test scenario:
Scenario: test 1: some test
Given driver 'http://localhost:9000'
* waitUntil("document.readyState == 'complete'")
* match attribute('some selector', 'some attribute') == 'something'
My guess is that because justinribeiro/chrome-headless
is running in its own container, localhost:9000
is different in the container compared to what's running outside of it.
Is there any workaround for this? thanks