From 78020fa3bf86df06b778716d06f551c1e5ff46b8 Mon Sep 17 00:00:00 2001 From: Chandan Singgh <63041696+chandan-singh7929@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:05:41 +0530 Subject: [PATCH 1/3] ACMS-4275: Fix failing tests. --- .../tests/src/Functional/HeadlessFrontpageTest.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php b/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php index 80be77f47..353ea6ab7 100644 --- a/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php +++ b/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php @@ -37,10 +37,16 @@ public function testFrontPageIsLoginPage(): void { * Assert that frontpage for logged-in user is admin/content page. */ public function testFrontPageIsAdminContentPage(): void { - $account = $this->createUser(); - $account->addRole('administrator'); - $account->save(); - $this->drupalLogin($account); + $account = $this->createUser(['access content overview'], '', TRUE); + $page = $this->getSession()->getPage(); + + // Login as admin user. + $this->drupalGet('/user/login'); + $page->fillField('name', $account->getAccountName()); + $page->fillField('pass', $account->passRaw); + $page->pressButton('Log in'); + + // Assert that after login, user is redirected to admin/content page. $this->assertSession()->addressEquals('/admin/content'); $this->assertSession()->statusCodeEquals(200); } From beba97d2a4eba5bb9a18c6e612aa576c21b48e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CChandan?= Date: Mon, 14 Oct 2024 12:45:54 +0530 Subject: [PATCH 2/3] ACMS-4275: Update test with new menu item. --- .../tests/src/Functional/PureHeadlessModeMenuTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/acquia_cms_headless/tests/src/Functional/PureHeadlessModeMenuTest.php b/modules/acquia_cms_headless/tests/src/Functional/PureHeadlessModeMenuTest.php index 85892208a..f3110c893 100644 --- a/modules/acquia_cms_headless/tests/src/Functional/PureHeadlessModeMenuTest.php +++ b/modules/acquia_cms_headless/tests/src/Functional/PureHeadlessModeMenuTest.php @@ -147,6 +147,7 @@ public static function providerMenu(): array { [ 'Scheduled Content', 'Add content', + 'Blocks', 'Files', 'Media', 'Scheduled Media', From fd1bdceeed8053ef6c9e8e4f77f371a0c439b9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CChandan?= Date: Mon, 14 Oct 2024 15:07:52 +0530 Subject: [PATCH 3/3] ACMS-4275: Set useOneTimeLoginLinks to false. --- .../src/Functional/HeadlessFrontpageTest.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php b/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php index 353ea6ab7..1e6f6b14d 100644 --- a/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php +++ b/modules/acquia_cms_headless/tests/src/Functional/HeadlessFrontpageTest.php @@ -37,16 +37,15 @@ public function testFrontPageIsLoginPage(): void { * Assert that frontpage for logged-in user is admin/content page. */ public function testFrontPageIsAdminContentPage(): void { - $account = $this->createUser(['access content overview'], '', TRUE); - $page = $this->getSession()->getPage(); - - // Login as admin user. - $this->drupalGet('/user/login'); - $page->fillField('name', $account->getAccountName()); - $page->fillField('pass', $account->passRaw); - $page->pressButton('Log in'); - - // Assert that after login, user is redirected to admin/content page. + $account = $this->createUser(); + $account->addRole('administrator'); + $account->save(); + // Don't use one-time login links instead submit the login form. + // @see https://www.drupal.org/project/drupal/issues/3469309 + if (isset($this->useOneTimeLoginLinks)) { + $this->useOneTimeLoginLinks = FALSE; + } + $this->drupalLogin($account); $this->assertSession()->addressEquals('/admin/content'); $this->assertSession()->statusCodeEquals(200); }