Unit/System Tests PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar muhme
muhme
4 Aug 2024

Summary of Changes

After #43879 and #43880 there are two System Tests are failing with Error: Unwanted PHP Deprecated. This PR fix them and is:

  • Precondition for #43722 to use joomla-cypress 1.1.1 in 4.4-dev and
  • Is only a down-merge from 5.1-dev and
  • Only has changes in the System Tests.

Testing Instructions

The errors are displayed in the System Test after you have upgraded checkForPhpNoticesOrWarnings to output. Verify the failed tests before patching. After patching, check if the test run was successful.

Actual result BEFORE applying this Pull Request

As preparation for the Cypress System Test install checkForPhpNoticesOrWarnings with output in overwriting lines 74 ... 89 in node_modules/joomla-cypress/src/support.jswith the following lines:

  Cypress.Commands.add('checkForPhpNoticesOrWarnings', () => {
    cy.log('**Check for PHP notices and warnings**')

    cy.document().then((doc) => {
      const pageSource = doc.documentElement.innerHTML
      // Search for PHP problem keywords in bold style with colon and collect the found keyword and the message
      const regex = /<b>(Warning|Deprecated|Notice|Strict standards)<\/b>:(.*?)(<br|$)/
      const match = regex.exec(pageSource)
      if (match) {
        // Directly fail with the reason, the keyword found and report the PHP problem message, e.g.
        // Error: Unwanted PHP Warning: "Attempt to read property \"id\" on null in <b>/joomla-cms/components/com_newsfeeds/src/View/Category/HtmlView.php</b> on line <b>92</b>"
        throw new Error(`Unwanted PHP ${match?.[1]}: ${JSON.stringify(match?.[2])}`)
      }
    })

    cy.log('--Check for PHP notices and warnings--')
  })

Run the two test specifications:

npx cypress run --spec tests/System/integration/site/components/com_content/Featured.cy.js,tests/System/integration/site/modules/mod_related_items/Default.cy.js

Fails with:

Running:  components/com_content/Featured.cy.js                                           (1 of 2)

  Test in frontend that the content featured view
    ✓ can display an article (382ms)
    ✓ can not display not featured articles (116ms)
    1) "after each" hook for "can navigate to the article"

  2 passing (1s)
  1 failing

  1) Test in frontend that the content featured view
       "after each" hook for "can navigate to the article":
     Error: Unwanted PHP Deprecated: "  DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in <b>/Users/hlu/Desktop/no_backup/joomla-cms/libraries/src/Date/Date.php</b> on line <b>126</b>"

...

Running:  modules/mod_related_items/Default.cy.js                                         (2 of 2)

  Test in frontend that the related items module
    1) "after each" hook for "can display a list of related articles based on the metakey field"

  0 passing (874ms)
  1 failing

  1) Test in frontend that the related items module
       "after each" hook for "can display a list of related articles based on the metakey field":
     Error: Unwanted PHP Deprecated: "  DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in <b>/Users/hlu/Desktop/no_backup/joomla-cms/libraries/src/Date/Date.php</b> on line <b>126</b>"

? With overwritten speaking checkForPhpNoticesOrWarnings, if you run the entire system tests, there are four failures before this PR and only two after. #43879 and #43880 are fixing the other two.

? Do you running Cypress test in GUI mode and wonder where the deprecated errors are? They are hidden and you have to inspect the published date to see them in the HTML source code:
screenshot

Expected result AFTER applying this Pull Request

No deprecated errors in System Test with overwritten checkForPhpNoticesOrWarnings.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Up-Merging

@LadySolveig @bembelimen there is no up-merge required as it is only a down-merge from 5.1-dev

avatar muhme muhme - open - 4 Aug 2024
avatar muhme muhme - change - 4 Aug 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Aug 2024
Category JavaScript Unit Tests
avatar alikon alikon - test_item - 5 Aug 2024 - Tested successfully
avatar alikon
alikon - comment - 5 Aug 2024

I have tested this item ✅ successfully on 9224986


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43881.

avatar laoneo laoneo - change - 6 Aug 2024
Labels Added: Unit/System Tests PR-4.4-dev
avatar laoneo laoneo - change - 6 Aug 2024
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-08-06 08:54:19
Closed_By laoneo
avatar laoneo laoneo - close - 6 Aug 2024
avatar laoneo laoneo - merge - 6 Aug 2024
avatar laoneo
laoneo - comment - 6 Aug 2024

Thanks!

Add a Comment

Login with GitHub to post a comment