Skip to content

Commit

Permalink
replace karma test suite with cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Nov 8, 2024
1 parent 7c85472 commit 496df0d
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ artifacts
/storybook-static/
.vscode
.idea
/cypress/screenshots/
3 changes: 3 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { getBaseCypressConfig } = require('@folio/stripes-cli');

module.exports = getBaseCypressConfig();
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
12 changes: 12 additions & 0 deletions cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
30 changes: 30 additions & 0 deletions cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ***********************************************************
// This example support/component.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import '@cypress/code-coverage/support';

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react18'

Cypress.Commands.add('mount', mount)

// Example use:
// cy.mount(<MyComponent />)


6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"storybook": "storybook dev -p 9001 -c .storybook",
"storybook-build": "storybook build -c .storybook -o .out",
"stylelint": "stylelint \"lib/**/*.css\"",
"test": "stripes test karma",
"test-dev": "stripes test karma --watch"
"test": "stripes test cypress",
"test-dev": "stripes test cypress --cypress.open"
},
"engines": {
"node": ">=10.0.0"
Expand Down Expand Up @@ -53,7 +53,7 @@
"@bigtest/interactor": "0.7.2",
"@csstools/postcss-relative-color-syntax": "^2.0.7",
"@folio/eslint-config-stripes": "^7.0.0",
"@folio/stripes-cli": "^3.0.0",
"@folio/stripes-cli": "https://github.com/folio-org/stripes-cli.git#STCLI-255",
"@folio/stripes-testing": "^4.7.0",
"@formatjs/cli": "^6.1.3",
"@storybook/addon-actions": "^7.6.12",
Expand Down

0 comments on commit 496df0d

Please sign in to comment.