Coder Social home page Coder Social logo

dipjyotimetia / testing-workshop-cypress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cypress-io/testing-workshop-cypress

1.0 3.0 0.0 46.09 MB

End-to-end testing workshop with Cypress

JavaScript 97.36% TypeScript 0.10% CSS 0.02% HTML 2.52%

testing-workshop-cypress's Introduction

testing-workshop-cypress

cypress version CircleCI Build status renovate-app badge

A full day testing workshop complete with application, exercise tests and speaker slides for Cypress.io

Requirements

In order to get the code and install dependencies

git clone [email protected]:cypress-io/testing-workshop-cypress.git
cd testing-workshop-cypress
npm install

If necessary, install dependencies inside TodoMVC folder

cd todomvc
npm install

Quick check โœ…

You can test the installation by starting TodoMVC in the first terminal window

cd todomvc
npm start

and you should see in the terminal

> json-server --static . data.json --middlewares ./node_modules/json-server-reset


  \{^_^}/ hi!

  Loading data.json
  Loading ./node_modules/json-server-reset
  Done

  Resources
  http://localhost:3000/todos

  Home
  http://localhost:3000

Note for Windows users: if npm start throws an error, it is probably due to cd todomvc; ... first command in the npm start script. In this case change the working folder to "todomvc" and run npm start from there.

From the second terminal window you should be able to open Cypress in the root of the project with

$ npm run cy:open

> [email protected] cy:open /git/testing-workshop-cypress
> cypress open

Tip

You can use the installed start-server-and-test utility to start the app, open Cypress and then shutdown the app when you exit Cypress.

$ npm run dev

Application ๐Ÿ’พ

Vue.js + Vuex + REST server application that we are going to test is in the folder todomvc. This application and its full testing is described in this blog post. The application should run fine without network access.

Slides ๐Ÿ–ฅ

See the presentation at https://testing-workshop-cypress.netlify.app/. Every section of the presentation has a subfolder in the slides folder with a Markdown file. The Markdown is rendered into HTML using Vite and Reveal.js combination. You can open the presentation by clicking on "link" in the table below.

Content ๐Ÿ—‚

Beginner

topic folder contents slides
๐Ÿ”— Introduction, TodoMVC application todomvc intro.md link
๐Ÿ”— Loading page 00-start 00-start link
๐Ÿ”— cypress open vs cypress run 01-basic 01-basic link
๐Ÿ”— Adding items test, cypress.json file 02-adding-items 02-adding-items link
๐Ÿ”— Selector Playground 03-selector-playground 03-selector-playground link
๐Ÿ”— Reset database using cy.request 04-reset-state 04-reset-state link
๐Ÿ”— Spy and stub XHR requests, fixtures 05-xhr 05-xhr link
๐Ÿ”— Access application code and data 06-app-data-store 06-app-data-store link

Intermediate

topic folder contents slides
๐Ÿ”— Setting up E2E tests on CI 07-ci 07-ci link
๐Ÿ”— Setting up Cypress Dashboard 07-ci 08-dashboard link
๐Ÿ”— Test reporters - 09-reporters link
๐Ÿ”— Configuration - 10-configuration link
๐Ÿ”— Retry-ability 11-retry-ability 11-retry-ability link
๐Ÿ”— Custom commands 12-custom-commands 12-custom-commands link

Advanced

topic folder contents slides
๐Ÿ”— Page Objects vs App Actions 13-app-actions 13-app-actions link
๐Ÿ”— Fixtures 14-fixtures 14-fixtures link
๐Ÿ”— Debugging 02-adding-items/demo.js 15-debugging link
๐Ÿ”— Preprocessors 16-preprocessors 16-preprocessors link
๐Ÿ”— Component testing 17-component-testing 17-component-testing link
๐Ÿ”— Backend code 18-backend 18-backend link
๐Ÿ”— Code coverage 19-code-coverage 19-code-coverage link
๐Ÿ”— Stubbing methods 20-stubbing 20-stubbing link
The end - end link

For speakers ๐ŸŽ™

Netlify Status

This workshop can take all day, but you can pick the sections you are interested in teaching at will and customize it into any time duration. Everyone is coding for the most part, except for CI and the Cypress Dashboard sections, where the usage was shown via slides and actual sites.

During the workshop, keep the todomvc app running in one shell, while each section 01-basic, 02-..., 03-... etc. has its own Cypress and specs subfolders cypress/integration/.... Usually a spec has several tests with placeholder comments. The workshop attendees are expected to make the tests pass using the knowledge from the slides and hints (and Cypress documentation). Note that most folders have a prepared spec.js file and an answer.js file. The answer.js file is ignored by Cypress using a setting in cypress.json.

The only exception is the folder 00-start. This is a folder for students to see how Cypress scaffolds example specs when you open Cypress for the very first time. In this folder students should execute...

cd 00-start
npm run cy:open

...and see the list of created example specs.

The slides are generated using Reveal.js from Markdown sources in the slides folder. You can show the slides locally by running

npm run slides:dev

The slides are deployed to Netlify automatically, see https://testing-workshop-cypress.netlify.app/

Additional information ๐Ÿ—ƒ

testing-workshop-cypress's People

Contributors

bahmutov avatar renovate[bot] avatar renovate-bot avatar dipjyotimetia avatar amirrustam avatar bartduisters avatar dbeigi avatar jennifer-shehane avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar  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.