Giter Club home page Giter Club logo

page-objects-example's Introduction

Salvo tests

A salvo in more modern terms is also the simultaneous discharge of artillery or firearms including the firing of guns either to hit a target, or in our case, a lot of websites

Fast and simple tests to reduce regression time by test every service on the responsive news codebase.

Install dependencies

bundle install
brew install phantomjs

Options

There are several command line options that you can use when running the tests. These include width and config. The final option is the tag name, ON, which ensures that only tests that have been enabled in the config will be run. This option is stored within the .rspec file.

Running

An example command would be

WIDTH=1024 CONFIG=news.yaml rspec

Another

WIDTH=320 CONFIG=arabic.yaml rspec

Configs

There are configs in the configs folder that store all the test data, it is loaded in via Yaml files.

Style guide

Tests should be written in the style of the 4-phase test. Though we probably don't need to do a lot of tear down, the 4 phase test follows this format

setup
exercise
verify
teardown

An example of 4 phase
# Setup
@video_page = AVPage.new
# exercise
@video_page.load
# verify
expect(@video_page).to have_a_video_player
# teardown
n/a

Page Objects

We are using page objects to describe methods and behaviour on the page to make tests cleaner and easier to read. This POM is using SitePrism. When writing a test, create or update an existing support class with a simple file and class name. Methods should also reflect actions or logic that a user would do, e.g open_navigation or have_top_stories.

Within the page objects class, define a load method that will visit the page, also include matchers from RSpec/Capybara.

When instantiating the class in the test, reduce deplication by creating before and let objects.

describe 'correspondent_page page' do
  before(:each) do
    @correspondent_page = CorrespondentPage.new
    @correspondent_page.load
  end

Contributing

Submit tests in the same format as described above, update configs as per style found in news.yaml

page-objects-example's People

Contributors

dblooman avatar

Stargazers

Ritchie J. Latimore avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.