From 81d83adab46f68da190a925216fac93de9426996 Mon Sep 17 00:00:00 2001 From: James Talton Date: Thu, 19 Jan 2023 15:51:33 -0500 Subject: [PATCH] cypress unit testing additions (#181) Signed-off-by: James Talton Signed-off-by: James Talton --- cypress.config.ts | 6 +++++- cypress/support/component.ts | 2 ++ .../views/jobs/hooks/useJobFilters.cy.tsx | 1 - package-lock.json | 14 +++++++------- package.json | 3 +++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cypress.config.ts b/cypress.config.ts index f8c846d4b2..7704214fc0 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -16,7 +16,6 @@ export default defineConfig({ }, baseUrl: 'https://localhost:3002/', }, - component: { setupNodeEvents(on, config) { // implement node event listeners here @@ -61,6 +60,11 @@ export default defineConfig({ }, }, }, + env: { + 'cypress-react-selector': { + root: '#__cy_root', + }, + }, specPattern: 'frontend/controller/**/*.cy.tsx', supportFile: 'cypress/support/component.ts', }, diff --git a/cypress/support/component.ts b/cypress/support/component.ts index dca0fb2d7e..878dffee9c 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -14,6 +14,8 @@ // https://on.cypress.io/configuration // *********************************************************** +import 'cypress-react-selector'; + // Import commands.js using ES2015 syntax: import './commands'; diff --git a/frontend/controller/views/jobs/hooks/useJobFilters.cy.tsx b/frontend/controller/views/jobs/hooks/useJobFilters.cy.tsx index 4eac751202..976067dd7b 100644 --- a/frontend/controller/views/jobs/hooks/useJobFilters.cy.tsx +++ b/frontend/controller/views/jobs/hooks/useJobFilters.cy.tsx @@ -1,6 +1,5 @@ import { IToolbarFilter } from '../../../../../framework'; import { useJobsFilters } from './useJobsFilters'; -import 'cypress-react-selector'; // eslint-disable-next-line @typescript-eslint/no-unused-vars function TestInner(props: { filters: IToolbarFilter[] }) { diff --git a/package-lock.json b/package-lock.json index d05228b44e..cbb488bce9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27674,9 +27674,9 @@ "dev": true }, "node_modules/resq": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/resq/-/resq-1.10.2.tgz", - "integrity": "sha512-HmgVS3j+FLrEDBTDYysPdPVF9/hioDMJ/otOiQDKqk77YfZeeLOj0qi34yObumcud1gBpk+wpBTEg4kMicD++A==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", + "integrity": "sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==", "dev": true, "dependencies": { "fast-deep-equal": "^2.0.1" @@ -45633,7 +45633,7 @@ "integrity": "sha512-AQCgwbcMDkIdYcf6knvLxqzBnejahIbJPHqUhARi8k+QbM8sgUBDds98PaHJVMdPiX2J8RJjXHmUMPD8VerPSw==", "dev": true, "requires": { - "resq": "1.10.2" + "resq": "1.11.0" } }, "d3-array": { @@ -53724,9 +53724,9 @@ "dev": true }, "resq": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/resq/-/resq-1.10.2.tgz", - "integrity": "sha512-HmgVS3j+FLrEDBTDYysPdPVF9/hioDMJ/otOiQDKqk77YfZeeLOj0qi34yObumcud1gBpk+wpBTEg4kMicD++A==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", + "integrity": "sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1" diff --git a/package.json b/package.json index ae94f6448f..a6a72c42dc 100644 --- a/package.json +++ b/package.json @@ -165,5 +165,8 @@ "../frontend/src/**/*.ts", "../frontend/src/**/*.tsx" ] + }, + "overrides": { + "resq": "^1.11.0" } }