Skip to content

Commit

Permalink
ACMS-4373: Acquia Starter Kit Tour fix failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshreeputra committed Dec 23, 2024
1 parent 0c2add3 commit 9ffdafa
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 65 deletions.
3 changes: 1 addition & 2 deletions modules/acquia_cms_tour/acquia_cms_tour.install
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use Drupal\user\Entity\Role;
*/
function acquia_cms_tour_install($is_syncing) {
if (!$is_syncing) {
$role = Role::load('content_administrator');
if ($role) {
if (Role::load('content_administrator')) {
user_role_grant_permissions('content_administrator', ['access acquia cms tour dashboard']);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ class AcquiaGoogleMapsTest extends BrowserTestBase {
public function testAcquiaGoogleMaps() {
$assert_session = $this->assertSession();

// Create an administrator account with all permissions.
$admin_user = $this->drupalCreateUser([], NULL, TRUE);

// Log in the administrator account.
$this->drupalLogin($admin_user);

$this->drupalGet('/admin/config/system/geocoder/geocoder-provider');
$assert_session->statusCodeEquals(200);
//select googlemaps option from dropdown.
$assert_session->elementExists('css', '[data-drupal-selector="edit-geocoder-provider"]')
->selectOption('googlemaps');
$assert_session->buttonExists('Add')->press();
$assert_session->pageTextContains('Add a Geocoder provider');

$container = $assert_session->elementExists('css', '[data-drupal-selector="geocoder-provider-add-form"]');
$container->fillField('edit-label', 'GoogleMaps');
$container->fillField('edit-id', 'googlemaps');
$container->fillField('edit-apikey', 'oldkey12345');
$container->pressButton('Save');
$assert_session->pageTextContains('Created new geocoder provider');

// Create user account with 'access acquia cms tour dashboard' permission.
$account = $this->drupalCreateUser(['access acquia cms tour dashboard']);
$this->drupalLogin($account);

Expand All @@ -56,8 +78,8 @@ public function testAcquiaGoogleMaps() {
$assert_session->statusCodeEquals(200);

$container = $assert_session->elementExists('css', '[data-drupal-selector="edit-geocoder"]');
// API key should be blank to start.
$assert_session->fieldValueEquals('maps_api_key', '', $container);
$assert_session->fieldValueEquals('maps_api_key', 'oldkey12345', $container);
$container->fillField('maps_api_key', '');
$container->pressButton('Save');
$assert_session->pageTextContains('Maps API key field is required.');

Expand Down
18 changes: 2 additions & 16 deletions modules/acquia_cms_tour/tests/src/Functional/GoogleTagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ class GoogleTagManager extends BrowserTestBase {
'google_tag',
];

/**
* Disable strict config schema checks in this test.
*
* Cohesion has a lot of config schema errors, and until they are all fixed,
* this test cannot pass unless we disable strict config schema checking
* altogether. Since strict config schema isn't critically important in
* testing this functionality, it's okay to disable it for now, but it should
* be re-enabled (i.e., this property should be removed) as soon as possible.
*
* @var bool
*/
// @codingStandardsIgnoreStart
protected $strictConfigSchema = FALSE;
// @codingStandardsIgnoreEnd

/**
* Tests the Google Tag Manager Form.
*/
Expand All @@ -61,7 +46,8 @@ public function testGoogleTagManager() {
$container->pressButton('Save');
$assert_session->pageTextContains('The configuration options have been saved.');
// Test that the config values we expect are set correctly.
$tag_id = $this->config($this->config('google_tag.settings')->get('default_google_tag_entity'))->get('tag_container_ids');
$tag = $this->config('google_tag.settings')->get('default_google_tag_entity');
$tag_id = $this->config('google_tag.container.' . $tag)->get('tag_container_ids');
$this->assertEquals($tag_id, [$dummy_tag]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ class HelpIntegrationTest extends BrowserTestBase {
'toolbar',
];

/**
* Disable strict config schema checks in this test.
*
* Scheduler has a config schema errors, and until it's fixed,
* this test cannot pass unless we disable strict config schema checking
* altogether. Since strict config schema isn't critically important in
* testing this functionality, it's okay to disable it for now, but it should
* be re-enabled (i.e., this property should be removed) as soon as possible.
*
* @var bool
*/
// @codingStandardsIgnoreStart
protected $strictConfigSchema = FALSE;
// @codingStandardsIgnoreEnd

/**
* Tests the Acquia CMS Tour module's integration with the core Help module.
*/
Expand Down
15 changes: 0 additions & 15 deletions modules/acquia_cms_tour/tests/src/Functional/RecaptchaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ class RecaptchaTest extends BrowserTestBase {
'recaptcha',
];

/**
* Disable strict config schema checks in this test.
*
* Cohesion has a lot of config schema errors, and until they are all fixed,
* this test cannot pass unless we disable strict config schema checking
* altogether. Since strict config schema isn't critically important in
* testing this functionality, it's okay to disable it for now, but it should
* be re-enabled (i.e., this property should be removed) as soon as possible.
*
* @var bool
*/
// @codingStandardsIgnoreStart
protected $strictConfigSchema = FALSE;
// @codingStandardsIgnoreEnd

/**
* Tests the Recaptcha Form.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ class AcquiaTourDashboardTest extends KernelTestBase {
'acquia_cms_tour',
];

/**
* Disable strict config schema checks in this test.
*
* Cohesion has a lot of config schema errors, and until they are all fixed,
* this test cannot pass unless we disable strict config schema checking
* altogether. Since strict config schema isn't critically important in
* testing this functionality, it's okay to disable it for now, but it should
* be re-enabled (i.e., this property should be removed) as soon as possible.
*
* @var bool
*/
// @codingStandardsIgnoreStart
protected $strictConfigSchema = FALSE;
// @codingStandardsIgnoreEnd

/**
* Tests AcquiaCMSTour plugins and make sure they are sorted per weights.
*/
Expand Down

0 comments on commit 9ffdafa

Please sign in to comment.