JeringTech / Javascript.NodeJS

Invoke Javascript in NodeJS, from C#
Other
454 stars 43 forks source link

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

Open arunvenkat1911 opened 10 months ago

arunvenkat1911 commented 10 months ago

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

JeremyTCD commented 10 months ago
{"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.