I have a question: How do you work with selenium-ruby?
I was planning on working towards what Dave Haeffner has in ElementalSelenium.com creating a library of:
It looks like Gauge strongly advocates against page objects calling them an Anti-Pattern. Er... Um... burying a page's locators in code, as they do in the blog makes me worried. I am looking for other solutions.
I was planning on working towards what Dave Haeffner has in ElementalSelenium.com creating a library of:
- Using Base Page Objects to wrap Selenium Ruby calls with proper waits.
- Using Page Objects, so that when locators inevitably change, I know where exactly to fix them.
- Making the tests data-driven
- Adding Rescue exceptions to avoid weeding through Stack traces.
- Maybe JQuery Growl for better logging, and Wrapped Selenium Tests
It looks like Gauge strongly advocates against page objects calling them an Anti-Pattern. Er... Um... burying a page's locators in code, as they do in the blog makes me worried. I am looking for other solutions.
To figure out this new automation framework we are using at my workplace, I ripped off code from Gauge's example project, ruby-selenium, and tried to get it to point to Dave Haeffner's site, The-Internet, so I could better attempt to understand this BDD framework I am encountering for the first time.
I created a little project that I called: gauge-selenium-ruby-first-draft. (View it on GitHub!). It contains:
I created a little project that I called: gauge-selenium-ruby-first-draft. (View it on GitHub!). It contains:
env/default:
- default properties: Points to where the reports and logs are, chooses Chrome to be the default browser, and chooses whether or not you should overwrite reports, capture screenshots on failure, enable multithreading. You can also choose when you want the objects to be cleatred... after execution of suite, spec, or scenario.
- user properties: Points to the APP_URL, and chooses if you want the tests to be headless or not.
- UserAction.spec: Heavily ripped off of the Gauge sample project, ruby-selenium, this is the "executable specification file. This file follows markdown syntax. Every heading in this file denotes a scenario. Every bulleted point denotes a step". Contains "Login as username and ", "Check if the user is logged in" and "Log out". Also contains a data table for username and passwords.
- concepts/Authentication.cpt: Specs can refer to these concepts, "Check if the user is logged in" and "Log out", breaking them down.
- authentication.rb: Contains the selenium-ruby code that acts out the steps "Give an option to Log Out", 'Give an option to Log In' and a logout method.
- user_login: Contains the step "Login as username and ", which uses selenium-ruby to send text to the username and password textbox, and presses the Login button.
- driver.rb: Contains the setup and teardown methods, creating the driver and quitting the driver. Also sets up the driver with:
options = Selenium::WebDriver::Chrome::Options.new
@@driver = Selenium::WebDriver.for :chrome, options: options
options.add_argument('--headless')
options.add_argument('--disable-gpu')
- find_message: Any messages that you need to check for? There is this method that Gauge's ruby-selenium has, "Show a message ".
- screengrabber.rb: Provides a wrapper for driver.save_screenshot('/tmp/screenshot.png')
- site_launcher: Contains the step "Navigate to the login page", which then does:
assert_equal 'The Internet', driver.title
Examine the code I hacked together at https://github.com/tjmaher/gauge-selenium-ruby-first-draft, based on the ruby-selenium sample project.
Happy Testing!
-T.J. Maher
Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston
Twitter | YouTube | LinkedIn | Articles
-T.J. Maher
Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston
Twitter | YouTube | LinkedIn | Articles
2 comments:
Thanks for sharing such a great Information! Waiting for more updates like this.
https://www.gologica.com/course/selenium-with-ruby-framework-training/
https://www.gologica.com/elearning/all-information-about-dell-boomi-technology/
google 418
google 419
google 420
google 421
google 422
Post a Comment