0

I'm running a job in gitlab CI and getting the following error when executing testcafe command. The tests do pass locally.

Error

spawn /builds/testcafe-reporter/node_modules/nightmare/node_modules/electron/dist/electron ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

Gitlab stage:

- yarn install --frozen-lockfile
- yarn add electron
- yarn testcafe:generatereport

package.json

{
  "name": "testcafe-reporter",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "testcafe:generatereport": "yarn testcafe ./testcafeReportGeneratorTest.ts"
  },
  "dependencies": {
    "node-html-parser": "^4.1.4",
    "testcafe": "1.16.0",
    "testcafe-browser-provider-nightmare": "^0.0.5",
    "testcafe-reporter-html": "^1.4.6",
    "testcafe-reporter-html-testrail": "^3.1.5",
    "typescript": "^4.4.2"
  }
}

.testcafec.json

{
    "browsers": ["nightmare"],
    "reporter": {
        "name": "html",
        "output": "testcafe/reports/report.html"
    }
}

Please advise how can I resolve this?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124

1 Answers1

1

I cannot reproduce this issue either locally or in Gitlab CI. Here are the files I am trying with:

.testcafec.json

{
    "browsers": ["nightmare"],
    "reporter": {
        "name": "html",
        "output": "testcafe/reports/report.html"
    }
}

package.json

{
    "name": "testcafe-reporter",
    "version": "1.0.0",
    "main": "index.js",
    "license": "MIT",
    "scripts": {
       "testcafe:generatereport": "yarn testcafe ./testcafeReportGeneratorTest.ts"
    },
    "dependencies": {
        "electron": "^14.0.0",
        "nightmare": "^3.0.2",
        "node-html-parser": "^4.1.4",
        "testcafe": "1.16.0",
        "testcafe-browser-provider-nightmare": "^0.0.5",
        "testcafe-reporter-html": "^1.4.6",
        "testcafe-reporter-html-testrail": "^3.1.5",
        "typescript": "^4.4.2",
        "vo": "^4.0.2"
    }
}

testcafeReportGeneratorTest.ts

import { Selector } from 'testcafe';

fixture`A set of examples that illustrate how to use TestCafe API`
    .page`http://devexpress.github.io/testcafe/example/`;


const developerName = Selector('#developer-name');

test('How to type text into an input (t.typeText user action)', async t => {
    await t
        .typeText(developerName, 'Peter')
        .typeText(developerName, 'Paker', { replace: true })
        .typeText(developerName, 'r', { caretPos: 2 })
        .expect(developerName.value).eql('Parker');
});

Could you check if this issue is reproducible with these files?

Pavel Avsenin
  • 254
  • 1
  • 2
  • Tried this, did not work either. Also tried to install `electron` globally `yarn global add electron` also did not work. can it be something with the runner image I'm using? – David Faizulaev Sep 20 '21 at 08:38
  • I made some attempts but cannot reproduce this issue on my side. It seems like the issue may be related to some specific characteristics of your environment. Thus, I can only suggest you check the list of related questions about the "spawn ENOENT" error: [https://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js](https://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js) – Pavel Avsenin Sep 23 '21 at 12:55