Cypress

Cypress is a next generation front end testing tool built for the modern web. We address the key pain points developers and QA engineers face when testing modern applications.[RefCypress]_

[RefCypress]

from [cypress.io](https://docs.cypress.io/guides/overview/why-cypress)

Install

npm install cypress --save-dev

Usage

Start application

npx cypress open

Let cypress add files to project. After the files/folders are created, go to <your_project>/cypress/e2e/ and create a test file for you application <test-name>.cy.ts alternatively click the Create new spec in the cypress application.

In the file write your test, for Example:

describe('template spec', () => {
   it('Home | Assert Menu', () => {
      cy.viewport(1920, 1080)
      cy.visit('localhost:8002')
      cy.get('[data-test="navbar-split"]')
      .should("exist")
      .contains("Simple Split")
   })
})

Interact with FileSystem

Edit <your_project>/cypress.config.js

const fs = require('fs')
module.exports = ({
// setupNodeEvents can be defined in either
// the e2e or component configuration
e2e: {
    setupNodeEvents (on, config) {
    on('task', {
        rmFile (filePath) {
        return new Promise((resolve, reject) => {
            fs.unlink(filePath, (err, files) => {
            if (err) {
              return reject(err)
            }
            resolve(filePath)
            })
        })
        }
    })
    }
}
})

Now you can use the following command to remove a file:

cy.task('rmFile', <path_to_your_file>)