From 36de438329a71e021c932b5879215d3739f43c64 Mon Sep 17 00:00:00 2001 From: jkindly Date: Wed, 26 Jun 2024 08:42:53 +0200 Subject: [PATCH] OP-321: Behat tests update --- features/admin/adding_block.feature | 2 ++ features/admin/managing_blocks.feature | 2 ++ tests/Behat/Context/Ui/Admin/BlockContext.php | 8 ++++++++ tests/Behat/Page/Admin/Block/CreatePage.php | 7 +++++++ 4 files changed, 19 insertions(+) diff --git a/features/admin/adding_block.feature b/features/admin/adding_block.feature index 93aa26346..448b16e32 100644 --- a/features/admin/adding_block.feature +++ b/features/admin/adding_block.feature @@ -12,6 +12,7 @@ Feature: Adding blocks Scenario: Adding block When I go to the create block page And I fill the code with "store_description" + And I fill the name with "Store Description" And I add it Then I should be notified that the block has been created @@ -20,6 +21,7 @@ Feature: Adding blocks Given there are existing collections named "Blog" and "Homepage" When I go to the create block page And I fill the code with "intro" + And I fill the name with "Intro" And I add "Blog" and "Homepage" collections to it And I add it Then I should be notified that the block has been created diff --git a/features/admin/managing_blocks.feature b/features/admin/managing_blocks.feature index 6b4241137..b7429a7ae 100644 --- a/features/admin/managing_blocks.feature +++ b/features/admin/managing_blocks.feature @@ -20,6 +20,7 @@ Feature: Managing cms blocks Scenario: Updating block Given there is a block with "store_phone_number" code When I go to the update "store_phone_number" block page + And I fill the name with "Store phone number" if the name field is empty And I update it Then I should be notified that the block has been successfully updated @@ -27,6 +28,7 @@ Feature: Managing cms blocks Scenario: Disabling block Given there is an existing block with "bitbag_quote" code When I go to the update "bitbag_quote" block page + And I fill the name with "BitBag quote" if the name field is empty And I disable it And I update it Then I should be notified that the block has been successfully updated diff --git a/tests/Behat/Context/Ui/Admin/BlockContext.php b/tests/Behat/Context/Ui/Admin/BlockContext.php index c43b4830a..c6372c886 100755 --- a/tests/Behat/Context/Ui/Admin/BlockContext.php +++ b/tests/Behat/Context/Ui/Admin/BlockContext.php @@ -123,6 +123,14 @@ public function iFillTheNameWith(string $name): void $this->resolveCurrentPage()->fillName($name); } + /** + * @When I fill the name with :name if the name field is empty + */ + public function iFillTheNameIfItIsEmpty(string $name): void + { + $this->resolveCurrentPage()->fillNameIfItIsEmpty($name); + } + /** * @When I fill the link with :link */ diff --git a/tests/Behat/Page/Admin/Block/CreatePage.php b/tests/Behat/Page/Admin/Block/CreatePage.php index e3f9f8de4..08a0eaa9e 100755 --- a/tests/Behat/Page/Admin/Block/CreatePage.php +++ b/tests/Behat/Page/Admin/Block/CreatePage.php @@ -34,6 +34,13 @@ public function fillName(string $name): void $this->getDocument()->fillField('Name', $name); } + public function fillNameIfItIsEmpty(string $name): void + { + if (empty($this->getDocument()->findField('Name')->getValue())) { + $this->fillName($name); + } + } + public function fillLink(string $link): void { $this->getDocument()->fillField('Link', $link);