Code Monkey home page Code Monkey logo

tests's Introduction

Preconditions

  • Install NodeJS LTS Version.
  • Any IDE for example VSCode.
  • Install/Update Chrome Browser to latest stable version.

Prepare environment

  • Go to the Root folder
  • Install JS dependencies - npm install

Running Automation Tests

  • From the command line - npm run test

Structure of the project

├───output
├───helpers
├───src
    ├───elements
    ├───pages
├───specs
    ├───.spec.js

helpers - directory with additional helpers that extends base API.
specs - folder with tests.
src - folder contains our Page Object/Page Fragments and elements wrappers.

Nuances for working with PageObjects

  • Name of the file with PageObjects should be talkable, so it is clear what's inside. Pattern of the file name [componentName].[page/fragment].js.
  • All the selectors/locators are stored in the PageObjects. Locator should have comment where it is situated on the page, and what it is.
  • Locator priority: Id, CSS, XPath.
  • Repeatable steps in the tests write in the PageObjects as a method.

Nuances for writing tests

Name of the test should be talkable, so one can define what test about. Follow next pattern [acceptance | E2E | integration].[name].spec.js

Name Scenario - use case or story with acceptance criteria in the name. Follow the rule - When->Then.

Example: Unauthorised user goes to the welcome page. The user should be redirected to login page and see the login form to authorize

Steps of the test should be described from the end-user perspective and should be talkable.

  • All the selectors should be located inside the pageObjects
  • All the timeouts should be located inside the pageObjects
  • All tests you implement should be easy to customize.

WaitUntil should be used most of the time, cause sometimes chromium can move forward without loading whole page.

Useful links

  • WebDriverIO - Useful to learn how it works
  • MochaJS - Useful to learn additional commands for our test runner
  • Chai - assertion library. Extends the NodeJS's assert.

Useful materials for locators/selectors

tests's People

Contributors

helenalisenok avatar

Watchers

 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.