Monday, 26 November 2018

Unable to launch host angular app in docker chrome node via selenium grid

I am trying to get my e2e tests to run against a selenium grid and a chrome node that I have setup in docker containers linked together like so:

So far I have managed to get the containers running via docker-compose

version: '2'
services:
  hub:
    image: selenium/hub:latest
    ports:
      - 4444:4444

  chromenode:
    image: selenium/node-chrome-debug:latest
    volumes:
      - /dev/shm:/dev/shm
    ports:
      - 5900
    depends_on:
        - hub
    environment:
      HUB_HOST: hub

I am then running ng e2e from my working directory on my host machine (so not in using docker for building/serving app), I see my app is built and launched on a dev server and then protractor kicks in and uses my selenium server:

enter image description here

However as can be seen I get an error saying that Angular cannot be found on the page, referencing the localhost:49158 address that the dev server assigns.

If I VNC into my container where the chrome node is running, I can see the browser is launched at the point the test attempts to run, but fails to find my app running on my host machine.

enter image description here

Do I need to map localhost on my chromenode back to my host machine ip address in my docker-compose file?

Thanks

Update So I came across the network_mode: "host" docker compose config option, which I thought I needed but it made no difference after trying it and I read somewhere that it may not work on mac OSX which I am on (High Sierra)



from Unable to launch host angular app in docker chrome node via selenium grid

No comments:

Post a Comment