RSpec WebDriver Page Object Tutorial

In this tutorial we will go through RSpec WebDriver Page Object. We will firstly discuss what the Page Object pattern is and why we would want to use it.

In summary the Page Object pattern is used to map web pages to code classes. The whole point of doing this is to allow someone to easily write tests for given web pages by simple reusing the same code over and over again whilst also reducing code duplication and promoting code reuse.

RSpec WebDriver Page Object Video Tutorial

rspec webdriver page object

Direct Video Link

Follow this video tutorial to learn how we can incorporate WebDriver and the Page Object Pattern in RSpec.

RSpec Should Expect Tutorial

We will now finally discuss RSpec Should Expect. Should and Expect are essentially the tools which we use to to validate or satisfy a test condition. Should and Expect are essentially the equivalent to JUnit or Hamcrest from Java. Writing good Should and Expect statements really helps to validate test conditions as well as tell us what the failure is when a test fails.

RSpec Should Expect Video Tutorial

rspec should expect

Direct Video Link

Follow the video tutorial above to learn how to write both Should and Expect statements in your RSpec tests. Once complete you will get a deeper understanding of how these assertions can be combined with WebDriver.

RSpec Alert Window Tutorial

When writing tests we need to strongly consider using RSpec Alert Window as part of our test scenarios. When navigating to web pages and performing various actions such as filling in contact forms or performing a search query then you as a user may sometimes be presented with an Alert Window. An Alert Window is essentially a pop up window which appears telling the user to promptly perform some action before proceeding.

RSpec Alert Window Video Tutorial

rspec alert window

Direct Video Link

Follow the video tutorial above to quickly learn how to manage writing tests for Alert Windows. Learning to test alert windows will also help you to learn about window management.

RSpec Hooks Tutorial

RSpec hooks are essentially code blocks which are automatically called and executed when a test reaches a certain condition or state. For RSpec, in this tutorial we will cover two hooks. We will cover the before and after hook. The before hook is used to run code before a given test is executed. We can use the before hook to help us run code which can be used to setup a given test. Similar we can also write and run an after hook. The after hook can be used to run code after a test has finished. After hooks are prefect places to run code such as closing browsers, setting variables to null etc.

RSpec Hooks Video Tutorial

rspec hooks

Direct Video Link

RSpec WebDriver CssSelector Tutorial

In this tutorial we will cover RSpec WebDriver CssSelector Tutorial. CssSelector works very similarly to XPath and Locators but the main difference is that unlike XPath and Locators which look at the HTML source code for a given web page, CssSelector looks at the cascading style sheets for a given web page.

RSpec WebDriver CssSelector Video Tutorial

rspec webdriver cssselector

Direct Video Link

CssSelector is subject to the same type of weakness as XPath is. For XPath if the structure of the web pages changes then your paths for xpath may break in your tests. The same can be said for cascading style sheets i.e. is the style sheets change then your tests may also start to fail as a direct result.

RSpec WebDriver XPath Tutorial

In this post we will discuss RSpec WebDriver XPath. We will look at how we can use xpath to help us find elements on a web page when writing WebDriver tests through RSpec. Unlike Locators (as discussed in the previous tutorial) xpath can break very easily and as a result someone would encourage that you dont write xpath tests. However we will slightly look into this issue as well in this video tutorial.

RSpec WebDriver XPath Video Tutorial

rspec webdriver xpath

Direct Video Link

We will discuss how to minimize issues with xpath and how it can provide a different approach as opposed to using locators to help us locate elements on a web page.

RSpec WebDriver Locators

In this video tutorial we will discuss RSpec WebDriver Locators. WebDriver locators are essentially the key mechanic to help us locate and find elements on a web page. Locators also help us to identify and interact with objects such as page click and text entry into text fields.

RSpec WebDriver Locators Video Tutorial

rspec webdriver locators

Direct Video Link

In this video tutorial we will discuss a number of different ways we can use locators to help find an element on a web page. We will use locator methods such as locating an element by class, by id, by name, by text and partial text etc. There are a number of options available to use and we will explore them all.

RSpec WebDriver Setup Tutorial

In this tutorial we will look at RSpec WebDriver setup. We will look at how we can incorporate WebDriver into Ruby and then write RSpec scenarios to use WebDriver to run tests. Naturally we will also write and run a number of tests to full cement out understanding of writing the basic tests for RSpec and WebDriver.

RSpec WebDriver Setup Video Tutorial

rspec webdriver setup

Direct Video Link

Follow the video tutorial above to help us take our first setup to getting WebDriver and Ruby RSpec talking to each other. This is going to be our first big milestone before we start talking about all the features of WebDriver for RSpec.

Basic RSpec Test Tutorial

In this tutorial we will write our first basic RSpec test. We will look at what is needed to write a basic test and also more importantly discuss the mechanics and features of writing a simple RSpec Test. We will go further and run our RSpec test with basic statements to learn more about writing these tests and trying to understand the fundamental concepts behind this.

Basic RSpec Test Tutorial

basic rspec test

Direct Video Link

Follow the video tutorial above to lean the basic syntax of writing RSpec tests. We will go through this in baby steps and start from the basics.

RSpec Setup Tutorial

Ruby RSpec Setup tutorial in which we will begin by installing all the required software in an environment completely from scratch. Similarly like Cucumber, RSpec can be used to write scripts which can be expressed in a very Gherkin like fashion. We will download and install all the required software and also write a very basic RSpec script to confirm that our setup is complete.

Ruby RSpec Setup Tutorial

rspec setup tutorial

Direct Video Link

By following the video tutorial highlighted in this post we should get into a position where we can easily start writing and learning much more about RSpec. We will shortly begin to look at the integration between Ruby, RSpec and WebDriver.