Skip to content

test: create pages through addPage from @jahia/cypress - #461

Merged
jahia-carp merged 5 commits into
mainfrom
test/use-addpage-from-jahia-cypress
Sep 3, 2026
Merged

test: create pages through addPage from @jahia/cypress#461
jahia-carp merged 5 commits into
mainfrom
test/use-addpage-from-jahia-cypress

Conversation

@jahia-carp

@jahia-carp jahia-carp commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

addSimplePage in tests/cypress/support/test-helpers.ts was a local copy of a page-creation helper that six Jahia repositories each maintained separately. @jahia/cypress 8.4.0 ships addPage, so the copy is no longer needed: this helper keeps its name and signature and now delegates to it.

Why

The duplication is tracked by Jahia/jahia-private#3251. addPage was added in Jahia/jahia-cypress#245 and published in 8.4.0.

Two repositories migrated first and are merged, each returning the same test counts as its base run: Jahia/client-cache-control#83 and Jahia/site-settings-seo#376.

Changes

  • tests/cypress/support/test-helpers.ts: addSimplePage delegates to addPage instead of building the addNode mutation itself. Its signature is unchanged, so none of its eight call sites moves. addNode leaves the import, because nothing else in this file used it.
  • package.json, tests/package.json and both lockfiles: @jahia/cypress moves from ^8.0.0 to ^8.5.0.

This copy already passed children, mixins and properties straight through and added no default page structure, so the delegation is one to one. It also sent a title variable that addNode does not declare. That variable reached nothing and is gone.

The test that failed, and why the version moved to 8.5.0

The first version of this branch pinned 8.4.0, and one test failed reproducibly over three runs:

Forms - 61 Login form (footer) > shows the back-office login entry to anonymous visitors
Timed out retrying after 10000ms: Expected to find content: 'manage website'
within the element: <footer._footer_r8unl_1> and with the selector: 'h3' but never did.

The failure came from the version bump and not from the helper. A commit on this branch restored the original addNode helper while keeping 8.4.0, and the same test failed the same way. That commit was reverted.

It was reported as Jahia/jahia-cypress#251, and @x0h01 bisected it to Jahia/jahia-cypress#234, the spec marker in the Jahia log. That marker registers a root-level beforeEach, whose cy.executeGroovy call runs between the describe-level cy.logout() and the first cy.visit(). The call authenticates as root over a cy.request(), which carries the browser's cookies. The marker therefore promoted the visitor's own session to root before the first render. Only the first test of a spec is exposed, which is what the symptom showed.

The report first suspected Jahia/jahia-cypress#228. That guess was wrong: Jahia/jahia-cypress#228 merged seven weeks before the 8.2.1 tag, so it is already inside the passing baseline.

Jahia/jahia-cypress#253 fixes it, and 8.5.0 carries the fix. This branch therefore moves to ^8.5.0.

Fourteen specs of this suite end their describe-level before hook with cy.logout(). The fix has to hold for all fourteen, and not only for 61-login.cy.ts.

Validation

integration-tests on this head returns 96 tests, 96 passing, 0 failing, 0 skipped, over 25 specs, in run 33760288769. The nightly on main gives the same 96 and 0, so the migration and the version move together leave every count unchanged.

The test that failed at 8.4.0 now passes by name:

Running:  forms/61-login.cy.ts   (11 of 25)
  ✓ shows the back-office login entry to anonymous visitors
  ✔  forms/61-login.cy.ts   00:18   7   7

Every spec passed, not only that one, which matters because fourteen specs of this suite carry the before hook pattern the regression exposed.

Also checked: yarn install --mode=update-lockfile resolves 8.5.0 in both workspaces. The e2e suite was not run locally, because no Jahia was started for it.

Note on the Renovate bump

Jahia/luxe-jahia-demo#465 raises @jahia/cypress to 8.5.0 in the root lockfile only, and tests/ has its own lockfile. It therefore cannot change what the Cypress suite resolves. The same shape closed Jahia/luxe-jahia-demo#450 on 2026-08-31.

addSimplePage keeps its signature and now delegates to addPage, so none of its eight call sites moves. This helper already passed children straight through, so the delegation is one-to-one, and addNode leaves the import because nothing else in the file used it.

The range moves to ^8.4.0 in both workspaces: addPage ships in 8.4.0, and the previous ^8.0.0 resolved to 8.2.1 through the lockfile.
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦜 Chachalog

No changelog entries detected. Learn more about Chachalog.

Create a new entry online or run npx chachalog@0.5.6 prompt to create a new entry locally.

@jahia-carp jahia-carp added the 🗒️ no-changelog No release notes or changelog entry should be added for this PR or Issue label Aug 31, 2026
Experiment, to be reverted. Keeps the @jahia/cypress bump to 8.4.0 and puts the original addSimplePage back, so the next run tells whether the 61-login footer failure comes from the helper rewrite or from the dependency bump itself.
The suite failed on the first test of 61-login.cy.ts because the spec-marker beforeEach that
8.3.0 added promoted the visitor's just-logged-out session to root before the first render.
Jahia/jahia-cypress#251 tracked it and 8.5.0 carries the fix.

Both workspaces move, and both lockfiles resolve 8.5.0. The tests workspace is the one that
matters here, and the Renovate bump that only touched the root lockfile could not reach it.
@jahia-sonarqube

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@jahia-carp
jahia-carp marked this pull request as ready for review September 3, 2026 13:43
@jahia-carp
jahia-carp merged commit 7a3b762 into main Sep 3, 2026
23 checks passed
@jahia-carp
jahia-carp deleted the test/use-addpage-from-jahia-cypress branch September 3, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗒️ no-changelog No release notes or changelog entry should be added for this PR or Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants