Code Monkey home page Code Monkey logo

saucedemo's Introduction

Sauce Demo Test Automation

Automation and parallel testing practice after the learning and basic understanding of Selenium Webdriver, WebDriverIO and Cucumber.


User Stories

  • UI Automation
    • Log into the site
    • Sort the items (Lowest Price sort)
    • Add two or more items to the shopping cart
    • Visit the shopping cart
    • Assert that the items that you added are in the cart
    • Remove an item and then continue shopping
    • Add another item
    • Checkout
    • Assert you are purchasing the correct items
    • Assert the total price
    • Finish checkout
  • API Automation
    • Make GET, POST, PUT, and DELETE calls
    • Set headers for a request
    • Set the body for a request
    • Assert the response from a request
    • Use the response from one call in the request for another

Technology

Mocha, Chai, Supertest, WebDriverIO, Cucumber


Functionality

The test functionality includes:

  • UI
    • Login
      • User may login with registered credentials
    • Inventory/Cart
      • User may sort inventory items
      • User may add items to shopping cart
      • User may remove items from shopping cart
      • User may visit the shopping cart
    • Checkout
      • User may confirm items added
      • User may confirm total amount
      • User may checkout
  • API
    • User may request a post
    • User may create a post
    • User may patch a post
    • User may delete a post

UI Structure

  • ui-test
    • features
      • cart.feature
      • checkout.feature
      • DEMO.feature
      • inventory.feature
      • login.feature
    • step-definitions
      • cart
        • given.js
        • then.js
        • when.js
      • checkout
        • then.js
        • when.js
      • inventory
        • then.js
      • login
        • given.js
        • when.js
      • reusable
        • given.js
        • then.js
        • when.js
    • support
      • actions.js

Notes:

There does not seem to be a generally approved standard for directory structure in tests, and is more dependent on the team's choice. For this reason, I found it more convenient to keep a When/Given/Then structure for scalability purposes.


API Structure

  • api-test
    • tests
      • api.test.js
    • test-setup.js

Local Dev Set Up

Clone the repository to your local computer

git clone https://github.com/dionisggr/saucedemo.git

Use the package manager npm to install dependencies:

npm install

Don't forget to audix fixes if needed:

npm audit fix

Run the UI automation tests in parallel (Chrome & Firefox):

npx wdio wdio.conf.js

Run the API automation tests:

npm test

Notes

Tests run in instances of 5 for performance consideration in the user-end when running the tests.

You may change the maximum instances 10 (maximum amount of tests) or higher, as your machine allows.

In wdio.conf.js:

...

exclude: [
  // 'path/to/excluded/files'
],

maxInstances: 5,   // Change to 10, or your preference

capabilities:[{
  ...
}]

...

saucedemo's People

Contributors

dionisggr avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

sanam-07

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.