mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
server-side. Generic and reusable by the next suite: setup_testinstance.php (--setup/--verify, delegating the rebuild to paolos db_setup.sh), tasks/db.js, tasks/sshTunnel.js, tools/dbCheck.js and cypress.config.js carry no suite-specific knowledge. A suite adds tools/checks/<name>.js, suites/<name>.js and its own task file. Fixture state resets over a direct Postgres connection through an SSH tunnel the runner opens itself. Tests: 37 passing, 5 pending, 1 failing. Pending are opt-in (Freigabe sends real mail; the Frist config is off). The failing spec is left red on purpose: it documents that getLvGesamtNoten filters freigabedatum < NOW(), so the read path hides un-freigegebene notes while the write path uses the unfiltered getter. Not really certain if that is a feature or a bug; Working on more actual testsuites now that the setup is running as intended;
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
const { defineConfig } = require("cypress");
|
|
|
|
require("dotenv").config({ path: "tests/cypress/.env" });
|
|
|
|
// The suite being run: its cy.task handlers and its Cypress.env() values.
|
|
const suite = require("./tests/cypress/suites/noten");
|
|
|
|
module.exports = defineConfig({
|
|
// Cypress 15 deprecates Cypress.env() inside cy.request options, which the API helpers use.
|
|
allowCypressEnv: true,
|
|
|
|
// The suite lives under tests/cypress, so every default folder has to be pointed there.
|
|
fixturesFolder: "tests/cypress/fixtures",
|
|
screenshotsFolder: "tests/cypress/screenshots",
|
|
videosFolder: "tests/cypress/videos",
|
|
downloadsFolder: "tests/cypress/downloads",
|
|
|
|
e2e: {
|
|
baseUrl: process.env.BASE_URL,
|
|
specPattern: "tests/cypress/e2e/**/*.cy.{js,jsx,ts,tsx}",
|
|
supportFile: "tests/cypress/support/e2e.js",
|
|
defaultCommandTimeout: 20000,
|
|
pageLoadTimeout: 20000,
|
|
retries: { runMode: 0, openMode: 0 },
|
|
|
|
setupNodeEvents(on, config) {
|
|
// No defaults anywhere: an empty .env fails the run instead of hitting someone else's instance.
|
|
const missing = ["BASE_URL", "USER_NAME", "USER_PASSWORD"].filter((key) => !process.env[key]);
|
|
if (missing.length) throw new Error(`Missing in tests/cypress/.env: ${missing.join(", ")}`);
|
|
|
|
suite.registerTasks(on);
|
|
|
|
// otherwise the SSH forward outlives Cypress
|
|
on("after:run", () => require("./tests/cypress/tasks/sshTunnel").closeTunnel());
|
|
|
|
return config;
|
|
},
|
|
},
|
|
|
|
env: {
|
|
// HTTP Basic + LDAP user the API calls authenticate as.
|
|
adminusername: process.env.USER_NAME,
|
|
adminpassword: process.env.USER_PASSWORD,
|
|
|
|
...suite.env,
|
|
},
|
|
});
|