diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 000000000..97f47c412 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,9 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +}); diff --git a/cypress/e2e/spec.cy.js b/cypress/e2e/spec.cy.js new file mode 100644 index 000000000..322992ce1 --- /dev/null +++ b/cypress/e2e/spec.cy.js @@ -0,0 +1,5 @@ +describe('template spec', () => { + it('passes', () => { + cy.visit('https://example.cypress.io') + }) +}) \ No newline at end of file diff --git a/cypress/e2e/start.cy.js b/cypress/e2e/start.cy.js new file mode 100644 index 000000000..e09a12954 --- /dev/null +++ b/cypress/e2e/start.cy.js @@ -0,0 +1,6 @@ +describe('template spec', () => { + it('passes', () => { + cy.visit('http://localhost:9000') + cy.contains('Hey there,').should('be.visible'); + }) +}) \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000..66ea16ef0 --- /dev/null +++ b/cypress/support/commands.js @@ -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) => { ... }) \ No newline at end of file diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js new file mode 100644 index 000000000..0e7290a13 --- /dev/null +++ b/cypress/support/e2e.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.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 commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') \ No newline at end of file diff --git a/package.json b/package.json index c2f9c4eac..f750fbac0 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,11 @@ "devDependencies": { "@glennsl/rescript-jest": "^0.10.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", + "babel-loader": "^9.1.3", "copy-webpack-plugin": "^9.0.0", "css-loader": "^5.0.1", "css-minimizer-webpack-plugin": "^5.0.1", + "cypress": "^13.6.0", "file-loader": "^6.2.0", "husky": "^8.0.3", "jest-environment-jsdom": "^29.6.4",