drupalGet('user'); $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('There are no AJAX requests to wait for.'); $this->assertSession()->assertWaitOnAjaxRequest(500); } /** * Tests that an untracked XHR triggers an error. */ public function testUntrackedXhr(): void { $this->getSession()->executeScript(<<expectException(\RuntimeException::class); $this->expectExceptionMessage('0 XHR requests through jQuery, but 1 observed in the browser — this requires js_testing_ajax_request_test.js to be updated.'); $this->assertSession()->assertExpectedAjaxRequest(1, 500); } }