cypress-oracle-db
v2.0.0
Published
Interact with Oracle DB via a Cypress command
Downloads
23
Readme
Introduction
Oracle DB extension for Cypress
Install
Add git repo to your package.json
dependencies
"cypress-oracle-db": "*"
or use npm install
and save
npm install --save-dev cypress-oracle-db
Configure
Plugin file
This extension requires the Oracle Node driver and connection details as a dependency. Pass them in when instantiating the plug-in.
The code below should be added to your cypress/plugins/index.js
file.
const oracle = require('oracledb'),
configSwitcher = require('cypress-config-switcher'),
db = require('cypress-oracle-db');
module.exports = (on, config) => {
config = configSwitcher.loadEnvConfig(config);
tasks = db.loadDBPlugin(oracle, config.db);
on('task', tasks);
}
Commands file
Example support/index.js
file.
import mis from 'cypress-oracle-db';
mis.loadDBCommands();
import './commands.js';
Usage
cy.oracle(query)
cy.oracle(`SELECT 'something'
FROM dual`).should('eq', 'something');
let sql;
let binds;
sql = `test_data_management_pkg.proc_test(:p1, :p2);`;
binds = {
p1: 'Something',
p2: {dir: 'out' }
};
cy.oracle(sql, binds).should(r => {
expect(r.outBinds.p2).to.eq(`You Sent ${binds.p1}`);
});