Giter VIP home page Giter VIP logo

cypress-testing's Introduction

Get Started with Cypress

Install and configure

Prerequisites to have node(and npm) installed

mkdir cypress-testing

cd cypress-testing

npm init

npx cypress open

It should open a new window that says E2E Testing not configured.

Click that option to get it to automatically configure.

The next screen will prompt which browser, it doesn't matter which one so pick your favourite.

It will also prompt for creating your first spec file, select that, and rename that file if you want.

Updating your tests

If the previous steps are successful, it will have scaffolded a bunch of files for you.

Your project should now have a /cypress folder

open that and you can find the /e2e folder. this is where you'll find your tests.

Adding utilities

The best practice is to add data-cy attributes to your html so that it is easier to target interactive elements. If you're unable to do that, then it's going to be hard to test, but not undoable.

PageObject approach

Another best practice is to divide each page into a PageObject. This groups all of the selectors on a page into a single object so that any interaction with the page is through this pageObject.

cypress-testing's People

Contributors

artesgo 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.