diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php index 24cd134..9aa4848 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php @@ -121,7 +121,6 @@ public function doTestCreateMediaType($media_type_id, $source_id, array $provide // Save the form to create the type. $page->pressButton('Save'); - $assert_session->statusCodeEquals(200); $assert_session->pageTextContains('The media type ' . $media_type_id . ' has been added.'); $this->drupalGet('admin/structure/media'); $assert_session->pageTextContains($media_type_id); diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php index b150f89..ec8833c 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php @@ -54,7 +54,6 @@ public function testMediaTypes() { $assert_session = $this->assertSession(); $this->drupalGet('admin/structure/media'); - $assert_session->statusCodeEquals(200); $assert_session->pageTextContains('No media types available. Add media type.'); $assert_session->linkExists('Add media type'); @@ -69,10 +68,8 @@ public function testMediaTypes() { $this->assertJsCondition("jQuery('.form-item-source-configuration-test-config-value').length > 0;"); $page->fillField('description', $description); $page->pressButton('Save'); - $assert_session->statusCodeEquals(200); $assert_session->pageTextContains('The media type ' . $name . ' has been added.'); $this->drupalGet('admin/structure/media'); - $assert_session->statusCodeEquals(200); $assert_session->pageTextContains($name); $assert_session->pageTextContains($description); @@ -141,7 +138,7 @@ public function testMediaTypes() { $page->uncheckField('options[status]'); $page->checkField('options[queue_thumbnail_downloads]'); $page->pressButton('Save'); - $assert_session->statusCodeEquals(200); + $assert_session->pageTextContains("The media type $new_name has been updated."); // Test if edit worked and if new field values have been saved as expected. $this->drupalGet('admin/structure/media/manage/' . $this->testMediaType->id()); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php index e02e0df..fa2d541 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php @@ -48,13 +48,10 @@ public function testSessionExpiration() { // number of times. $this->drupalGet(''); - $session_assert = $this->assertSession(); - $page = $this->getSession()->getPage(); for ($i = 0; $i < 25; $i++) { $page->clickLink('Link to front page'); - $session_assert->statusCodeEquals(200); } } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php index 81d379f..d571a1b 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php @@ -366,4 +366,60 @@ function t(r, lx, ly) { return $this->session->evaluateScript($full_javascript_visibility_test); } + /** + * The use of statusCodeEquals() is not available. + * + * @param int $code + * The status code. + * + * @throws \Behat\Mink\Exception\UnsupportedDriverActionException + * Throws an exception on use. + */ + public function statusCodeEquals($code) { + throw new UnsupportedDriverActionException('The use of statusCodeEquals() is not available in a functional JavaScript test.', $this->session->getDriver()); + } + + /** + * The use of statusCodeNotEquals() is not available. + * + * @param int $code + * The status code. + * + * @throws \Behat\Mink\Exception\UnsupportedDriverActionException + * Throws an exception on use. + */ + public function statusCodeNotEquals($code) { + throw new UnsupportedDriverActionException('The use of statusCodeNotEquals() is not available in a functional JavaScript test.', $this->session->getDriver()); + } + + /** + * The use of responseHeaderEquals() is not available. + * + * @param string $name + * The name of the header. + * @param string $value + * The value to check the header against. + * + * @throws \Behat\Mink\Exception\UnsupportedDriverActionException + * Throws an exception on use. + */ + public function responseHeaderEquals($name, $value) { + throw new UnsupportedDriverActionException('The use of responseHeaderEquals() is not available in a functional JavaScript test.', $this->session->getDriver()); + } + + /** + * The use of responseHeaderNotEquals() is not available. + * + * @param string $name + * The name of the header. + * @param string $value + * The value to check the header against. + * + * @throws \Behat\Mink\Exception\UnsupportedDriverActionException + * Throws an exception on use. + */ + public function responseHeaderNotEquals($name, $value) { + throw new UnsupportedDriverActionException('The use of responseHeaderNotEquals() is not available in a functional JavaScript test.', $this->session->getDriver()); + } + } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index bd50c23..8ad783a 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -736,7 +736,6 @@ protected function drupalLogin(AccountInterface $account) { } $this->drupalGet('user/login'); - $this->assertSession()->statusCodeEquals(200); $this->submitForm([ 'name' => $account->getUsername(), 'pass' => $account->passRaw, @@ -761,7 +760,6 @@ protected function drupalLogout() { // screen. $assert_session = $this->assertSession(); $this->drupalGet('user/logout', ['query' => ['destination' => 'user']]); - $assert_session->statusCodeEquals(200); $assert_session->fieldExists('name'); $assert_session->fieldExists('pass');