From ea6e5361becec5902528926345b54c3187c3d709 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 16 Feb 2026 11:09:41 -0800 Subject: [PATCH] 4643 --- e2e/cypress.json | 28 ++----- e2e/local-run.bat | 3 + e2e/plugins/index.js | 81 +++++++++++++++++++ e2e/remote-run.bat | 3 + .../0-setup/000-generate-test-db.cy.js | 21 +++++ 5 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 e2e/local-run.bat create mode 100644 e2e/plugins/index.js create mode 100644 e2e/remote-run.bat diff --git a/e2e/cypress.json b/e2e/cypress.json index a588401..551db52 100644 --- a/e2e/cypress.json +++ b/e2e/cypress.json @@ -5,27 +5,15 @@ "integrationFolder": "tests/regression", "testFiles": "**/*.cy.{js,jsx,ts,tsx}", "supportFile": "support/e2e.js", + "pluginsFile": "plugins/index.js", "env": { "apiBaseUrl": "http://localhost:7575/api/v8.0/", - "admin": { - "login": "superuser", - "password": "l3tm3in" - }, - "accounting": { - "login": "Accounting", - "password": "Accounting" - }, - "service": { - "login": "Service", - "password": "Service" - }, - "customer": { - "login": "Customer", - "password": "Customer" - }, - "bizadmin": { - "login": "BizAdmin", - "password": "BizAdmin" - } + "REMOTE_BASE_URL": "https://devtest.onayanova.com/", + "REMOTE_API_URL": "https://devtest.onayanova.com/api/v8.0/", + "admin": { "login": "superuser", "password": "l3tm3in" }, + "accounting": { "login": "Accounting", "password": "Accounting" }, + "service": { "login": "Service", "password": "Service" }, + "customer": { "login": "Customer", "password": "Customer" }, + "bizadmin": { "login": "BizAdmin", "password": "BizAdmin" } } } \ No newline at end of file diff --git a/e2e/local-run.bat b/e2e/local-run.bat new file mode 100644 index 0000000..9275e74 --- /dev/null +++ b/e2e/local-run.bat @@ -0,0 +1,3 @@ +./node_modules/.bin/cypress run --browser chrome --config baseUrl=http://localhost:8080 --env apiBaseUrl=http://localhost:7575/api/v8.0/ +rem ./node_modules/.bin/cypress run --browser firefox --spec .\tests\regression\*.js --no-exit +rem ./node_modules/.bin/cypress run --browser chrome --no-exit diff --git a/e2e/plugins/index.js b/e2e/plugins/index.js new file mode 100644 index 0000000..54894b1 --- /dev/null +++ b/e2e/plugins/index.js @@ -0,0 +1,81 @@ +//my sample users use obvious passwords "service/service", "accounting/accounting" triggering annoying your password is used in a hack warning in chrome +//sample users are inteded to be this easy to guess for testing and trial evaluation purposes so not changing it +// /** +// * @type {Cypress.PluginConfig} +// */ +// module.exports = (on, config) => { +// on('before:browser:launch', (browser = {}, launchOptions) => { +// // Check if we are using Chrome or a Chromium-based browser +// if (browser.family === 'chromium' && browser.name !== 'electron') { + +// // 1. Disable the specific password leak detection feature +// launchOptions.args.push('--disable-features=PasswordLeakDetection'); + +// // 2. Disable the "Save Password" and "Check Passwords" prompts +// launchOptions.preferences.default['credentials_enable_service'] = false; +// launchOptions.preferences.default['profile.password_manager_enabled'] = false; + +// // 3. Specifically target the leak detection toggle in preferences +// launchOptions.preferences.default['profile.password_manager_leak_detection'] = false; + +// return launchOptions; +// } +// }); +// }; + + + + +// module.exports = (on, config) => { +// on('before:browser:launch', (browser, launchOptions) => { +// if (browser.name === 'chrome') { +// launchOptions.args.push( +// '--disable-features=PasswordLeakDetection,PasswordManagerLeakDetection,PasswordCheck,InsecureCredentialsWarning' +// ); +// } +// return launchOptions; +// }); +// }; + + + +// /// +// // *********************************************************** +// // This example plugins/index.js can be used to load plugins +// // +// // You can change the location of this file or turn off loading +// // the plugins file with the 'pluginsFile' configuration option. +// // +// // You can read more here: +// // https://on.cypress.io/plugins-guide +// // *********************************************************** + +// // This function is called when a project is opened or re-opened (e.g. due to +// // the project's config changing) + +// /** +// * @type {Cypress.PluginConfig} +// */ +// // eslint-disable-next-line no-unused-vars +// module.exports = (on, config) => { +// // `on` is used to hook into various events Cypress emits +// // `config` is the resolved Cypress config +// } +module.exports = (on, config) => { + on('before:browser:launch', (browser, launchOptions) => { + if (browser.name === 'chrome') { + launchOptions.args.push('--disable-gpu') + launchOptions.args.push('--no-sandbox') + launchOptions.args.push('--disable-dev-shm-usage') + } + return launchOptions + }) + + // If a TARGET_ENV env var was passed, override baseUrl and apiBaseUrl + if (config.env.TARGET_ENV === 'remote') { + config.baseUrl = config.env.REMOTE_BASE_URL + config.env.apiBaseUrl = config.env.REMOTE_API_URL + } + + return config // <-- critical, must return config +} \ No newline at end of file diff --git a/e2e/remote-run.bat b/e2e/remote-run.bat new file mode 100644 index 0000000..a16b58f --- /dev/null +++ b/e2e/remote-run.bat @@ -0,0 +1,3 @@ +./node_modules/.bin/cypress run --browser chrome --config baseUrl=https://devtest.onayanova.com/ --env TARGET_ENV=remote +rem ./node_modules/.bin/cypress run --browser firefox --spec .\tests\regression\*.js --no-exit +rem ./node_modules/.bin/cypress run --browser chrome --no-exit diff --git a/e2e/tests/regression/0-setup/000-generate-test-db.cy.js b/e2e/tests/regression/0-setup/000-generate-test-db.cy.js index 70f53d5..a62347f 100644 --- a/e2e/tests/regression/0-setup/000-generate-test-db.cy.js +++ b/e2e/tests/regression/0-setup/000-generate-test-db.cy.js @@ -1,6 +1,27 @@ // Basic smoke test, visit every form to ensure they load describe("SMOKE SETUP", () => { + + before(() => { + cy.request({ + url: `${Cypress.env("apiBaseUrl")}version`, + method: "GET" + }).then((resp) => { + const serverVersion = resp.body.data.version + if (serverVersion !== "8.0.0") { + Cypress.env("ABORT_RUN", true) + throw new Error(`Version mismatch: expected 8.0.0 but got ${serverVersion}`) + } + }) + }) + + after(() => { + if (Cypress.env("ABORT_RUN")) { + Cypress.runner.stop() + } + }) + + it("Generates test data without issue", () => { cy.request({ url: `${Cypress.env("apiBaseUrl")}auth`,