Skip to content

TestCafe docker image 1.1.1 & 1.1.2 - ERROR Unable to establish one or more of the specified browser connections - Chromium on Docker #3671

@dthisner

Description

@dthisner

What is your Test Scenario?

The test failed to run in Chromium when executed in Docker testcafe/testcafe base image (1.1.1 or 1.1.2).

ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Very similar to: #3638. We are running with chromium:headless

It works running with TestCafes image 1.1.0

What is the Current behavior?

Test fails in the CI running with TestCafes docker image 1.1.1 and 1.1.2 and Chromium in headless mode

What is the Expected behavior?

Test passes using chromium headless with TestCafe's docker image 1.1.1 and 1.1.2

What is your web application and your TestCafe test code?

Details This is what we use to run our TestCafe scripts: More flexible when using `gherkin-testcafe`
 const createTestCafe = require('gherkin-testcafe');
const fs = require('fs');
let testcafe = null;

function readTestCafeConfig() {
  configData = fs.readFileSync('.testcaferc.json', 'utf8');
  const js = JSON.parse(configData);
  return getValues(js, 'src');
};

function getValues(obj, key) {
  var objects = [];

  for (var i in obj) {
    if (!obj.hasOwnProperty(i)) continue;
    if (i === key) {
      objects.push(obj[i]);
    }
  }
  return objects;
}

createTestCafe('localhost', 1337, 1338)
  .then(tc => {
    testcafe = tc;
    const runner = testcafe.createRunner();
    const src = readTestCafeConfig();

    return runner
      .src([src])
      .reporter(['spec', {
        name: 'json',
        output: 'reports/report.json'
      },
        {
          name: 'xunit',
          output: './test-reports/report.xml'
        }])
      .browsers('chromium:headless')
      .run();
  })
  .then(failedCount => {
    console.log('Tests failed: ' + failedCount);
    testcafe.close();
  });

Pipeline Setup:

Pipeline setup::
pipelines:
  default:
    - step: *test
    - step: 
        name: Test the UI
        caches:
          - node
        image: testcafe/testcafe:1.1.1
        script:
          - cp .env.uiTest .env
          - npm ci
          - npm run ci-ui-tests
        artifacts:
          - reports/**
          - test-reports/**

Starts the test by running:

npm run ci-ui-tests

Which runs following commands:

    "test-ui": "gherkin-testcafe",
    "test-ui-ci": "node src/tests/testcafeCI.js",
    "ci-ui-tests": "gulp build && start-server-and-test start http://localhost:3000 test-ui-ci",

Steps to Reproduce:

  1. Using above files
  2. Execute the pipeline
  3. ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Your Environment details:

  • testcafe version: v1.1.0
  • node.js version: v10.15.0
  • command-line arguments:
  • platform and version: Docker and bitbucket
  • other: using start-server-and-test and gherkin-testcafe

Metadata

Metadata

Assignees

No one assigned

    Labels

    STATE: StaleAn outdated issue that will be automatically closed by the Stale bot.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions