public function AntibotNoJavascriptTest::testNoJavaScript in Antibot 8
Tests antibot when JavaScript is disabled.
BrowserTestBase tests are, by design, non-JavaScript tests so we're having the perspective of bot trying to post a form.
File
- tests/
src/ Functional/ AntibotNoJavascriptTest.php, line 32
Class
- AntibotNoJavascriptTest
- Tests Antibot when JavaScript is disabled.
Namespace
Drupal\Tests\antibot\FunctionalCode
public function testNoJavaScript() {
$this
->drupalPostForm('/user/password', [
'name' => $this
->randomMachineName(),
], 'Submit');
// Check the we reached the antibot closed road when the form is posted by a
// bot even having JavaScript capabilities..
$this
->assertUrl('/antibot');
$this
->assertSession()
->pageTextContains('Submission failed');
$this
->assertSession()
->pageTextContains('You have reached this page because you submitted a form that required JavaScript to be enabled on your browser. This protection is in place to attempt to prevent automated submissions made on forms. Please return to the page that you came from and enable JavaScript on your browser before attempting to submit the form again.');
}