public function AuthenticationFormJsTest::testUsingHybridForm in Apigee Edge 8
Tests the Authentication form using Hybrid auth.
@group hybrid
File
- tests/
src/ FunctionalJavascript/ Form/ AuthenticationFormJsTest.php, line 192
Class
- AuthenticationFormJsTest
- Apigee Edge API credentials, authentication form, key integration test.
Namespace
Drupal\Tests\apigee_edge\FunctionalJavascript\FormCode
public function testUsingHybridForm() {
// We have to structure the key variables so that this test class can
// be run both against a Public and Hybrid cloud orgs. Because of this,
// if the APIGEE_EDGE_HYBRID_ORGANIZATION environment var is set, it will
// use it as the Hybrid org for this test.
// Similarly, if the configured key credentials are for a Public/Private
// cloud org, then retrieve the account key directly from the environment.
$organization = getenv('APIGEE_EDGE_HYBRID_ORGANIZATION') ?: $this->organization;
$account_key = $this->account_key ? json_encode($this->account_key) : getenv('APIGEE_EDGE_ACCOUNT_JSON_KEY');
if (!$organization || !$account_key) {
$this
->markTestSkipped('Skipping "testUsingHybridForm": missing test environment variables APIGEE_EDGE_HYBRID_ORGANIZATION and/or APIGEE_EDGE_ACCOUNT_JSON_KEY.');
}
$web_assert = $this
->assertSession();
// Test the authentication form.
$this
->drupalLogin($this->rootUser);
$this
->drupalGet(Url::fromRoute('entity.key.add_form'));
$this
->visitKeyAddForm();
$page = $this
->getSession()
->getPage();
$page
->selectFieldOption('key_input_settings[instance_type]', EdgeKeyTypeInterface::INSTANCE_TYPE_HYBRID);
$page
->fillField('Organization', $organization);
$page
->fillField('GCP service account key', $account_key);
$this
->assertSendRequestMessage('.messages--status', 'Connection successful.');
$web_assert
->elementNotExists('css', 'details[data-drupal-selector="edit-debug"]');
}