this my cypress.config.ts: import { defineConfig } from "cypress";
import createBundler from "
@gray-kilobyte-89541/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "
@freezing-piano-2792/cypress-cucumber-preprocessor";
import createEsbuildPlugin from "
@freezing-piano-2792/cypress-cucumber-preprocessor/esbuild";
const oracledb = require("oracledb");
oracledb.initOracleClient({ libDir: "C:\\Oracle\\instantclient_19_3\\oci.dll" });
// This data is correct, I've obscured it for obvious reasons
const db_config = {
"user": "
",
"password": "
",
"connectString": "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=melideo.claro.amx)(PORT=1521))(CONNECT_DATA=(SID=ARTPROD)))"
}
const queryData = async(query, dbconfig) => {
let conn;
try{
// It's failing on this getConnection line
conn = await oracledb.getConnection(dbconfig);
console.log("NOTE===>connect established")
return await conn.execute(query);
}catch(err){
console.log("Error===>"+err)
return err
} finally{
if(conn){
try{
conn.close();
}catch(err){
console.log("Error===>"+err)
}
}
}
}
async function setupNodeEvents(
on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions ): Promise
{
await addCucumberPreprocessorPlugin(on, config);
on("file:preprocessor", createBundler({
plugins: [createEsbuildPlugin(config)],
})
);
on("task", {
sqlQuery: (query) => {
return queryData(query, db_config);
},
});
return config;
}
export default defineConfig({
e2e: {
specPattern: "**/*.feature",
supportFile: false,
setupNodeEvents,
},
});