Cannot connect to microsoft sql from Cypress #16970
Unanswered
shivanijamadar
asked this question in
Questions and Help
Replies: 1 comment
-
Hi @shivanijamadar, did you resolve this issue? |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Hello @jennifer-shehane below is my code to access database but getting the following error, can you please guide?
Error:

index.ts:
const cucumber = require('cypress-cucumber-preprocessor').default
const mssql = require("mssql");
const syncSql = require("sync-sql");
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
on('task', {
getDBDataSync : getDBDataSync
});
return config;
}
function getDBDataSync(){
const config = {
host : "192.168.44.136\qa" ,
port: 1433,
Login : "Test1",
Pwd : "Test1",
database: "master",
}
const query = "select * from dbo.spt_fallback_db";
return syncSql.mssql(config, query);
}
spec.js :
cy.task("getDBDataSync").then((result) => {
console.log(result);
} );
Beta Was this translation helpful? Give feedback.
All reactions