Drone

Chrome headless

I’m trying to get unit tests to run in a headless browser. Is it possible to get drone working with, for example, chrome headless?

you should be able to start it as any other service… something like

services:
- name: chrome
  image: chromedp/headless-shell:latest
  ports:
  - 9222

And then tell your test runner to connect to that chrome instance.

Thanks. I’m still pretty stuck though. I’m using Gradle with npm/webpack that launches a headless browser. It wants an environmental variable CHROME_BIN for the chrome headless executable.

If I add the headless-shell service, I’m not clear on what that does exactly or how to connect to it. Is there a way to get the bin path from that? Sorry for the newbie questions :open_mouth:

steps:
  - name: build-test-publish
    image: openjdk:8-jdk
    environment:
      CHROME_BIN: google-chrome
    commands:
      - ./gradlew jsBrowserTest --stacktrace
    services:
      - name: chrome
        image: chromedp/headless-shell:latest
        ports:
          - 9222