Unit/System Tests PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar D3S-Gaurav
D3S-Gaurav
22 Feb 2026

Pull Request resolves #47199 .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Remove all 9 instances of cy.wait(5000) from tests/System/integration/administrator/components/com_contenthistory/Content.cy.js.

These hardcoded waits are a Cypress anti-pattern:

  • They waste ~45 seconds of CI time per test run when the server responds quickly
  • They can still cause flaky failures when the server is slow (5s may not be enough)
  • They are redundant because the .should('not.be.empty') assertions that follow are already retryable by Cypress

Instead, { timeout: 10000 } is added to the .its('0.contentDocument.body') calls, giving the iframe up to 10 seconds to load while relying on Cypress's built-in retry mechanism.

Testing Instructions

  1. Run the Content History system tests: npx cypress run --spec tests/System/integration/administrator/components/com_contenthistory/Content.cy.js
  2. All 7 test cases should pass without any flaky failures
  3. Tests should complete noticeably faster (previously wasted ~45s on hardcoded waits)

Actual result BEFORE applying this Pull Request

Tests use cy.wait(5000) 9 times, wasting ~45 seconds and still potentially flaking on slow CI environments.

Expected result AFTER applying this Pull Request

Tests rely on Cypress's built-in retry mechanism with an explicit 10s timeout, running faster and more reliably.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar D3S-Gaurav D3S-Gaurav - open - 22 Feb 2026
avatar D3S-Gaurav D3S-Gaurav - change - 22 Feb 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Feb 2026
Category JavaScript Unit Tests
avatar richard67
richard67 - comment - 22 Feb 2026

