Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STCOM-1380 Replace karma test suite with cypress #2386

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
jest-enabled: false
bigtest-enabled: true
bigtest-test-command: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS --karma.singleRun --karma.browsers ChromeDocker --karma.reporters mocha junit --coverage
bigtest-test-command: yarn test $YARN_TEST_OPTIONS
sonar-sources: ./hooks,./lib,./util
generate-module-descriptor: false
publish-module-descriptor: false
Expand Down
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>
27 changes: 27 additions & 0 deletions cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ***********************************************************
// 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 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 />)
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion hooks/tests/useClickOutside-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const UseClickOutsideInteractor = interactor(class UseClickOutsideInteractor {
clickInsideElement = clickable('#click-inside-element');
});

describe('useClickOutside', () => {
describe.skip('useClickOutside', () => {
const useClickOutsideInteractor = new UseClickOutsideInteractor();
const onClickSpy = sinon.spy();

Expand Down
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 --cypress.install",
"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
71 changes: 48 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,21 @@
lazy-ass "1.6.0"
ramda "0.26.1"

"@cypress/code-coverage@^3.13.6":
version "3.13.9"
resolved "https://registry.yarnpkg.com/@cypress/code-coverage/-/code-coverage-3.13.9.tgz#d49f162dcbdba0933d466dd28c3348babe010172"
integrity sha512-VnsBLmhRLE3xgeX5hdN7aWCU3l8UHttUCMO7b+2OrRvs+R3kpBwjejfSC0/H7ErXz5o6r99biClIaS5bqo60uQ==
dependencies:
"@cypress/webpack-preprocessor" "^6.0.0"
chalk "4.1.2"
dayjs "1.11.13"
debug "4.3.7"
execa "4.1.0"
globby "11.1.0"
istanbul-lib-coverage "^3.0.0"
js-yaml "4.1.0"
nyc "15.1.0"

"@cypress/grep@^4.0.1":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@cypress/grep/-/grep-4.1.0.tgz#77dba973f0023ce01f5d2481a257f3e55c8f73ee"
Expand Down Expand Up @@ -1638,6 +1653,15 @@
debug "^4.3.4"
lodash "^4.17.20"

"@cypress/webpack-preprocessor@^6.0.0":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-6.0.2.tgz#58a96aa4dbff7433dd37d24ed47e413aa3d3fabb"
integrity sha512-0+1+4iy4W9PE6R5ywBNKAZoFp8Sf//w3UJ+CKTqkcAjA29b+dtsD0iFT70DsYE0BMqUM1PO7HXFGbXllQ+bRAA==
dependencies:
bluebird "3.7.1"
debug "^4.3.4"
lodash "^4.17.20"

"@cypress/xvfb@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a"
Expand Down Expand Up @@ -2269,18 +2293,19 @@
eslint-plugin-testing-library "^5.6.0"
webpack "^5.80.0"

"@folio/stripes-cli@^3.0.0":
version "3.2.1090000005"
resolved "https://repository.folio.org/repository/npm-folioci/@folio/stripes-cli/-/stripes-cli-3.2.1090000005.tgz#7664cca15526fd28f7d273b89f0c9f20441f57a6"
integrity sha512-amdCqV2Ddv8nRf4eBLbDAS1dq3E1W+ii5jpAg9m98cfQBNoZojyzTiaQAaEJ5bkGER0SPLQFyD9I+MNtnB2XIg==
"@folio/stripes-cli@https://github.com/folio-org/stripes-cli.git#STCLI-255":
version "3.2.0"
resolved "https://github.com/folio-org/stripes-cli.git#127c779a9bb1e6e24d745375027974aa1b609508"
dependencies:
"@cypress/code-coverage" "^3.13.6"
"@folio/stripes-testing" "^3.0.0"
"@folio/stripes-webpack" "^5.0.0"
"@formatjs/cli" "^6.1.3"
"@formatjs/cli-lib" "^6.1.3"
"@octokit/rest" "^19.0.7"
babel-plugin-istanbul "^6.0.0"
configstore "^3.1.1"
cypress "12.0.0"
debug "^4.0.1"
express "^4.17.1"
fast-glob "^3.3.1"
Expand Down Expand Up @@ -6731,6 +6756,14 @@ chai@^4.1.2:
pathval "^1.1.1"
type-detect "^4.1.0"

[email protected], chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

[email protected], chalk@^5.0.1, chalk@^5.1.2, chalk@^5.2.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
Expand All @@ -6745,14 +6778,6 @@ chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

change-case@^4.1.1:
version "4.1.2"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-4.1.2.tgz#fedfc5f136045e2398c0410ee441f95704641e12"
Expand Down Expand Up @@ -7764,7 +7789,7 @@ date-format@^4.0.14:
resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.14.tgz#7a8e584434fb169a521c8b7aa481f355810d9400"
integrity sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==

dayjs@^1.10.4, dayjs@^1.11.10:
dayjs@1.11.13, dayjs@^1.10.4, dayjs@^1.11.10:
version "1.11.13"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c"
integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==
Expand All @@ -7781,7 +7806,7 @@ [email protected], debug@^2.2.0, debug@^2.6.9:
dependencies:
ms "2.0.0"

debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@~4.3.1, debug@~4.3.2, debug@~4.3.4:
debug@4, debug@4.3.7, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4, debug@^4.3.5, debug@^4.3.6, debug@~4.3.1, debug@~4.3.2, debug@~4.3.4:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
Expand Down Expand Up @@ -10370,7 +10395,7 @@ globalthis@^1.0.3:
define-properties "^1.2.1"
gopd "^1.0.1"

globby@^11, globby@^11.0.1, globby@^11.0.2, globby@^11.0.4, globby@^11.1.0:
globby@11.1.0, globby@^11, globby@^11.0.1, globby@^11.0.2, globby@^11.0.4, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
Expand Down Expand Up @@ -11699,6 +11724,13 @@ [email protected]:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

[email protected], js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"

js-yaml@^3.13.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
Expand All @@ -11707,13 +11739,6 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -13568,7 +13593,7 @@ nub@~0.0.0:
resolved "https://registry.yarnpkg.com/nub/-/nub-0.0.0.tgz#b369bd32bdde66af59605c3b0520bc219dccc04f"
integrity sha512-dK0Ss9C34R/vV0FfYJXuqDAqHlaW9fvWVufq9MmGF2umCuDbd5GRfRD9fpi/LiM0l4ZXf8IBB+RYmZExqCrf0w==

nyc@^15.1.0:
nyc@15.1.0, nyc@^15.1.0:
version "15.1.0"
resolved "https://registry.yarnpkg.com/nyc/-/nyc-15.1.0.tgz#1335dae12ddc87b6e249d5a1994ca4bdaea75f02"
integrity sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==
Expand Down
Loading