Running on Linux

To check missing dependencies on linux machine run below command

ldd chrome | grep

Raspberry Pi with Raspbian

The download executable is not an arm build and thus won't work with taiko by default. To make it work install the package `chromium-browser`. Then set the env variable `TAIKO_BROWSER_PATH=$(which chromium-browser)`

Dependencies for Debian

    gconf-service 
    libasound2
    libatk1.0-0 
    libatk-bridge2.0-0
    libc6 
    libcairo2
    libcups2 
    libdbus-1-3
    libexpat1 
    libfontconfig1
    libgcc1 
    libgconf-2-4
    libgdk-pixbuf2.0-0 
    libglib2.0-0
    libgtk-3-0 
    libnspr4
    libpango-1.0-0 
    libpangocairo-1.0-0
    libstdc++6 
    libx11-6
    libx11-xcb1 
    libxcb1
    libxcomposite1 
    libxcursor1
    libxdamage1 
    libxext6
    libxfixes3 
    libxi6
    libxrandr2 
    libxrender1
    libxss1 
    libxtst6
    ca-certificates 
    fonts-liberation
    libappindicator1 
    libnss3
    lsb-release 
    xdg-utils
    wget

Dependencies for Cent OS

    pango.x86_64 
    libXcomposite.x86_64
    libXcursor.x86_64 
    libXdamage.x86_64
    libXext.x86_64 
    libXi.x86_64
    libXtst.x86_64 
    cups-libs.x86_64
    libXScrnSaver.x86_64 
    libXrandr.x86_64
    GConf2.x86_64
    alsa-lib.x86_64
    atk.x86_64 
    gtk3.x86_64
    ipa-gothic-fonts 
    xorg-x11-fonts-100dpi
    xorg-x11-fonts-75dpi 
    xorg-x11-utils
    xorg-x11-fonts-cyrillic 
    xorg-x11-fonts-Type1
    xorg-x11-fonts-misc

Configure sandbox

There are two ways to setup sandbox in chromium:

To disable sandboxing launch chromium with below arguments:

await openBrowser({args: ['--no-sandbox', '--disable-setuid-sandbox']});

Disabling sandbox is not recommended unless you trust the content being loaded.

Running on Docker

Taiko with Dokcer

To run Taiko in a docker container follow these instructions:

docker pull node

Start a container

docker run node -it /bin/bash

Update packages

apt-get update

Install chromium dependencies

apt-get install -y wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

Install Taiko

npm install taiko -g --allow-root --unsafe-perm=true

To launch taiko in headless mode start taiko REPL with taiko and open browser with below arguments:

await openBrowser({headless: true, args: ['--no-sandbox']});

To launch taiko in headful mode install Xvfb

apt-get install xvfb

Start taiko REPL with xvfb-run taiko and open browser with below arguments:

await openBrowser({headless: false, args: ['--no-sandbox']});

Other Troubleshootings Tips

Intercepting request with method options

To ensure CORS security browser sends requests with method OPTIONS for cross-orgin resource access and currently there is no way to intercept such requests

As a workaround security can be disabled like below,

await openBrowser({ args: ["--disable-web-security"] });

Chromium command line args to enhance parallel run

To improve load time when running tests in parallel on cloud, following chromium command line args are recommended

await openBrowser({args: [
                    '--disable-gpu',
                     '--disable-dev-shm-usage',
                     '--disable-setuid-sandbox',
                     '--no-first-run',
                     '--no-sandbox',
                     '--no-zygote']}); 

Enable debug logs to log events

Run with below env to enable debug logs

env DEBUG="taiko:*" taiko code.js

Wait for right events

Taiko by default waits for any network requests that are triggered as part of the action, frame load, frame navigation and new target navigation events. Navigation actions like goto, reload waits for loadEventFired in addition. There can be scenarios where the action might take time to trigger events, hence could be missed by taiko. Below are few where waiting for appropriate events will improve performance and reduce flakyness in tests.

Example:

await click(link('open new tab'),{waitForEvents:['targetNavigated']})