I already have all e2e tests written and they run successfully on my local machine and on the Codeship. I want to move our CI from the codeship to Bitbucket pipelines. So I created my own Docker image with testing environment. When I run docker conatiner in my local workspace, the tests work fine, but when build runs in bitbucket pipelines all the tests fail by timeout saying that angular can't be found on the page. Server is definitely up and running in the container ant tests also start, but the problem is with pages opening. Does anyone has any ideas about it? If any code is required, I'll post everything that is needed.
Asked
Active
Viewed 1,054 times
4
-
Are you testing an Angular application, or a regular web application? – Adrian Oprea Jan 13 '17 at 10:12
-
This is an angular app – Игорь Редько Jan 13 '17 at 10:14
-
As far as my experience goes, with running E2E in Docker, the Selenium Webdriver takes a bit of time to boot up, so by the time your tests run, your application is not loaded into the browser (that's where the Angular error comes from). Try to run the tests using the same configuration you have in BitBucket. My guess is that the image starts and the tests start running immediately, and do not wait for everything to boot up inside the image. – Adrian Oprea Jan 13 '17 at 10:16
-
It makes sense, but i'm not sure about it. In docker compose file i first run several bash scripts (env vars exporting, etc.), then i start my app, then i check that server is up and only after that my tests are launched. I thought that there can be some delays with pages uploading. Bu as i wrote previously, the same container i run locally in my workspace and tests work. – Игорь Редько Jan 13 '17 at 10:25
-
I would suggest taking a look at `protractor.conf.js` as you might have the `seleniumAddress` or the `capabilities` wrong. – Adrian Oprea Jan 13 '17 at 10:26
-
Was there a resolution to the issue described? Was it a race condition as suspected? – Ain Tohvri Jun 21 '17 at 12:20
-
@ИгорьРедько can you share your Dockerfile please? I also want to run protractor tests on my angular 2 docker image – MarBVI Aug 01 '17 at 17:54
1 Answers
0
So I managed to solve my issue. Not sure if it can be useful to anyone else, but the problem appeared in my environment setup. I forgot to add starting of webpack service that should generate some required server files and minified files of the server sources. So server started successfully, but requesting the routes from the browser failed because it wasn't able to find requested files.

Игорь Редько
- 51
- 4
-
Hey, I've been struggling some days with this same issue. I've an Angular 4 application running with protractor e2e tests also running fine locally. I even have a Docker image for my Angular project and another Docker image that runs my protractor tests. Can you guide me to run my tests on the pipeline please! I can't do "docker run" as it's unavailable in pipelines neither run "npm test" as I need the app to be served in localhost:4200, but if I run "npm start", "npm test" will never fire – MarBVI Aug 05 '17 at 22:09