upgraded cypress and moved code in helpers to ensure we do not need app code for cypress w/ burnettk (#431)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2023-08-03 15:08:45 -04:00 committed by GitHub
parent b446aad184
commit c086817810
5 changed files with 57 additions and 55 deletions

View File

@ -1,45 +1,47 @@
/* eslint-disable */ /* eslint-disable */
const { defineConfig } = require('cypress'); const { defineConfig } = require("cypress");
const { rm } = require('fs/promises') const { rm } = require("fs/promises");
// yes use video compression in CI, where we will set the env var so we upload to cypress dashboard // yes use video compression in CI, where we will set the env var so we upload to cypress dashboard
const useVideoCompression = !!process.env.CYPRESS_RECORD_KEY const useVideoCompression = !!process.env.CYPRESS_RECORD_KEY;
// https://github.com/cypress-io/cypress/issues/2522 // https://github.com/cypress-io/cypress/issues/2522
const deleteVideosOnSuccess = (on) => { const deleteVideosOnSuccess = (on) => {
const filesToDelete = [] const filesToDelete = [];
on('after:spec', (_spec, results) => { on("after:spec", (_spec, results) => {
if (results.stats.failures === 0 && results.video) { if (results.stats.failures === 0 && results.video) {
filesToDelete.push(results.video) filesToDelete.push(results.video);
} }
}) });
on('after:run', async () => { on("after:run", async () => {
if (filesToDelete.length) { if (filesToDelete.length) {
console.log( console.log(
'after:run hook: Deleting %d video(s) from successful specs', "after:run hook: Deleting %d video(s) from successful specs",
filesToDelete.length filesToDelete.length
) );
await Promise.all(filesToDelete.map((videoFile) => rm(videoFile))) await Promise.all(filesToDelete.map((videoFile) => rm(videoFile)));
} }
}) });
} };
let spiffWorkflowFrontendUrl = `http://localhost:${process.env.SPIFFWORKFLOW_FRONTEND_PORT || 7001}` let spiffWorkflowFrontendUrl = `http://localhost:${
process.env.SPIFFWORKFLOW_FRONTEND_PORT || 7001
}`;
if (process.env.SPIFFWORKFLOW_FRONTEND_URL) { if (process.env.SPIFFWORKFLOW_FRONTEND_URL) {
spiffWorkflowFrontendUrl = process.env.SPIFFWORKFLOW_FRONTEND_URL spiffWorkflowFrontendUrl = process.env.SPIFFWORKFLOW_FRONTEND_URL;
} }
const cypressConfig = { const cypressConfig = {
projectId: 'crax1q', projectId: "crax1q",
defaultCommandTimeout: 20000, defaultCommandTimeout: 20000,
videoUploadOnPasses: false, videoUploadOnPasses: false,
chromeWebSecurity: false, chromeWebSecurity: false,
e2e: { e2e: {
baseUrl: spiffWorkflowFrontendUrl, baseUrl: spiffWorkflowFrontendUrl,
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
deleteVideosOnSuccess(on) deleteVideosOnSuccess(on);
require('@cypress/grep/src/plugin')(config); require("@cypress/grep/src/plugin")(config);
return config; return config;
}, },
}, },
@ -48,11 +50,11 @@ const cypressConfig = {
// https://github.com/cypress-io/cypress/issues/2353 // https://github.com/cypress-io/cypress/issues/2353
// https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Scrolling // https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Scrolling
scrollBehavior: "center", scrollBehavior: "center",
} };
if (!process.env.CYPRESS_RECORD_KEY) { if (!process.env.CYPRESS_RECORD_KEY) {
// since it's slow // since it's slow
cypressConfig.videoCompression = false cypressConfig.videoCompression = false;
} }
module.exports = defineConfig(cypressConfig) module.exports = defineConfig(cypressConfig)

View File

