How to start a wide browser inside a docker container, for Protractor testing -
when running end end tests inside docker container need browser wide, make sure elements (abutton) positioned far right visible , test
expect(mainpage.abutton.isdisplayed()).tobetruthy();
succeed.
when displaying browser width value close 1050 maximum:
browser.driver.manage().window().getsize().then(function(size) { console.log('browser size', size); });
displays:
browser size { height: 748, width: 1050, class: 'org.openqa.selenium.dimension', hcode: 436207616 }
when using 2 docker images run tests against fail because button not visible. when running test on browser not inside docker/xvfb there no problem.
https://registry.hub.docker.com/u/caltha/protractor/
modified settings of xvfb config linking local version (and log folders debugging..)
mkdir -p /tmp/docker/protractor/supervisor docker run --rm \ --name run_protractor \ -v /tmp/docker/protractor:/var/log \ -v /tmp/testproject:/project \ -v /tmp/xvfb.conf:/etc/supervisor/conf.d/xvfb.conf:ro \ caltha/protractor
the file xvfb settings xvfb.conf:
[program:xvfb] command = xvfb :1 -screen 0 1920x1080x16 stdout_logfile = /var/log/supervisor/%(program_name)s-out.log stderr_logfile = /var/log/supervisor/%(program_name)s-err.log
when running same test on docker image 'small' browser:
http://www.function.fr/docker-with-chrome-and-selenium-and-firefox/
some more info: start our 'stuff' in linked docker containers integration / end end testing, database container, tomcat/rest/java container server. , npm container angular website.
protractor.conf.js:
.... onprepare: function() { browser.driver.manage().window().maximize(); //var width = 1224; //var height = 800; //browser.driver.manage().window().setsize(width, height); }
how wide browser? (we don't use responsive design our website obviously)
i'm not sure if issue in docker, protractor, or xvfb... on protractor side, try setting specific browser size. i.e. beyond size maximize()
provide.
so try setting following in protractor config onprepare:
browser.manage().window().setsize(2024, 800); // or whatever
this should give wide browser... not sure if pass tests though.
i might try changing 'xvfb's resolution...
Comments
Post a Comment