Skip to content

A repo showing a templated use of Cypress 10 working with oracledb and Cucumber

License

Notifications You must be signed in to change notification settings

davethepunkyone/cypress10-oracle-cucumber

Repository files navigation

cypress10-oracle-cucumber

A repo showing a templated use of Cypress 10 configured to use Cucumber working with oracledb.

This implementation is inspired by this article by Poopae Paisingkhon. The implementation referenced in the article is designed with previous versions of Cypress utilizing the /plugin directory, which has now been depreciated.

This uses logic in the article above but places it directly within cypress.config.ts, but it otherwise works in the same way.

Using features in Cypress

This project uses the cypress-cucumber-preprocessor to allow for the creation of Given, When, Then steps and the use of feature files instead of spec files. Examples of steps using Cucumber can be found in the general-steps.ts file, whilst the implementation of these steps in a feature can be found in Test.feature.

Configuring the database connection

To utilize the oracledb functionality, the following needs to be set in the cypress.env.json file:

  • oracleInstantClient: The path to the Oracle Instant Client directory on the machine executing the tests.
  • db.user: The username for the database user.
  • db.password: The password for the database user.
  • db.connectString: The connection string used for the database, probably along the lines of <host>:<port>/<sid>.

Using in steps

The database-steps.ts file has an example of how to run a simple SQL query formatted in a given step. The feature file present doesn't include this step, only because there is no defaulted Oracle database and a database configuration is required to make the step work.

About

A repo showing a templated use of Cypress 10 working with oracledb and Cucumber

Topics

Resources

License

Stars

Watchers

Forks