public function AuthenticationFormJsTest::testAuthenticationForm in Apigee Edge 8
Tests the Authentication form.
File
- tests/
src/ FunctionalJavascript/ Form/ AuthenticationFormJsTest.php, line 113
Class
- AuthenticationFormJsTest
- Apigee Edge API credentials, authentication form, key integration test.
Namespace
Drupal\Tests\apigee_edge\FunctionalJavascript\FormCode
public function testAuthenticationForm() {
if ($this->instanceType == EdgeKeyTypeInterface::INSTANCE_TYPE_HYBRID) {
$this
->markTestSkipped('Skipping "testAuthenticationForm": can only be tested with public/private cloud credentials.');
}
$web_assert = $this
->assertSession();
// Test the authentication form.
$this
->drupalLogin($this->rootUser);
$this
->drupalGet(Url::fromRoute('apigee_edge.settings'));
// We need to fill in the password field to test connection.
$this
->getSession()
->getPage()
->fillField('Password', $this->password);
$this
->assertSession()
->pageTextContains('Send request using the given API credentials.');
$this
->assertSendRequestMessage('.messages--status', 'Connection successful.');
$web_assert
->elementNotExists('css', 'details[data-drupal-selector="edit-debug"]');
$page = $this
->getSession()
->getPage();
$page
->find('css', 'details[data-drupal-selector="edit-provider-section"] > summary')
->click();
$page
->selectFieldOption('key_provider', 'apigee_edge_environment_variables');
$this
->assertSession()
->waitForText("The selected key provider does not accept a value. See the provider's description for instructions on how and where to store the key value.");
$this
->validateForm([
$this,
'visitAuthenticationForm',
]);
// Validate that the form actually saved the valid credentials (DRUP-734).
$this
->visitAuthenticationForm();
$web_assert
->fieldValueEquals('Organization', $this->organization);
$web_assert
->fieldValueEquals('Username', $this->username);
// Password field should be empty.
$web_assert
->fieldValueEquals('Password', '');
}