lundi 28 octobre 2019

How to run TestCafe runner class with Docker

I am new to TestCafe and want to run my testcases with runner class in Docker container.

I am able to run single testcase through Docker. But when i want to run with runner class, i am not able to do that. I have followed this thread https://github.com/DevExpress/testcafe/issues/2761 but i don't know how to define "Environment initialization steps from the TestCafe Docker script in your runner."

my runner file

const testCafe = require('testcafe');
const fs       = require('fs');

function runTest(tcOptions) {
  testCafe('localhost', 8080, 8081)
    .then(function(tc) {

      let runner = tc.createRunner();

      return runner
        .src(['./apps/tests/*.test.js'])
        .browsers(['firefox'])
        .concurrency(4)
        .reporter([
          'list',
          {
            name: 'html',
            output: './dist/testcafe/testCafe-report.html'
          }
        ])
        .screenshots('./dist/testcafe/testcafe-screenshots', true)
       .run(tcOptions)
        .catch(function(error) {
          console.log(error);
        });
    })
    .then(failedCount => {
      if (failedCount > 0) console.log('Error Tests failed: ' + failedCount);
      else console.log('All Desktop Tests Passed');
      process.exit(0);
    })

}

const tcOptions = {
  debugMode: false
};

runTest(tcOptions);

and running this Docker command

docker run -v `pwd`/:/tests -e "NODE_PATH=/tests/node_modules" -it --entrypoint node testcafe/testcafe /tests/apps/testcafe//testcafe-desktop-run.js
{ Error: No tests to run. Either the test files contain no tests or the filter function is too restrictive.
    at Bootstrapper._getTests (/tests/node_modules/testcafe/src/runner/bootstrapper.js:92:19) code: 'E1009', data: [] }

Aucun commentaire:

Enregistrer un commentaire