Giter VIP home page Giter VIP logo

react-cypress's Introduction

react-cypress

Cypress를 이용한 React E2E테스트

본 프로젝트는 blackcoffee-study/js-counter-test 레포지토리를 기반으로 만들었습니다.

Project

프로젝트 미리보기 🔗링크

E2E 도구인 Cypress로 테스트를 수행해 보기 위한 간단한 Counter App

기능 명세

기능 명세대로 기능이 동작하는지 테스트합니다.

  • Counter는 초기값 0 부터 시작한다.
  • + 버튼을 클릭하면 Count가 1 증가하여 표시된다.
  • - 버튼을 클릭하면 Count가 1 감소하여 표시된다.
  • Count는 최소 0, 최대 5까지만 표시된다.
  • 최소, 최대 범위를 넘어 클릭이벤트가 발생하면 alert이 표시된다.
  • Reset 버튼을 클릭하면 Count가 0으로 초기화된다.

Create React App을 통한 React App 생성

npx create-react-app . 으로 현재 디렉토리에 React App을 생성하여 진행한 프로젝트 입니다.

Cypress 패키지 추가 및 실행

https://www.cypress.io/

dev dependency로 설치

npm install --save-dev cypress

실행

./node_modules/.bin/cypress open

첫 실행시에는 시간이 소요될 수 있다.

Cypress 실행화면

기본으로 설치된 샘플들을 확인하고, 테스트해 볼 수 있다.

파일명의 .spec.js는 이 제품의 사양(specification)이 어떻게 되는지 알려주는 테스트파일이라는 의미이다.

원하는 테스트파일을 클릭하여 테스트를 실행할 수 있다.

테스트 파일로 E2E 테스트하기

test/cypress 브랜치에서 확인(./cypress/itegration/counter.spec.js)이 가능합니다.

Counter App 테스트 실행 목록

테스트가 올바르게 실행된 화면

테스트 상세화면

상세 확인이 가능합니다.

✅ 이 레포지토리를 clone 하여 자유롭게 사용하셔도 됩니다.


참고 링크

react-cypress's People

Contributors

bb-choi 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.