Continuous Delivery – OPA and Selenium, NodeJS and Jenkins #6
Previous parts to this series (part one, part two, part three, part four, part five) have spoken about the different tools to test Web Services and HTML Interviews for Oracle Intelligent Advisor. In this post, we will see how a more complex tool can allow the team to perform larger-scale and more sophisticated tests when coupled with Jenkins. In this case the learning curve is more challenging, but often there are already resources available to help the process.
In common with other chapters in this series, the platform includes NodeJS, and this time we have added selenium as well as (for demonstration purposes) the Mozilla driver (also known as gecko driver). The preferred choice of scripting tool is very much up to each developer, however the screenshot below shows a simple piece of NodeJS code to implement something similar to our previous examples.
Working with Selenium WebDriver in this way has a number of challenges in respect of Oracle Intelligent Advisor, the most commonly cited being the dynamic nature of classes and identifiers in the HTML page. As a result, simple selectors such as the following are not advisable since they are not reliable and will change as you make modifications to your Screen:
driver.findElement(By.xpath("//label/span[contains(text(), 'Where are you travelling from' )]/../../../div/div/select/option[text() = '" + myJourneys[journey].origin + "']"));
Working with this platform has the added benefit of being easy to integrate into Jenkins, as we saw earlier in the series as well. Since we previously organized running Newman as a NodeJS Build Step in our Jenkins Project, we can do the same with our Selenium code, in a quick and dirty example.
A Jenkins job is running our tests…