Compare commits

...
Author SHA1 Message Date
dc 180ca89e5a fix(cypress): apply the licence key when the estate has none
Build / Build-and-ng-test (pull_request) Successful in 5m3s
Lighthouse Checks / lighthouse (pull_request) Successful in 19m53s
Build / Build-and-test-development (pull_request) Successful in 32m32s
loginAndUpdateValidKey decided whether a key was already working by looking
for the nav tree, and looked for it in the body captured before login.  A free
tier estate renders the tree as well, so on an unlicensed estate the command
took the 'already licensed' branch every time and never applied a key.  Every
upload spec then lost its feature set: onShowUploadModal shows the locked
feature dialog instead of the panel, so input#file-upload never renders.

The loaded page is read again after login, the licence banner decides whether
a key is needed, and an estate with no key is left untouched unless the caller
asked for one - the free tier specs are written against that state.

Measured on an unlicensed mock estate: excel.cy.ts 24 failing in 14m 1s before,
24 passing in 5m 44s after; csv.cy.ts 1 failing before, 1 passing after.
2026-10-25 19:17:42 +00:00
+36 -22
View File
@@ -79,14 +79,34 @@ Cypress.Commands.add(
.then(() => {
cy.wait(2000)
if ($body.find('.nav-tree').length > 0) {
/**
* A key that is already working needs no update. Ask the loaded
* page, not the tree: a free tier estate renders the nav tree as
* well, so the tree cannot tell a licensed estate from an
* unlicensed one - the licence banner is what does. Reading the
* body again here also matters on an estate that shows a login
* form, where the body captured above has no tree yet.
*/
cy.get('body').then(($loaded) => {
const licenceProblem = $loaded.find('#demo-banner').length > 0
if (!licenceProblem && $loaded.find('.nav-tree').length > 0) {
return logout(() => {
return
})
}
/**
* If licence key is already working, then skip rest of the function
* An estate with no key is left as it is unless the caller asked
* for a licensed one - the free tier specs are written against
* that state and must not have a key planted under them.
*/
return logout(() => {
return
})
} else {
if (!forceLicenceKey) {
return logout(() => {
return
})
}
const keyData = {
valid_until: moment().add(20, 'day').format('YYYY-MM-DD'),
number_of_users: 10,
@@ -106,27 +126,21 @@ Cypress.Commands.add(
cy.wait(20000)
}
if (!forceLicenceKey) {
return logout(() => {
return
})
} else {
return updateLicenseKeyQuick(keysGen, () => {
cy.wait(25000)
return acceptTermsIfPresented((result: boolean) => {
if (result) {
cy.wait(20000)
}
return logout(() => {
return
})
return updateLicenseKeyQuick(keysGen, () => {
cy.wait(25000)
return acceptTermsIfPresented((result: boolean) => {
if (result) {
cy.wait(20000)
}
return logout(() => {
return
})
})
}
})
})
}
)
}
})
})
})
}