I’m working on a Ruby on Rails project where we use GitHub actions as a CI. While adding browser tests, I face issue accessing our app from within a service container.
Here is the part of workflow file that performs browser tests:
system: runs-on: ubuntu-latest services: firefox: image: selenium/standalone-firefox:4.0 ports: ["4444:4444"] env: HUB_URL: "http://localhost:4444/wd/hub" APP_HOST: "http://localhost:4000" steps: - name: Checkout code uses: firstname.lastname@example.org - name: Install Ruby uses: ruby/setup-ruby@v1 - name: Install gems run: "bundle install" - name: RUN TESTS run: "bundle exec rails spec:system"
APP_HOST variable. It’s used to point where the browser should connect to. My guess (I couldn’t find any information about this though) the hostname should be
These steps launch a container with Firefox, which should open our app accessible on the runner machine port 4000. But it didn’t happen: Firefox throws an error saying “http://localhost:4000 is not reachable”.
Could you please tell me are the runner machine ports blocked, or I should use some different hostname.