Problem/Motivation

Follow-up from #3316274: Stabilize FunctionalJavascript testing AJAX: add ::assertExpectedAjaxRequest(). In that issue we added a new assertExpectedAjaxRequest() method, but didn't deprecate the old one.

Steps to reproduce

Proposed resolution

Convert all calls to assertWaitOnAjaxRequest() to assertExpectedAjaxRequest().

Add @deprecated and @trigger_error(....... E_USER_DEPRECATED) to the old method for removal in Drupal 11.

See https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... for the format.

Remaining tasks

  • Convert to an MR
  • Add the deprecation notice: find the place where the method assertWaitOnAjaxRequest() is defined and add the deprecation notice there as explained in the proposed resolution.

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3401619-2.patch209.32 KBpradhumanjain2311

Issue fork drupal-3401619

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

pradhumanjain2311’s picture

Status: Active » Needs review
StatusFileSize
new209.32 KB

Replace assertWaitOnAjaxRequest with assertExpectedAjaxRequest
and add the deprecation warning in assertWaitOnAjaxRequest method.
Please review.

needs-review-queue-bot’s picture

Status: Needs review » Needs work

The Needs Review Queue Bot tested this issue.

While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

catch’s picture

Title: Deprecate ::assertWaitOnAjaxRequest() in favour of ::assertExpectedAjaxRequest() » [PP-1] Deprecate ::assertWaitOnAjaxRequest() in favour of ::assertExpectedAjaxRequest()
Status: Needs work » Postponed

The changes look mostly fine. This actually requires #3316274: Stabilize FunctionalJavascript testing AJAX: add ::assertExpectedAjaxRequest() to land first, I should have marked it postponed on that and doing so now.

For the new deprecation, it should be from 10.2.0 instead of 10.1.0

quietone’s picture

Issue summary: View changes
Status: Postponed » Active
ankitv18’s picture

Assigned: Unassigned » ankitv18
ankitv18’s picture

Title: [PP-1] Deprecate ::assertWaitOnAjaxRequest() in favour of ::assertExpectedAjaxRequest() » Deprecate ::assertWaitOnAjaxRequest() in favour of ::assertExpectedAjaxRequest()
nafisb’s picture

I'm Nafis at DrupalCon Atlanta. I plan on working on this issue for the rest of the day.

ankitv18’s picture

Assigned: ankitv18 » Unassigned

nafisb changed the visibility of the branch 3401619-deprecate-assertwaitonajaxrequest-rebased to hidden.

nafisb changed the visibility of the branch 3401619-deprecate-assertwaitonajaxrequest-rebased to active.

brandonlira made their first commit to this issue’s fork.

brandonlira’s picture

Hi, I've created a new clean branch to address this issue.

The previous branch had too many unrelated commits and was outdated, causing multiple conflicts and making it hard to review.
This new branch includes only the intended change: replacing all usages of the deprecated assertWaitOnAjaxRequest() with assertExpectedAjaxRequest() across the core/ directory.

A new merge request has been opened from this clean branch.

Could someone please review and test this updated MR !12108?
Thank you!

brandonlira’s picture

Status: Active » Needs review

smustgrave’s picture

Status: Needs review » Needs work

Ticket talks about deprecating a method but don't see the deprecation

megachriz’s picture

Issue summary: View changes
Issue tags: +Vienna2025

The Drupal Contribution Mentoring team is triaging issues for DrupalCon Vienna 2025, and we are reserving this issue for Mentored Contribution during the event.

After October 17, this issue returns to being open to all. Thanks!

The next step is to add the deprecation notice: find the place where the method assertWaitOnAjaxRequest() is defined and add the deprecation notice there as explained in the proposed resolution.

rory downes’s picture

I am working on this in DrupalCon Vienna

rory downes’s picture

The task to add the depreciation notice has already been done in the branch created by @Brandonlira in comment https://www.drupal.org/project/drupal/issues/3401619#comment-16105612 - 3401619-deprecate-assertwaitonajaxrequest-rebased.

The other branch (issue-3401619-ajax-method-cleanup) is replacing all usages of the old method in core with the new method.

I am happy that both branches look OK but have not yet tested them.

What is not clear to me is whether the old method is to be replaced in all instances or if the new method is only intended to replace the old when needed.

The CR of the original ticket https://www.drupal.org/node/3401201 talks about firing a deprecation notice in one circumstance:
If either method is called when there are zero additional ajax requests made, but one or more ajax requests had occurred already, a deprecation error will be fired.
I think that I understand the new method is resolving that with the new parameter.

The old method calls the new with NULL in the new parameter.

We need someone more involved in the functional javascript and specifically Ajax testing (presumably the relevant framework manager) to decide if the old method will be removed. If it is then the two branches need to be tested ready for merging.

For this reason I am setting this back to Needs review and tagging it with 'Needs framework manager review'.

catch’s picture

We should remove assertWaitOnAjaxRequest() in Drupal 13.0.0 probably.

If all the usages are converted here and tests pass, then adding the deprecation can also happen in this issue (not at computer so didn't review the MR to check current state).

xjm’s picture

Issue tags: -Novice

xjm changed the visibility of the branch 3401619-deprecate-assertwaitonajaxrequest-rebased to hidden.

xjm changed the visibility of the branch 11.x to hidden.

xjm’s picture

Based on #22 and reading the change record for assertExpectedAjaxRequest(), I think we should just deprecate assertWaitOnAjaxRequest(), but put a little information from the CR in the deprecation message, and write a good CR for this issue based on that one.

We can disregard the previous branches and merge requests. I've ensured they're all hidden for clarity.

Writing such a deprecation and adding it to the docblock for assertWaitOnAjaxRequest() is a good first-time contributor task.

The Drupal Contribution Mentoring team is triaging issues for DrupalCon Nara 2025, and we are reserving this issue for Mentored Contribution during the event.

After November 19, this issue returns to being open to all. Thanks!

Thanks everyone!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

catch’s picture

Priority: Normal » Major

Bumping this to major since it's still the cause of a lot of random test failures, most recently in #3628411: [ci] Share compiled scripts between PHPUnit processes with opcache.file_cache.