Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple example of the integration Cypress with Mochawesome library to generate HTML and JSON report after tests run.

NotificationsYou must be signed in to change notification settings

Ebazhanov/cypress-mochawesome-html-report-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the simple example for integrating Cypress with Mochawesome library to generate HTML and JSON report.

mochanpm version


How to setting up in your project

Install

  • $ yarn add mochawesome --dev
  • $ yarn add mochawesome-merge@2.1.0 --dev
  • $ yarn add mochawesome-report-generator --dev

Add the following code inside yourcypress.json

{"reporter":"mochawesome","reporterOptions": {"reportDir":"cypress/results","overwrite":false,"html":false,"json":true  } }

How to generate report Locally

  • $ yarn start & cypress run --headless --browser chrome
  • $ npx mochawesome-merge --reportDir cypress/results > cypress/merged-report.json
  • $ npx marge cypress/merged-report.json -o cypress/mochawesome-html-report

Find your HTML report in the.../cypress/mochawesome-html-report/merged-report.html

How to generate report in Circleci

Add this configuration into yourconfig.yml file

version:2.1orbs:cypress:cypress-io/cypress@1.26.0workflows:build:jobs:      -cypress/run:install-command:yarn install --frozen-lockfilestart:yarn startwait-on:'http://localhost:3000'post-steps:            -run:name:Create merged-report Directorycommand:mkdir cypress/merged-report/            -run:name:Merge mochawesome jsons in one filewhen:alwayscommand:npx mochawesome-merge --reportDir cypress/results > cypress/merged-report/merged-report.json            -run:name:Generate mochawesome html reportwhen:alwayscommand:npx marge cypress/merged-report/merged-report.json -o cypress/mochawesome-html-report            -store_artifacts:name:Uploading mochawesome-merged-report.jsonpath:cypress/merged-report            -store_artifacts:name:Uploading mochawesome-html-reportpath:cypress/mochawesome-html-report

Demo:CircleCI

ToDos:

  • find the way to attach screenshots & video on failure

P.S. if you want to try something else look atAllure 2 reporthere

About

A simple example of the integration Cypress with Mochawesome library to generate HTML and JSON report after tests run.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp