cypress 결과 리포트 html

sunny·2022년 12월 6일
0

cypress

목록 보기
3/3

테스트 결과를 리포트 하고 공유를 할때,

1. 설치

npm i --save-dev cypress-mochawesome-reporter

2. cypress.config.js 수정

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  reporter: "cypress-mochawesome-reporter",
  video: false,
  reporterOptions: {
    charts: true,
    reportPageTitle: "Cypress Inline Reporter",
    embeddedScreenshots: true,
    inlineAssets: true, //Adds the asserts inline
  },

  e2e: {
    setupNodeEvents(on, config) {
      require("cypress-mochawesome-reporter/plugin")(on);
    },
  },
});

3. cypress/support/e2e.js에 import작업

import "cypress-mochawesome-reporter/register";

4. cypress 테스트 실행

따로 테스트하고 싶은 항목만을 체크하고 싶은데 그 방법은 모르겠다
아래 명령으로 모든 테스트가 실행된다.

npx cypress run --e2e

실행결과는 report/html의 index.tml으로 리포팅된다.
오류는 screenshots에 나오고 실행영상은 videos에 녹화된다.

5. 결과 리포트

index.html 실행하여 확인

생각
mocha를 사용해야 하는것 같은데 사실 무슨말인지 몰라서 여기까지 시간이 좀 걸렸다ㅎ
우선 여기까지만 되어도 훌륭하게 사용할 수 있을것 같은 느낌이다.

profile
Believe in yourself :)

0개의 댓글