Skip to content

Commit

Permalink
Merge pull request #2962 from christianvogt/cypress-results-dir
Browse files Browse the repository at this point in the history
env var for cypress results dir
  • Loading branch information
openshift-merge-bot[bot] authored Jul 3, 2024
2 parents cdf0d85 + b4c66b2 commit bd03740
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"coverage:merge": "rimraf coverage && istanbul-merge --out coverage/coverage-final.json jest-coverage/coverage-final.json src/__tests__/cypress/coverage/coverage-final.json && nyc report --reporter html -t coverage --report-dir coverage/report && nyc report --reporter json-summary -t coverage --report-dir coverage",
"cypress:open": "cypress open --project src/__tests__/cypress",
"cypress:run": "cypress run -b chrome --project src/__tests__/cypress",
"cypress:open:mock": "MOCK=1 WS_PORT=9002 npm run cypress:open -- ",
"cypress:run:mock": "MOCK=1 WS_PORT=9002 npm run cypress:run -- ",
"cypress:run:mock:coverage": "rimraf src/__tests__/cypress/coverage src/__tests__/cypress/.nyc_output && COVERAGE=true npm run cypress:run:mock",
"cypress:open:record": "RECORD=1 npm run cypress:open",
"cypress:run:record": "RECORD=1 npm run cypress:run && npm run cypress:format",
"cypress:open:mock": "CY_MOCK=1 CY_WS_PORT=9002 npm run cypress:open -- ",
"cypress:run:mock": "CY_MOCK=1 CY_WS_PORT=9002 npm run cypress:run -- ",
"cypress:run:mock:coverage": "rimraf src/__tests__/cypress/coverage src/__tests__/cypress/.nyc_output && CY_COVERAGE=true npm run cypress:run:mock",
"cypress:open:record": "CY_RECORD=1 npm run cypress:open",
"cypress:run:record": "CY_RECORD=1 npm run cypress:run && npm run cypress:format",
"cypress:server:build": "ODH_DIST_DIR=./public-cypress POLL_INTERVAL=9999999 FAST_POLL_INTERVAL=9999999 WS_HOSTNAME=localhost:9002 npm run build",
"cypress:server:build:coverage": "COVERAGE=true npm run cypress:server:build",
"cypress:server": "serve ./public-cypress -p 9001 -s -L",
Expand Down
22 changes: 12 additions & 10 deletions frontend/src/__tests__/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { interceptSnapshotFile } from '~/__tests__/cypress/cypress/utils/snapsho
import { setup as setupWebsockets } from '~/__tests__/cypress/cypress/support/websockets';

[
`.env.cypress${process.env.MOCK ? '.mock' : ''}.local`,
`.env.cypress${process.env.MOCK ? '.mock' : ''}`,
`.env.cypress${process.env.CY_MOCK ? '.mock' : ''}.local`,
`.env.cypress${process.env.CY_MOCK ? '.mock' : ''}`,
'.env.local',
'.env',
].forEach((file) =>
Expand All @@ -24,7 +24,9 @@ import { setup as setupWebsockets } from '~/__tests__/cypress/cypress/support/we
}),
);

const resultsDir = `results/${process.env.MOCK ? 'mocked' : 'e2e'}`;
const resultsDir = `${process.env.CY_RESULTS_DIR || 'results'}/${
process.env.CY_MOCK ? 'mocked' : 'e2e'
}`;

export default defineConfig({
experimentalMemoryManagement: true,
Expand Down Expand Up @@ -52,13 +54,13 @@ export default defineConfig({
screenshotsFolder: `${resultsDir}/screenshots`,
videosFolder: `${resultsDir}/videos`,
env: {
MOCK: !!process.env.MOCK,
MOCK: !!process.env.CY_MOCK,
LOGIN_USERNAME: process.env.LOGIN_USERNAME,
LOGIN_PASSWORD: process.env.LOGIN_PASSWORD,
LOGIN_PROVIDER: process.env.LOGIN_PROVIDER,
RECORD: !!process.env.RECORD,
WS_PORT: process.env.WS_PORT,
coverage: !!process.env.COVERAGE,
RECORD: !!process.env.CY_RECORD,
WS_PORT: process.env.CY_WS_PORT,
coverage: !!process.env.CY_COVERAGE,
codeCoverage: {
exclude: [path.resolve(__dirname, '../../third_party/**')],
},
Expand All @@ -68,9 +70,9 @@ export default defineConfig({
defaultCommandTimeout: 10000,
e2e: {
baseUrl: process.env.BASE_URL,
specPattern: process.env.MOCK
specPattern: process.env.CY_MOCK
? `cypress/tests/mocked/**/*.cy.ts`
: process.env.RECORD
: process.env.CY_RECORD
? `cypress/tests/mocked/**/*.scy.ts`
: `cypress/tests/e2e/**/*.cy.ts`,
experimentalInteractiveRunEvents: true,
Expand Down Expand Up @@ -108,7 +110,7 @@ export default defineConfig({
},
});

if (process.env.RECORD) {
if (process.env.CY_RECORD) {
on('before:spec', (spec) => {
// delete previous snapshots for the spec
try {
Expand Down

0 comments on commit bd03740

Please sign in to comment.