cypress-csv2html-plugin
v2.0.3
Published
A simple plugin to generate HTML table from CSV file by using cy.csv2html('/fixtures/yourfile.csv'), all the data is randomly generated
Downloads
498
Maintainers
Readme
A simple plugin to wrap a CSV file into HTML, this plugin also generates a data-test
Installation
npm i -D cypress-csv2html-plugin
# or
yarn add -D cypress-csv2html-plugin
# or
pnpm add cypress-csv2html-plugin
# or
bun add -D cypress-csv2html-plugin
How To Use
Import into e2e.js
import { csv2html } from "cypress-csv2html-plugin";
csv2html();
Then use the custom command cy.csv2html
cy.csv2html('cypress/fixtures/example.csv')
You can use data-test for your tests
cy.get('[data-test="csv-table-container"]') // Check the table values
cy.get('[data-test="csv-table-header"]').contains('First Name') // Check the header values
cy.get('[data-test="csv-table-cell"]').contains('Linda') // Check the cell value
Types
To get IntelliSense working with the default custom command cy.csv2html
include in your specs
/// <reference types="cypress-csv2html-plugin" />
Small print
Author: Nikita Polyakov
License: MIT
Support: if you find any problems with this module, email / tweet / open issue on Github