@monitorapex/cypress-oracle-db
v1.0.2
Published
Access Oracle DB via Cypress commands
Downloads
2
Readme
Introduction
Oracle DB extension for Cypress
Install
Add git repo to your package.json
dependencies
"@monitorapex/cypress-oracle-db": "*"
or use npm install
and save
npm install --save-dev @monitorapex/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('@monitorapex/cypress-config-switcher'),
db = require('@monitorapex/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 '@monitorapex/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}`);
});