@ -40,7 +40,6 @@
"bpmn-js-spiffworkflow": "github:sartography/bpmn-js-spiffworkflow#main", "bpmn-js-spiffworkflow": "github:sartography/bpmn-js-spiffworkflow#main",
"cookie": "^0.5.0", "cookie": "^0.5.0",
"craco": "^0.0.3", "craco": "^0.0.3",
"cypress-slow-down": "^1.2.1",
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"diagram-js": "^11.9.1", "diagram-js": "^11.9.1",
"dmn-js": "^12.2.0", "dmn-js": "^12.2.0",
@ -71,6 +70,7 @@
"@typescript-eslint/parser": "^5.30.6", "@typescript-eslint/parser": "^5.30.6",
"cypress": "^12", "cypress": "^12",
"cypress-file-upload": "^5.0.8", "cypress-file-upload": "^5.0.8",
"cypress-slow-down": "^1.2.1",
"eslint": "^8.19.0", "eslint": "^8.19.0",
"eslint_d": "^12.2.0", "eslint_d": "^12.2.0",
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",
@ -11103,15 +11103,15 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "12.10.0", "version": "12.17.3",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.10.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.17.3.tgz",
"integrity": "sha512-Y0wPc221xKKW1/4iAFCphkrG2jNR4MjOne3iGn4mcuCaE7Y5EtXL83N8BzRsAht7GYfWVjJ/UeTqEdDKHz39HQ==", "integrity": "sha512-/R4+xdIDjUSLYkiQfwJd630S81KIgicmQOLXotFxVXkl+eTeVO+3bHXxdi5KBh/OgC33HWN33kHX+0tQR/ZWpg==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.11",
"@cypress/xvfb": "^1.2.4", "@cypress/xvfb": "^1.2.4",
"@types/node": "^14.14.31", "@types/node": "^16.18.39",
"@types/sinonjs__fake-timers": "8.1.1", "@types/sinonjs__fake-timers": "8.1.1",
"@types/sizzle": "^2.3.2", "@types/sizzle": "^2.3.2",
"arch": "^2.2.0", "arch": "^2.2.0",
@ -11146,7 +11146,7 @@
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
"request-progress": "^3.0.0", "request-progress": "^3.0.0",
"semver": "^7.3.2", "semver": "^7.5.3",
"supports-color": "^8.1.1", "supports-color": "^8.1.1",
"tmp": "~0.2.1", "tmp": "~0.2.1",
"untildify": "^4.0.0", "untildify": "^4.0.0",
@ -11174,20 +11174,22 @@
"node_modules/cypress-plugin-config": { "node_modules/cypress-plugin-config": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/cypress-plugin-config/-/cypress-plugin-config-1.2.1.tgz", "resolved": "https://registry.npmjs.org/cypress-plugin-config/-/cypress-plugin-config-1.2.1.tgz",
"integrity": "sha512-z+bQ7oyfDKun51HiCVNBOR+g38/nYRJ7zVdCZT2/9UozzE8P4iA1zF/yc85ePZLy5NOj/0atutoUPBBR5SqjSQ==" "integrity": "sha512-z+bQ7oyfDKun51HiCVNBOR+g38/nYRJ7zVdCZT2/9UozzE8P4iA1zF/yc85ePZLy5NOj/0atutoUPBBR5SqjSQ==",
"dev": true
}, },
"node_modules/cypress-slow-down": { "node_modules/cypress-slow-down": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/cypress-slow-down/-/cypress-slow-down-1.2.1.tgz", "resolved": "https://registry.npmjs.org/cypress-slow-down/-/cypress-slow-down-1.2.1.tgz",
"integrity": "sha512-Pd+nESR+Ca8I+mLGbBrPVMEFvJBWxkJcEdcIUDxSBnMoWI00hiIKxzEgVqCv5c6Oap2OPpnrPLbJBwveCNKLig==", "integrity": "sha512-Pd+nESR+Ca8I+mLGbBrPVMEFvJBWxkJcEdcIUDxSBnMoWI00hiIKxzEgVqCv5c6Oap2OPpnrPLbJBwveCNKLig==",
"dev": true,
"dependencies": { "dependencies": {
"cypress-plugin-config": "^1.0.0" "cypress-plugin-config": "^1.0.0"
} }
}, },
"node_modules/cypress/node_modules/@types/node": { "node_modules/cypress/node_modules/@types/node": {
"version": "14.18.42", "version": "16.18.39",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.39.tgz",
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg==", "integrity": "sha512-8q9ZexmdYYyc5/cfujaXb4YOucpQxAV4RMG0himLyDUOEr8Mr79VrqsFI+cQ2M2h89YIuy95lbxuYjxT4Hk4kQ==",
"dev": true "dev": true
}, },
"node_modules/cypress/node_modules/ansi-styles": { "node_modules/cypress/node_modules/ansi-styles": {
@ -11273,9 +11275,9 @@
} }
}, },
"node_modules/cypress/node_modules/semver": { "node_modules/cypress/node_modules/semver": {
"version": "7.5.0", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
@ -40425,14 +40427,14 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"cypress": { "cypress": {
"version": "12.10.0", "version": "12.17.3",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.10.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.17.3.tgz",
"integrity": "sha512-Y0wPc221xKKW1/4iAFCphkrG2jNR4MjOne3iGn4mcuCaE7Y5EtXL83N8BzRsAht7GYfWVjJ/UeTqEdDKHz39HQ==", "integrity": "sha512-/R4+xdIDjUSLYkiQfwJd630S81KIgicmQOLXotFxVXkl+eTeVO+3bHXxdi5KBh/OgC33HWN33kHX+0tQR/ZWpg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.11",
"@cypress/xvfb": "^1.2.4", "@cypress/xvfb": "^1.2.4",
"@types/node": "^14.14.31", "@types/node": "^16.18.39",
"@types/sinonjs__fake-timers": "8.1.1", "@types/sinonjs__fake-timers": "8.1.1",
"@types/sizzle": "^2.3.2", "@types/sizzle": "^2.3.2",
"arch": "^2.2.0", "arch": "^2.2.0",
@ -40467,7 +40469,7 @@
"pretty-bytes": "^5.6.0", "pretty-bytes": "^5.6.0",
"proxy-from-env": "1.0.0", "proxy-from-env": "1.0.0",
"request-progress": "^3.0.0", "request-progress": "^3.0.0",
"semver": "^7.3.2", "semver": "^7.5.3",
"supports-color": "^8.1.1", "supports-color": "^8.1.1",
"tmp": "~0.2.1", "tmp": "~0.2.1",
"untildify": "^4.0.0", "untildify": "^4.0.0",
@ -40475,9 +40477,9 @@
}, },
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "14.18.42", "version": "16.18.39",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.39.tgz",
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg==", "integrity": "sha512-8q9ZexmdYYyc5/cfujaXb4YOucpQxAV4RMG0himLyDUOEr8Mr79VrqsFI+cQ2M2h89YIuy95lbxuYjxT4Hk4kQ==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -40541,9 +40543,9 @@
} }
}, },
"semver": { "semver": {
"version": "7.5.0", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true, "dev": true,
"requires": { "requires": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
@ -40576,12 +40578,14 @@
"cypress-plugin-config": { "cypress-plugin-config": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/cypress-plugin-config/-/cypress-plugin-config-1.2.1.tgz", "resolved": "https://registry.npmjs.org/cypress-plugin-config/-/cypress-plugin-config-1.2.1.tgz",
"integrity": "sha512-z+bQ7oyfDKun51HiCVNBOR+g38/nYRJ7zVdCZT2/9UozzE8P4iA1zF/yc85ePZLy5NOj/0atutoUPBBR5SqjSQ==" "integrity": "sha512-z+bQ7oyfDKun51HiCVNBOR+g38/nYRJ7zVdCZT2/9UozzE8P4iA1zF/yc85ePZLy5NOj/0atutoUPBBR5SqjSQ==",
"dev": true
}, },
"cypress-slow-down": { "cypress-slow-down": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/cypress-slow-down/-/cypress-slow-down-1.2.1.tgz", "resolved": "https://registry.npmjs.org/cypress-slow-down/-/cypress-slow-down-1.2.1.tgz",
"integrity": "sha512-Pd+nESR+Ca8I+mLGbBrPVMEFvJBWxkJcEdcIUDxSBnMoWI00hiIKxzEgVqCv5c6Oap2OPpnrPLbJBwveCNKLig==", "integrity": "sha512-Pd+nESR+Ca8I+mLGbBrPVMEFvJBWxkJcEdcIUDxSBnMoWI00hiIKxzEgVqCv5c6Oap2OPpnrPLbJBwveCNKLig==",
"dev": true,
"requires": { "requires": {
"cypress-plugin-config": "^1.0.0" "cypress-plugin-config": "^1.0.0"
} }

View File

@ -35,7 +35,6 @@
"bpmn-js-spiffworkflow": "github:sartography/bpmn-js-spiffworkflow#main", "bpmn-js-spiffworkflow": "github:sartography/bpmn-js-spiffworkflow#main",
"cookie": "^0.5.0", "cookie": "^0.5.0",
"craco": "^0.0.3", "craco": "^0.0.3",
"cypress-slow-down": "^1.2.1",
"date-fns": "^2.28.0", "date-fns": "^2.28.0",
"diagram-js": "^11.9.1", "diagram-js": "^11.9.1",
"dmn-js": "^12.2.0", "dmn-js": "^12.2.0",
@ -99,6 +98,7 @@
"@typescript-eslint/parser": "^5.30.6", "@typescript-eslint/parser": "^5.30.6",
"cypress": "^12", "cypress": "^12",
"cypress-file-upload": "^5.0.8", "cypress-file-upload": "^5.0.8",
"cypress-slow-down": "^1.2.1",
"eslint": "^8.19.0", "eslint": "^8.19.0",
"eslint_d": "^12.2.0", "eslint_d": "^12.2.0",
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",

View File

@ -4,9 +4,6 @@ import { useSearchParams } from 'react-router-dom';
import { Pagination } from '@carbon/react'; import { Pagination } from '@carbon/react';
import { PaginationObject } from '../interfaces'; import { PaginationObject } from '../interfaces';
export const DEFAULT_PER_PAGE = 50;
export const DEFAULT_PAGE = 1;
type OwnProps = { type OwnProps = {
page: number; page: number;
perPage: number; perPage: number;

View File

@ -6,10 +6,9 @@ import {
DATE_FORMAT, DATE_FORMAT,
TIME_FORMAT_HOURS_MINUTES, TIME_FORMAT_HOURS_MINUTES,
} from './config'; } from './config';
import {
DEFAULT_PER_PAGE, export const DEFAULT_PER_PAGE = 50;
DEFAULT_PAGE, export const DEFAULT_PAGE = 1;
} from './components/PaginationForTable';
export const doNothing = () => { export const doNothing = () => {
return undefined; return undefined;