I’m new to protractor and CI and would like to ask for your help.
I have a docker image running for my testing application.
I also have a docker image as my selenium hub using the code below: (I’ve also ran selenium docker without Java_opts line)
docker run -d -p 4444:4444 -p 5900:5900 -e JAVA_OPTS="-Dwebdriver.chrome.whitelistedIps=" --shm-size="2g" selenium/standalone-chrome-debug
I am able to run my protractor tests locally or through vncviewer (port 5900), however, I am not able to do so when I run it through pipeline. I’m always stuck at:
[02:32:15] I/launcher - Running 1 instances of WebDriver
[02:32:15] I/hosted - Using the selenium server at http://selenium-standalone-chrome:4444/wd/hub
Then, a timeout error will display:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Below is my yml
and conf
file, I have made it simple so I could just see if I could open my docker image (login) on gitlab pipeline.
gitlab yml file:
image: node:12.15
variables:
GIT_SSL_NO_VERIFY: "true"
services:
- selenium/standalone-chrome
test:
script:
- npm install
- npm test
conf.js file
exports.config = {
seleniumAddress: 'http://--ipaddresshere--:4444/wd/hub',
// or http://selenium-standalone-chrome:4444/wd/hub (both same error in CI)
capabilities: {
'browserName': 'chrome'
},
framework: 'jasmine',
specs: ['feature2.js'],
}
feature2.js
describe('Login',function(){
it('Login', function () {
browser.waitForAngularEnabled(false); // (I disabled/enabled this and error still persist)
browser.driver.get('http://<ipaddresshere>:3030/login');
});
});
Even with this simple code, I am still unable to open the login page. I’ve already tried passing chromeoptions such headless, no sandbox, etc., tried different node version, tried jasminetimeout/allscriptimeout, installed selenium 4 version as hub, updated selenium webdriver, updated webdriver-manager and a lot more.
I’ve tried running the code using browser.get(‘http://google.com’) and I’m able to access the site. I’m assuming my setup doesn’t allow me to access the local docker application.
I really need your help if there’s something I’ve missed. Or if you have other suggestions on how to access the local docker application in gitlab pipeline aside from selenium hub, I would greatly appreciate it. Thank you!