$url = $this->buildUrl($path, $options);
// Ensure that each nojs page is accessible via ajax as well.
- if (strpos($url, 'nojs') !== FALSE) {
- $url = str_replace('nojs', 'ajax', $url);
+ if (strpos($url, '/nojs/') !== FALSE) {
+ $url = preg_replace('|/nojs/|', '/ajax/', $url, 1);
$result = $this->drupalGet($url, $options);
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('application/json', $this->getSession()->getResponseHeader('Content-Type'));