From 9cbb267d106170ea65ea384f9e5c43d2c8bfeb22 Mon Sep 17 00:00:00 2001 From: Rajeshreeputra Date: Mon, 16 Oct 2023 16:26:12 +0530 Subject: [PATCH] ACMS-1989: Fix failing text after changing admin theme to gin. --- .../tests/src/Functional/HeadlessContentTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/acquia_cms_headless/tests/src/Functional/HeadlessContentTest.php b/modules/acquia_cms_headless/tests/src/Functional/HeadlessContentTest.php index c76f8651f6..5439d9ede1 100644 --- a/modules/acquia_cms_headless/tests/src/Functional/HeadlessContentTest.php +++ b/modules/acquia_cms_headless/tests/src/Functional/HeadlessContentTest.php @@ -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, ]; @@ -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')); } /**