Cypress module conversion and updated chalk

This commit is contained in:
Jamie Curnow
2026-01-27 08:45:23 +10:00
parent df06eb6c2f
commit 4af0a968f0
8 changed files with 62 additions and 52 deletions

View File

@@ -1,22 +0,0 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
requestTimeout: 30000,
defaultCommandTimeout: 20000,
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'multi-reporter.json'
},
video: true,
videosFolder: 'results/videos',
screenshotsFolder: 'results/screenshots',
e2e: {
setupNodeEvents(on, config) {
return require("../plugins/index.js")(on, config);
},
env: {
swaggerBase: '{{baseUrl}}/api/schema?ts=' + Date.now(),
},
baseUrl: 'http://fullstack:81',
}
});

View File

@@ -0,0 +1,23 @@
import { defineConfig } from 'cypress';
import pluginSetup from '../plugins/index.mjs';
export default defineConfig({
requestTimeout: 30000,
defaultCommandTimeout: 20000,
reporter: "cypress-multi-reporters",
reporterOptions: {
configFile: "multi-reporter.json"
},
video: true,
videosFolder: "results/videos",
screenshotsFolder: "results/screenshots",
e2e: {
setupNodeEvents(on, config) {
return pluginSetup(on, config);
},
env: {
swaggerBase: `{{baseUrl}}/api/schema?ts=${Date.now()}`,
},
baseUrl: "http://fullstack:81",
}
});

View File

@@ -1,22 +0,0 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
requestTimeout: 30000,
defaultCommandTimeout: 20000,
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'multi-reporter.json'
},
video: true,
videosFolder: 'results/videos',
screenshotsFolder: 'results/screenshots',
e2e: {
setupNodeEvents(on, config) {
return require("../plugins/index.js")(on, config);
},
env: {
swaggerBase: '{{baseUrl}}/api/schema?ts=' + Date.now(),
},
baseUrl: 'http://127.0.0.1:3081',
}
});

View File

@@ -0,0 +1,23 @@
import { defineConfig } from 'cypress';
import pluginSetup from '../plugins/index.mjs';
export default defineConfig({
requestTimeout: 30000,
defaultCommandTimeout: 20000,
reporter: "cypress-multi-reporters",
reporterOptions: {
configFile: "multi-reporter.json"
},
video: true,
videosFolder: "results/videos",
screenshotsFolder: "results/screenshots",
e2e: {
setupNodeEvents(on, config) {
return pluginSetup(on, config);
},
env: {
swaggerBase: `{{baseUrl}}/api/schema?ts=${Date.now()}`,
},
baseUrl: "http://127.0.0.1:3081",
}
});

View File

@@ -1,7 +1,7 @@
const { SwaggerValidation } = require('@jc21/cypress-swagger-validation'); import { SwaggerValidation } from '@jc21/cypress-swagger-validation';
const chalk = require('chalk'); import chalk from 'chalk';
module.exports = (on, config) => { export default (on, config) => {
// Replace swaggerBase config var wildcard // Replace swaggerBase config var wildcard
if (typeof config.env.swaggerBase !== 'undefined') { if (typeof config.env.swaggerBase !== 'undefined') {
config.env.swaggerBase = config.env.swaggerBase.replace('{{baseUrl}}', config.baseUrl); config.env.swaggerBase = config.env.swaggerBase.replace('{{baseUrl}}', config.baseUrl);

View File

@@ -1,6 +1,9 @@
{ {
"include": [ "include": [
"./node_modules/cypress", "./node_modules/cypress",
"cypress/**/*.js" "cypress/**/*.js",
"cypress/config/dev.mjs",
"cypress/config/ci.mjs",
"cypress/plugins/index.mjs"
] ]
} }

View File

@@ -7,7 +7,7 @@
"@jc21/cypress-swagger-validation": "^0.3.2", "@jc21/cypress-swagger-validation": "^0.3.2",
"@quobix/vacuum": "^0.19.4", "@quobix/vacuum": "^0.19.4",
"axios": "^1.13.1", "axios": "^1.13.1",
"chalk": "^4.1.0", "chalk": "^5.6.2",
"cypress": "^15.9.0", "cypress": "^15.9.0",
"cypress-multi-reporters": "^2.0.5", "cypress-multi-reporters": "^2.0.5",
"cypress-wait-until": "^3.0.2", "cypress-wait-until": "^3.0.2",
@@ -21,9 +21,9 @@
"mocha-junit-reporter": "^2.2.1" "mocha-junit-reporter": "^2.2.1"
}, },
"scripts": { "scripts": {
"cypress": "HTTP_PROXY=127.0.0.1:8128 HTTPS_PROXY=127.0.0.1:8128 cypress open --config-file=cypress/config/ci.js", "cypress": "HTTP_PROXY=127.0.0.1:8128 HTTPS_PROXY=127.0.0.1:8128 cypress open --config-file=cypress/config/ci.mjs",
"cypress:headless": "HTTP_PROXY=127.0.0.1:8128 HTTPS_PROXY=127.0.0.1:8128 cypress run --config-file=cypress/config/ci.js", "cypress:headless": "HTTP_PROXY=127.0.0.1:8128 HTTPS_PROXY=127.0.0.1:8128 cypress run --config-file=cypress/config/ci.mjs",
"cypress:dev": "cypress run --config-file=cypress/config/dev.js", "cypress:dev": "cypress run --config-file=cypress/config/dev.mjs",
"swagger-lint": "vacuum lint -b -q -d -a --no-clip -n=warn" "swagger-lint": "vacuum lint -b -q -d -a --no-clip -n=warn"
}, },
"author": "", "author": "",

View File

@@ -552,6 +552,11 @@ chalk@^4.0.0, chalk@^4.1.0:
ansi-styles "^4.1.0" ansi-styles "^4.1.0"
supports-color "^7.1.0" supports-color "^7.1.0"
chalk@^5.6.2:
version "5.6.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.6.2.tgz#b1238b6e23ea337af71c7f8a295db5af0c158aea"
integrity sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==
charenc@0.0.2: charenc@0.0.2:
version "0.0.2" version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"