Problem with launch Chrome with GUI on Ubuntu 14.04


#1

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.2.0
  • Platform / OS version: Ubuntu 14.04
  • Node.js version: 9.10.0

What steps will reproduce the problem?

We need test chrome extension with ava and puppeteer with circleci.

Browser run code:

const runBrowserWithExtension = async (test) => {
    const extensionPatch = './dist/extension/';
    const browser = await puppeteer.launch({
        headless: false,
	timeout: 1 * 60 * 1000,
	ignoreHTTPSErrors: true,
        args: [
		'--no-sandbox',
		'--disable-setuid-sandbox',
                `--disable-extensions-except=${extensionPatch}`,
                `--load-extension=${extensionPatch}`
        ]
    });
    const pages = await browser.pages();
    const page = pages[0];

   page.setDefaultNavigationTimeout(2 * 60 * 1000);

   test.context.browser = browser;
   test.context.page = page;
}

Circleci config

version: 2
jobs:
  build:
    working_directory: /home/circleci/xxx
    docker:
      - image: circleci/node:9.10.0-browsers
    environment:
      OAUTH_ACCESS_TOKEN: xxx
      SLACK_WEBHOOK: xxx
    steps:
      - checkout
      - run:
          name: "Checking Versions"
          command: |
            node --version
            npm --version
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: "Update packages"
          command: |
            sudo apt-get update
            sudo apt-get install -y wget --no-install-recommends
      - run:
          name: "Install Chrome"
          command: |
            sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
            sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
            sudo apt-get update
            sudo apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont --no-install-recommends
      - run:
          name: "Clear"
          command: |
            sudo rm -rf /var/lib/apt/lists/*
            sudo apt-get purge --auto-remove -y curl
            sudo rm -rf /src/*.deb
      - run:
          name: Install Headless Chrome dep.
          command: |
            sudo apt-get -y install 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
      - run:
           name: "Build node modules"
           command: |
             cd xxx
             npm i
             cd ..
             npm i
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - node_modules
            - xxx/node_modules
      - run:
          command: |
            mkdir -p ~/reports
            node ./node_modules/ava/cli.js --init test
            node ./node_modules/ava/cli.js test --tap --serial | ./node_modules/tap-xunit/bin/tap-xunit > ~/reports/ava.xml
          when: always
      - store_test_results:
          path: ~/reports
      - store_artifacts:
          path: ~/reports
      - deploy:
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              ./deploy.sh
            else
              ./deploy.sh
            fi

What is the expected result?

Browser run in headless: false mode.

What happens instead?

After circleci build and run ava test code we have error:

          ---
            name: AssertionError
            message: Rejected promise returned by test
            values: {"Rejected promise returned by test. Reason:":"Error {\n  message: 'Timed out after 60000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r543305',\n}"}
            at: Timeout.onTimeout (node_modules/puppeteer/lib/Launcher.js:257:14)
          ...

On local Mac mini all work perfectly. Some problem with puppeteer in circleci docker container.

With headless: true all work, but in this mode can’t install extension.

Docker resources: 2CPU/4096MB


#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.