Javascript.NodeJS icon indicating copy to clipboard operation
Javascript.NodeJS copied to clipboard

running the cypress via node in C# giving error "Could not find Cypress test run results"

Open arunvenkat1911 opened this issue 2 years ago • 1 comments

Hi,

I am trying to run the cypress from C# using the node package "Jering.Javascript.NodeJS"

When I run the cypress from cmd directly, it is running fine and giving results.

but when I run from c#, I am getting the below error. {"status":"failed","failures":1,"message":"Could not find Cypress test run results"}

C# code: using Jering.Javascript.NodeJS;

string result = await StaticNodeJSService.InvokeFromFileAsync(@"E:\Samples\Cypress\E2E\e2e-run-tests.js");

JS code: E:\Samples\Cypress\E2E\e2e-run-tests.js file code:

const cypress = require('cypress') module.exports = async function(callback){ let result = "";

await cypress .run({ spec: 'Test1.cy.js', }) .then(testResults => { result = testResults; }) .catch((err) => { callback(err); }) return result; }

Test1.cy.js file code: describe('empty spec', () => { it('passes', () => { cy.visit('https://example.cypress.io/') cy.contains('type').click() }) })

Please suggest the possible solution

arunvenkat1911 avatar Nov 14 '23 06:11 arunvenkat1911

{"status":"failed","failures":1,"message":"Could not find Cypress test run results"}

This means this library is working, you'll need to look into your Cypress setup.

JeremyTCD avatar Nov 15 '23 02:11 JeremyTCD