Skip to content

Latest commit

 

History

History
84 lines (66 loc) · 7.13 KB

README.dev.md

File metadata and controls

84 lines (66 loc) · 7.13 KB

Development

Some of these is under construction.

TODO

  • Readme, setup and installation
  • proper tests
  • tests for plugins

Defects / enhancements

  • #41 - Do not attach files with long arguments to child commands - only for parent - enhancement
  • #152 - Global hook doesn't have steps for tests in nested suites - bug minor
  • #119 - Global After hooks are not being added to test when it has more than one parent suite - bug minor
  • #156 - Before/after each are not marked as failed for failed attempts of test when retries >0 - bug minor
  • #77 - Mark parent step non-success when some steps have non-success status - enhancement
  • #64 - Uncaught:exception step is marked as passed step and all its parents as well - bug minor

Contribution

Feel free to create a PRs.

Tests

There are several types of tests:

  • jest tests for plugins (quick)
  • jest tests that start cypress and check results (long)

To run jest test with cypress start locally:

npm run test:jest:cy

Project structure

Location description
src all library code is here
integration folder contains cypress tests for testing the library
tests folder contains jest unit tests for testing the library
reports directory that will be created after tests run with coverage info and reports
.scripts helper scripts
.github github actions workflows
.husky pre-commit hooks (install by npm run husky:install)

Folder src

Your library will contain only the code that located in this folder

Location Description
src/index.ts export anything you want to be imported on user side from your library by '' that should run in browser
src/cypress when you library contains additional commands put types for your commands inside types.ts file

When using some other libraries in yours you can import its types within cypress.ts
Note: this folder should have cypress name for easier types setup when you library is ready (this way you will not need to add your library in tsconfig.json types section)
src/plugins when you library need to handle node events (register tasks or other things on node side) you can put it all here.
Export all required methods within index.ts file.
So when using library user imports will be '<your library name>/plugins'
src/setup all functions that should be run in browser, export within index.ts
src/utils some functions that can be run on both environments - node and DOM (browser), export within index.ts

Folder integration

Location description
integration/plugins use your plugins from src here
ts-preprocessor.ts is requiered to gather coverage info
integration/support use your src/support, import it replacing src with cy-local to have correct code coverage
integration/e2e tests folder, use anything from src, import it replacing src with cy-local to have correct code coverage

Code coverage

Coverage is being gathered from cypress and from jest, after all tests finished execution with coverage.

It will be merged from both test packages.

To see individual coverage reports run:

  • npm run cov:jest html report with coverage for jest tests
  • npm run cov:cy html report with coverage for jest tests
  • npm run cov html report with combined coverage

Publishing

The package uses semantic versioning:

  • To publish version with breaking change - use PR title with '[major]'
  • To publish version with new features, no breaking changes change - use PR title with '[minor]'
  • To publish version with defect fixes/packages updates - use PR title with '[patch]'

Latest version publishing is being done after merging PR into main branch.

Scripts

  • npm run publish:patch - publish patch
  • npm run publish:minor - publish minor
  • npm run publish:major - publish major
  • npm run publish:pack - publish version specified in package.json script