puppeteergoogle-chrome-oskiosk-modechromebook

How can I run test automation on a PWA in Kiosk mode on a Chromebook?


I’m trying to run test automation from a development machine against a Progressive Web App (PWA) that will be running in Kiosk mode on a Chromebook. The PWA is intended for use in a Kiosk environment, and I need a reliable way to test its functionality remotely.

So far, I’ve attempted to use Puppeteer for this setup, but I’m running into challenges when interacting with the app in Kiosk mode.

Here’s what I’ve done so far:

  1. Enabled Developer mode on my Chromebook.
  2. Updated the chrome_dev.conf file on the Chromebook to enable --remote-debugging-port.
  3. Started an SSH tunnel on the Chromebook from the VT-2 terminal and connected to it from my Mac.

With these steps, I can successfully remote debug my application from my Mac, and Puppeteer tests can connect to it. However:

I also tested starting the SSH tunnel from within either VT-2 or Crosh after signing into a user on the Chromebook. In this setup:

Some questions that I have:

  1. Is it possible to remotely debug a PWA running on a Chromebook from two separate machines without relying on an SSH tunnel?
  2. Is there any framework (e.g., Puppeteer, Selenium, or others) that can successfully interact with a PWA in Kiosk mode?
  3. Would it be possible to "simulate" Kiosk mode while not actually being in Kiosk mode?

Any guidance, frameworks, or alternative approaches would be greatly appreciated!


Solution

  • I was able to figure out a solution after discovering the provided dev_features_ssh executable. I followed these steps to get ssh to start on boot:

    https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/chromeos-base/chromeos-sshd-init/files/openssh-server.conf.README#25


    Run a helper program.

    An executable named dev_features_ssh is available to enable sshd. Rootfs verification must be removed first or the helper program will have no effect. This will cause sshd to start automatically on each boot with test key access. Password access can optionally be enabled after rootfs verification has been removed.

    Remove rootfs verification.
    $ /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification
    $ reboot
    
    Install sshd startup files.
    $ /usr/libexec/debugd/helpers/dev_features_ssh
    
    Allow password access (optional).
    $ passwd
    

    I was then able to successfully ssh into my Chromebook as root. And I updated my Puppeteer test to connect via the webSocketUrl like this

    browser = await puppeteer.connect({
      browserWSEndpoint: webSocketDebuggerUrl,
    });
    

    You can get the websocketDebuggerUrl from http://localhost:9222/json/version when you have the SSH server up and running.

    With all this in place puppeteer was able to interact with the PWA even in kiosk mode and the ssh connection stayed active even if the kiosk app was relaunched. I did up date my Organizational Unit in Google Admin to set the kiosk app to "auto launch on start" so that my Chromebook would always be ready for testing.