Skip to content

Commit

Permalink
ACMS-1989: Fix failing text after changing admin theme to gin.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshreeputra committed Oct 17, 2023
1 parent 1de6fd6 commit 980270e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 22 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions modules/acquia_cms_common/acquia_cms_common.module
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ function _acquia_cms_common_update_view_display_options_style(string $view_name,
* An array of drupal configurations.
*/
function _acquia_cms_common_update_page_configurations(string $config_name, array $configurations) {
$config_factory = \Drupal::service('config.factory');
$config = $config_factory->getEditable($config_name);
$config = \Drupal::service('config.factory')->getEditable($config_name);
$need_save = FALSE;
if ($config) {
foreach ($configurations as $key => $value) {
Expand Down Expand Up @@ -349,8 +348,7 @@ function acquia_cms_common_modules_installed($modules, $is_syncing) {

// Prevent installation of site studio package on module install
// during site installation from other modules, this causes issue.
$config_factory = \Drupal::service('config.factory');
$config = $config_factory->get('cohesion.settings');
$config = \Drupal::service('config.factory')->get('cohesion.settings');
$cohesion_configured = $config->get('api_key') && $config->get('organization_key');
if (!InstallerKernel::installationAttempted() && $cohesion_configured) {
$module_handler = \Drupal::service('module_handler');
Expand Down
6 changes: 3 additions & 3 deletions modules/acquia_cms_common/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
"enable-patching": true,
"patches": {
"drupal/core": {
"3301692 - Passing null to parameter to mb_strtolower() is deprecated with PHP 8.1": "https://git.drupalcode.org/project/drupal/-/merge_requests/2598.patch",
"296693 - Restrict access to empty top level administration pages": "https://www.drupal.org/files/issues/2023-08-31/296693-10.1.x_0.patch",
"3371005 - Toolbar does not indicate active menu trail for pages not included in Toolbar": "https://git.drupalcode.org/project/drupal/-/commit/3165269bb01a5a8e5f53c1f369135b967c9d5924.patch",
"3301692 - Passing null to parameter to mb_strtolower() is deprecated with PHP 8.1": "https://git.drupalcode.org/project/drupal/-/merge_requests/2598.patch",
"3347291: - Combine field storage and field instance forms": "https://www.drupal.org/files/issues/2023-09-13/10.1-3347291-combine-mega-e.patch",
"3370946 - Page title should contextualize the local navigation": "https://www.drupal.org/files/issues/2023-09-11/3370946-page-title-backport-10-1-x.patch",
"3347291: - Combine field storage and field instance forms": "https://www.drupal.org/files/issues/2023-09-13/10.1-3347291-combine-mega-e.patch"
"3371005 - Toolbar does not indicate active menu trail for pages not included in Toolbar": "https://git.drupalcode.org/project/drupal/-/commit/3165269bb01a5a8e5f53c1f369135b967c9d5924.patch"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ public function testContentAdmin(): void {
// Node edit page.
$path = "node/$nid/edit";
$this->drupalGet($path);
$this->assertSession()->pageTextContains('Edit Test Headless Test Page');
$this->assertSession()->linkNotExists('View');
/** @var \Drupal\FunctionalJavascriptTests\JSWebAssert $assertSession */
$assertSession = $this->assertSession();
$assertSession->pageTextContains('Edit Test Headless Test Page');
$assertSession->linkNotExists('View');
$nodePageMenus = [
'API' => '/jsonapi/node/test/' . $node->uuid(),
'Edit' => '/node/' . $nid . '/edit',
'Preview' => '/node/' . $nid . '/site-preview',
'Delete' => '/node/' . $nid . '/delete',
'Revisions' => '/node/' . $nid . '/revisions',
'Clone' => '/entity_clone/node/' . $nid,
];
Expand All @@ -107,12 +108,19 @@ public function testContentAdmin(): void {
$this->assertCount(6, $menuList);
$menuOrder = [];
foreach ($menuList as $menu) {
$menuOrder[] = str_replace(' (active tab)', '', $menu->getText());
$tabTitle = str_replace(' (active tab)', '', $menu->getText());
if ($tabTitle) {
$menuOrder[] = $tabTitle;
}
}
// Assertion for menu order.
$this->assertEquals($menuOrder, array_keys($nodePageMenus));
// Assertion test for tabs of node page.
$this->assertTabMenus($nodePageMenus, $path);
// Assert delete buton.
$deleteButton = $assertSession->waitForElementVisible("css", "#edit-advanced #edit-gin-sidebar .form-actions a");
$this->assertEquals('Delete', $deleteButton->getText());
$this->assertEquals('/node/' . $nid . '/delete', $deleteButton->getAttribute('href'));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public function testAcmsWizardMenu(): void {
$this->assertEquals('Headless dashboard', $headlessDashboard->getText());

// Test Enable headless mode checkbox functionality.
$headlessForm = $assertSession->elementExists('css', '#acquia-cms-headless-form');
$headlessForm = $assertSession->waitForElementVisible('css', '#acquia-cms-headless-form');
$assertSession->elementExists('css', '.claro-details__summary', $headlessForm)->press();
$assertSession->waitForElementVisible('css', '#acquia-cms-headless-form #edit-headless-mode');
$headlessForm->checkField('Enable Headless mode');
$headlessForm->pressButton('Save');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function testChildMenu(string $selector, string $parentMenuName, array $c
/** @var \Drupal\FunctionalJavascriptTests\JSWebAssert $assertSession */
$assertSession = $this->assertSession();
// Wait for menu items to visible.
$menuItem = $assertSession->waitForElementVisible('css', '.hover-intent.menu-item');
$menuItem = $assertSession->waitForElementVisible('css', '.menu-item.hover-intent');
$this->assertInstanceOf(NodeElement::class, $menuItem);
$childrenMenuItems = $page->findAll("css", ".claro-toolbar-menu > .hover-intent.menu-item > ul.toolbar-menu:first-of-type > li");
$childrenMenuItems = $page->findAll("css", ".toolbar-menu-administration > .toolbar-menu > .menu-item.hover-intent > ul.toolbar-menu:first-of-type > li.menu-item");
$this->assertCount(count($children), $childrenMenuItems);
foreach ($childrenMenuItems as $key => $child) {
$this->assertEquals($children[$key], $child->find("css", "a:first-child")->getText());
Expand Down Expand Up @@ -144,6 +144,7 @@ public function providerMenu(): array {
'.toolbar-icon-system-admin-content',
'Content',
[
'Overview',
'Scheduled Content',
'Add content',
'Files',
Expand All @@ -156,6 +157,7 @@ public function providerMenu(): array {
'.toolbar-icon-admin-access-control',
'API',
[
'Overview',
'Dashboard',
'OAuth clients',
'OAuth settings',
Expand All @@ -168,6 +170,7 @@ public function providerMenu(): array {
'.toolbar-icon-admin-content-models',
'Data model',
[
'Overview',
'Block types',
'Content types',
'Media types',
Expand All @@ -179,6 +182,7 @@ public function providerMenu(): array {
'.toolbar-icon-admin-cms',
'System administration',
[
'Overview',
'Structure',
'Extend',
'Configuration',
Expand Down
2 changes: 1 addition & 1 deletion tests/src/ExistingSite/InstallStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testConfig(): void {
// Check that the default and admin themes are set as expected.
$theme_config = $this->config('system.theme');
$this->assertSame('cohesion_theme', $theme_config->get('default'));
$this->assertSame('acquia_claro', $theme_config->get('admin'));
$this->assertSame('gin', $theme_config->get('admin'));

// Check that the node create form is using the admin theme.
$this->assertTrue($this->config('node.settings')->get('use_admin_theme'));
Expand Down
2 changes: 1 addition & 1 deletion tests/src/ExistingSiteJavascript/CohesionTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function createMedia(array $values = []) {
*/
protected function pressSaveButton(): void {
$this->assertSession()
->elementExists('css', '#edit-actions')
->elementExists('css', '#edit-submit')
->pressButton('Save');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testClone(): void {

// Add Hero component to the layout canvas.
$this->getLayoutCanvas()->add('Hero');
$this->pressSaveButton();
$page->pressButton('Save');

// Clone the node in the UI.
$this->drupalGet($edit_form);
Expand Down

0 comments on commit 980270e

Please sign in to comment.