I have setup a project in RubyMine using Ruby with Cucumber, RSPEC, and Watir for UI automation of feature files. (I also have page objects implemented). In my step_definitions where the actual UI automation steps occur, I want to programatically run queries against SQL Developer to validate changes upon test completion (basic queries) and also run other updates, as needed. I would then add expect/asserts using values on UI and values from tables.
So far I have successfully setup database connections following the instructions here but this operates as a separate window for connecting and running sql commands outside of my Watir tests. But what I am having trouble doing is calling this connection from within my actual tests within the step_definitions (perhaps setting up the basic connections from within an env.rb file. I have also looked into oci8 but have had trouble actually implementing this, so I am wondering if anyone can help with suggestions on pulling in database connections to Ruby/Watir code as part of the end-to-end UI automation scripts.
Example test case in RubyMine:
Given(/^a user goes to the main login page$/) do @login_page = LoginPage.new(@browser) @login_page.visit_new_site # Using page object end When(/^they enter an ID and password$/) do @login_page.enter_login_id('userID') @login_page.enter_password_id('userPassword') end Then(/^New web page should allow user to click Log In$/) do @login_page.screenshot.save("C:/robert") @login_page.close # I want to call database connection here to validate login message from table, for example end