running the cypress via node in C# giving error "Could not find Cypress test run results" #26648
Unanswered
ArunVenkat1994
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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
Beta Was this translation helpful? Give feedback.
All reactions