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 */
const { defineConfig } = require('cypress');
const { rm } = require('fs/promises')
const { defineConfig } = require("cypress");
const { rm } = require("fs/promises");
// 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
const deleteVideosOnSuccess = (on) => {
const filesToDelete = []
on('after:spec', (_spec, results) => {
const filesToDelete = [];
on("after:spec", (_spec, results) => {
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) {
console.log(
'after:run hook: Deleting %d video(s) from successful specs',
"after:run hook: Deleting %d video(s) from successful specs",
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) {
spiffWorkflowFrontendUrl = process.env.SPIFFWORKFLOW_FRONTEND_URL
spiffWorkflowFrontendUrl = process.env.SPIFFWORKFLOW_FRONTEND_URL;
}
const cypressConfig = {
projectId: 'crax1q',
projectId: "crax1q",
defaultCommandTimeout: 20000,
videoUploadOnPasses: false,
chromeWebSecurity: false,
e2e: {
baseUrl: spiffWorkflowFrontendUrl,
setupNodeEvents(on, config) {
deleteVideosOnSuccess(on)
require('@cypress/grep/src/plugin')(config);
deleteVideosOnSuccess(on);
require("@cypress/grep/src/plugin")(config);
return config;
},
},
@ -48,11 +50,11 @@ const cypressConfig = {
// https://github.com/cypress-io/cypress/issues/2353
// https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Scrolling
scrollBehavior: "center",
}
};
if (!process.env.CYPRESS_RECORD_KEY) {
// since it's slow
cypressConfig.videoCompression = false
cypressConfig.videoCompression = false;
}
module.exports = defineConfig(cypressConfig)

View File

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

View File

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

View File

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

View File

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