@D3S-Gaurav The content history system test is failing here: https://github.com/joomla/joomla-cms/actions/runs/22273759758/job/64437223532?pr=47200

  Running:  administrator/components/com_contenthistory/Content.cy.js                    (16 of 150)


  Test in backend that the content history list
    ✓ has a title (2493ms)
    ✓ can display a list of content history (1805ms)
    ✓ can open the history content item modal (1857ms)
    ✓ cannot compare one history content item only (1825ms)
    1) can delete a history content item
    2) can keep on a history content item
    ✓ can restore a history content item (2007ms)


  5 passing (35s)
  2 failing

  1) Test in backend that the content history list
       can delete a history content item:

      Timed out retrying after 10000ms
      + expected - actual

      -'\n    \n\n    \n    \n        \n\n\n\n    \n    Restore\n\n\n\n    \n    Preview\n\n\n\n    \n    Compare\n\n\n\n    \n    Keep On/Off\n\n\n\n    \n    Delete\n\n\n\n    \n    \n        \n            \n                All Versions            \n            \n                \n                    \n                        \n                    \n                    \n                        Date                    \n                    \n                        Version Note                    \n                    \n                        Keep Forever                    \n                    \n                        Author                    \n                    \n                        Character Count                    \n                \n            \n            \n                                                    \n                        \n                            Select 2026-02-22 10:52:17                        \n                        \n                            \n                                2026-02-22 10:52:17                            \n                                                            Current\n                                                    \n                        \n                                                    \n                        \n                                                            \n                                    No                                \n                                                    \n                        \n                            jane doe                        \n                        \n                            1,597                        \n                    \n                                                \n        \n\n                    \n                    \n                1 - 1 / 1 items            \n        \n        \n\n            \n            \n                            \n            \n        \n    \n\n        \n        \n        \n    \n\n\n\n\n\n'
      +'History version deleted'
      
      at Context.eval (webpack://joomla/./tests/System/integration/administrator/components/com_contenthistory/Content.cy.js:116:7)

  2) Test in backend that the content history list
       can keep on a history content item:

      Timed out retrying after 10000ms
      + expected - actual

      -'\n    \n\n    \n    \n        \n\n\n\n    \n    Restore\n\n\n\n    \n    Preview\n\n\n\n    \n    Compare\n\n\n\n    \n    Keep On/Off\n\n\n\n    \n    Delete\n\n\n\n    \n    \n        \n            \n                All Versions            \n            \n                \n                    \n                        \n                    \n                    \n                        Date                    \n                    \n                        Version Note                    \n                    \n                        Keep Forever                    \n                    \n                        Author                    \n                    \n                        Character Count                    \n                \n            \n            \n                                                    \n                        \n                            Select 2026-02-22 10:52:29                        \n                        \n                            \n                                2026-02-22 10:52:29                            \n                                                            Current\n                                                    \n                        \n                                                    \n                        \n                                                            \n                                    No                                \n                                                    \n                        \n                            jane doe                        \n                        \n                            1,597                        \n                    \n                                                \n        \n\n                    \n                    \n                1 - 1 / 1 items            \n        \n        \n\n            \n            \n                            \n            \n        \n    \n\n        \n        \n        \n    \n\n\n\n\n\n'
      +'Changed the keep forever value for a history version'
      
      at Context.eval (webpack://joomla/./tests/System/integration/administrator/components/com_contenthistory/Content.cy.js:142:7)




  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        7                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      2                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  2                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     34 seconds                                                                       │
  │ Spec Ran:     administrator/components/com_contenthistory/Content.cy.js                        │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

I will restart all jobs now to see if that was caused by cached JS resources.

avatar richard67
richard67 - comment - 22 Feb 2026

@D3S-Gaurav System test failed again, see my previous comment.

avatar D3S-Gaurav D3S-Gaurav - change - 22 Feb 2026
Labels Added: Unit/System Tests PR-5.4-dev
avatar D3S-Gaurav
D3S-Gaurav - comment - 22 Feb 2026

Hi @richard67 ,
Will look into the failing checks.

avatar D3S-Gaurav
D3S-Gaurav - comment - 22 Feb 2026

Thanks for the rerun @richard67! I checked the logs and found the actual error — the delete and keep buttons were staying disabled because the iframe's JS wasn't fully initialized when the checkbox was checked. The cy.wait(5000) was masking this by giving the JS time to wire up the event handlers.

Tracked it down to the joomla-toolbar-button web component which starts buttons as disabled with list-selection and only enables them after the boxchecked change event fires. Without the wait, the click was silently ignored.

Applied the fix — now using .should('not.be.disabled') before .click() so Cypress waits for the button to actually be enabled before clicking.

avatar richard67
richard67 - comment - 22 Feb 2026

@D3S-Gaurav No change, system tests are still failing. Sure you've pushed all changes? By the way, it is not good pracitce to always to a forced push. You should do your changes with additional commits instead.

And you should check the results of the CI actions yourself on GitHub.

avatar D3S-Gaurav
D3S-Gaurav - comment - 22 Feb 2026

@richard67 , Yeah i know and i'm sorry about the force-push. But when the forced-push one failed the checks then i properly went through the failing test.
Then i found the error and made my response above some minutes ago.

avatar D3S-Gaurav
D3S-Gaurav - comment - 22 Feb 2026

I also verified locally:

  1. ESLint passes with the project's test config (npx eslint --config build/eslint-tests.mjs)
  2. Syntax is valid
  3. Traced the root cause in the CI logs — the "Actual" content showed the unchanged history table (1 item, no system message), confirming the button clicks were silently ignored
  4. Confirmed in joomla-toolbar-button.w-c.es6.js that buttons with list-selection start disabled and executeTask() returns false when disabled
  5. The fix uses .should('not.be.disabled') before .click() so Cypress retries until the JS handlers have processed the checkbox change and enabled the button
avatar richard67
richard67 - comment - 22 Feb 2026

@D3S-Gaurav Despite of your previous comments the system tests are still failing here on GitHub.

avatar richard67
richard67 - comment - 22 Feb 2026

Then i found the error and made my response above some minutes ago.

@D3S-Gaurav No, there was no change a few minutes ago that comment. It definitely seems you have forgotten to push something. The system tests are still failing, and when you go to your PR in GitHub and go to the bottom to the CI actions you could check the details with a corresponding link right beside the action.

avatar D3S-Gaurav
D3S-Gaurav - comment - 22 Feb 2026

Hi @richard67 am looking into it.

Add a Comment

Login with GitHub to post a comment