Skip to content

Effortlessly create template files that are interlinked automatically, for Cypress

Notifications You must be signed in to change notification settings

teckmk/cypress-testcases-files-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

cygen is a node.js CLI tool that creates template files, in their respective folders, with boilerplate code and file extension.

To install the CLI:

# 1. Clone this repo
git clone https://github.com/Abdullah-yasir/cypress-testcases-files-gen.git

# 2. `cd` to clonned project directory
cd cypress-testcases-files-gen

# 3. Install the dependencies
npm install

#4. Install the tool globally in your system
npm install . -g

Creating Test Case Template

Syntax

cygen <testCaseName> [fixture]

For example if you want to create files for XYZ-123_SomeTestCase test case
Run

cygen XYZ-123_SomeTestCase

Note that we've given no file extension above.

Running above command will ask you to:

  1. Select the folder to put test case in ( if e2e dir contains directories ).
  2. Enter description of the test case.

After hitting enter it creates two files:

  • cypress/e2e/TestCases/<folder>/XYZ-123_SomeTestCase.cy.js
  • cypress/support/TestCases/<folder>/XYZ-123_SomeTestCase.js

ℹ️ If files exist already, it will skip those and won't overwrite them.

If fixture file is also needed, pass --fixture flag at the end. i.e.

Run

cygen XYZ-123_SomeTestCase --fixture

Now above command creates three files:

  • cypress/e2e/TestCases/<folder>/XYZ-123_SomeTestCase.cy.js
  • cypress/support/TestCases/<folder>/XYZ-123_SomeTestCase.js
  • cypress/fixtures/<folder>/XYZ-123_SomeTestCase.json

To show help

cygen help

About

Effortlessly create template files that are interlinked automatically, for Cypress

Resources

Stars

Watchers

Forks

Packages

No packages published