Problem/Motivation

This is a child issue of #3061852: [META] Deprecate assertWaitOnAjaxRequest() and make the JsWebAssert::waitFor*() methods behave like real assertions, which plans to deprecate JsWebAssert::assertWaitOnAjaxRequest().

This issue is to remove all usages of JsWebAssert::assertWaitOnAjaxRequest() in core and replace with either one of the JsWebAssert::waitFor*() methods or something akin to them.

Given that there are 240 occurrences of assertWaitOnAjaxRequest() in core, we may want to break this up into some subtasks, if it proves difficult to review and move this issue forward.

usages

For some of these, we could break it up by module. Layout builder currently has 81 usages, for example.

Proposed resolution

  • Remove all usages of JsWebAssert::assertWaitOnAjaxRequest()
  • Replace with other ways of waiting, JsWebAssert::waitFor*() methods or something akin to them

Remaining tasks

Do it.

User interface changes

API changes

Data model changes

Release notes snippet

Comments

oknate created an issue. See original summary.

oknate’s picture

Issue summary: View changes
oknate’s picture

Title: Replace usages of JsWebAssert::assertWaitOnAjaxRequest() in core » Deprecate JsWebAssert::assertWaitOnAjaxRequest() in Drupal 9.0 and Drupal 8.9 and Replace usages of JsWebAssert::assertWaitOnAjaxRequest() in core
oknate’s picture

StatusFileSize
new1021 bytes

Here's a patch to deprecate JsWebAssert::assertWaitOnAjaxRequest().

oknate’s picture

oknate’s picture

Issue summary: View changes
StatusFileSize
new294 KB
oknate’s picture

Status: Active » Needs work
StatusFileSize
new80.26 KB

Here's some initial work on replacing the usage of JsWebAssert::assertWaitOnAjaxRequest(). This takes the number of usages down to about 110.

I opened some side issues:

One note for the next patch:

+    $assert_session->waitForElement('css', '.region-content-message.region-populated');

This should be wrapped in $this->assertNotEmpty(). Any call to $assert_session->waitForElement should be, until #3103101: Make the JsWebAssert::waitFor*() methods behave like real assertions lands.

shubhangi1995’s picture

Assigned: Unassigned » shubhangi1995
oknate’s picture

Assigned: shubhangi1995 » oknate

@shubhangi1995, Sorry, I should have assigned this to myself. I'm assigning back to myself. I spent many hours on this yesterday and I'm not done. Sorry to do that.

oknate’s picture

StatusFileSize
new88.52 KB
oknate’s picture

StatusFileSize
new90.95 KB
new9.08 KB

Mostly fixing this: ArgumentCountError: Too few arguments to function Drupal\FunctionalJavascriptTests\JSWebAssert::waitForFormBuildIdChange()

I was working on adding the argument and got distracted and committed it incomplete. Removing for now.

I'd like to make waitForFormBuildIdChange a little more generic so it can work when there is more than one form_build_id on a page.

oknate’s picture

StatusFileSize
new12.22 KB
new103.17 KB

Add more conversions.

oknate’s picture

StatusFileSize
new41.66 KB
new143.24 KB

Adding more conversions. Some of the layout builder changes are out of scope, and we'll probably need to roll those off into a separate issue.

oknate’s picture

StatusFileSize
new1.48 KB
new143.58 KB

Previous test timed out due to test code.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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.