This commit is contained in:
2026-02-16 14:39:46 -08:00
parent ea6e5361be
commit 5e04bde2f1
6 changed files with 75 additions and 102 deletions

View File

@@ -1,27 +1,46 @@
// 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}`)
url: `${Cypress.env("apiBaseUrl")}auth`,
method: "POST",
body: {
login: Cypress.env("admin").login,
password: Cypress.env("admin").password
}
})
.its("body")
.then((res) => {
cy.request({
method: "GET",
url: `${Cypress.env("apiBaseUrl")}server-info`,
auth: { bearer: res.data.token }
}).then((resp) => {
const raw = resp.body.data.serverVersion
const match = raw.match(/(\d+\.\d+\.\d+)/)
if (!match) {
cy.task('setAbortFlag').then(() => {
throw new Error(`Could not parse version from: "${raw}"`)
})
return // prevent further execution
}
const version = match[1]
const expected = Cypress.env("expectedServerVersion")
if (version !== expected) {
cy.task('setAbortFlag').then(() => {
throw new Error(`❌ Version mismatch: server is ${version}, expected ${expected}. ABORTING ALL TESTS.`)
})
return // prevent further execution
}
cy.log(`✓ Server version confirmed: ${version}`)
})
})
})
after(() => {
if (Cypress.env("ABORT_RUN")) {
Cypress.runner.stop()
}
})
it("Generates test data without issue", () => {
cy.request({
url: `${Cypress.env("apiBaseUrl")}auth`,
@@ -32,7 +51,7 @@ describe("SMOKE SETUP", () => {
}
})
.its("body")
.then((res) => {
.then(res => {
cy.request({
method: "POST",
url: `${Cypress.env("apiBaseUrl")}license/permanently-erase-all-data`,
@@ -57,7 +76,7 @@ describe("SMOKE SETUP", () => {
}
})
.its("body")
.then((resjob) => {
.then(resjob => {
cy.log(`resjob is: ${JSON.stringify(resjob)}`);
// expect(resjob.body).to.have.property('jobId');
confirmJobDone(resjob.jobId, res.data.token);
@@ -74,7 +93,7 @@ function confirmJobDone(jobId, authToken) {
auth: {
bearer: authToken
}
}).then((resp) => {
}).then(resp => {
//3 means job done
if (resp.body.data == 3) return;
// else recurse
@@ -83,8 +102,6 @@ function confirmJobDone(jobId, authToken) {
});
}
//===============================================
// describe("SMOKE SETUP", () => {
// it("Generates test data without issue", () => {