From 9396e4ab6790d7d924e23b26771e1084fca171c0 Mon Sep 17 00:00:00 2001 From: kshitij Date: Sat, 10 Dec 2016 18:43:24 +0100 Subject: [PATCH 1/7] menu and menu item tests --- .../Acceptance/Administrator/MenuItem.php | 280 ++++++++++++++++++ .../Step/Acceptance/Administrator/menu.php | 165 +++++++++++ tests/codeception/acceptance.suite.dist.yml | 2 + tests/codeception/acceptance/menu.feature | 49 +++ tests/codeception/acceptance/menuItem.feature | 70 +++++ 5 files changed, 566 insertions(+) create mode 100644 tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php create mode 100644 tests/codeception/_support/Step/Acceptance/Administrator/menu.php create mode 100644 tests/codeception/acceptance/menu.feature create mode 100644 tests/codeception/acceptance/menuItem.feature diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php new file mode 100644 index 0000000000..2d5d1870e7 --- /dev/null +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -0,0 +1,280 @@ +amOnPage(MenuManagerPage::$url); + $I->adminPage->clickToolbarButton('New'); } + + /** + * @When I check available tabs in menu + */ + public function iCheckAvailableTabsInMenu($tab1, $tab2) + { + $I = $this; + + $I->adminPage->clickToolbarButton('New'); + $I->waitForText('Articles: New Category'); + } + + /** + * @Then I see available tabs :arg1, :arg2 + */ + public function iSeeAvailableTabs($tab1, $tab2) + { + $I = $this; + + $I->adminPage->verifyAvailableTabs([$tab1, $tab2]); } + + /** + * @When I Login into Joomla administrator with username :arg1 and password :arg1 + */ + public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg2) + { + throw new \Codeception\Exception\Incomplete("Step `I Login into Joomla administrator with username :arg1 and password :arg1` is not defined"); + } + + /** + * @When I fill mandatory fields for creating menu + */ + public function iFillMandatoryFieldsForCreatingMenu() + { + throw new \Codeception\Exception\Incomplete("Step `I fill mandatory fields for creating menu` is not defined"); + } + + /** + * @Then I should see the menu :arg1 is created + */ + public function iShouldSeeTheMenuIsCreated($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 is created` is not defined"); + } + + /** + * @When I search and select menu with title :arg1 + */ + public function iSearchAndSelectMenuWithTitle($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I search and select menu with title :arg1` is not defined"); + } + + /** + * @When I save the menu + */ + public function iSaveTheMenu() + { + throw new \Codeception\Exception\Incomplete("Step `I save the menu` is not defined"); + } + + /** + * @Given I have a menu with title :arg1 which needs to be unpublish + */ + public function iHaveAMenuWithTitleWhichNeedsToBeUnpublish($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be unpublish` is not defined"); + } + + /** + * @When I unpublish the menu + */ + public function iUnpublishTheMenu() + { + throw new \Codeception\Exception\Incomplete("Step `I unpublish the menu` is not defined"); + } + + /** + * @Then I should see the menu is now unpublished + */ + public function iShouldSeeTheMenuIsNowUnpublished() + { + throw new \Codeception\Exception\Incomplete("Step `I should see the menu is now unpublished` is not defined"); + } + + /** + * @Given I have a menu with title :arg1 which needs to be trash + */ + public function iHaveAMenuWithTitleWhichNeedsToBeTrash($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be trash` is not defined"); + } + + /** + * @When I trash the menu + */ + public function iTrashTheMenu() + { + throw new \Codeception\Exception\Incomplete("Step `I trash the menu` is not defined"); + } + + /** + * @Then I should see the menu :arg1 in trash + */ + public function iShouldSeeTheMenuInTrash($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 in trash` is not defined"); + } + + /** + * @When I create new menu without field title + */ + public function iCreateNewMenuWithoutFieldTitle() + { + throw new \Codeception\Exception\Incomplete("Step `I create new menu without field title` is not defined"); + } + + /** + * @Then I choose menu item type :arg1 and Menu :arg2 + */ + public function iChooseMenuItemTypeAndMenu($arg1, $arg2) + { + throw new \Codeception\Exception\Incomplete("Step `I choose menu item type :arg1 and Menu :arg2` is not defined"); + } + + /** + * @Then I should see the menu language as :arg1 + */ + public function iShouldSeeTheMenuLanguageAs($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I should see the menu language as :arg1` is not defined"); + } +} \ No newline at end of file diff --git a/tests/codeception/acceptance.suite.dist.yml b/tests/codeception/acceptance.suite.dist.yml index d13c965f4c..7a90babf4f 100644 --- a/tests/codeception/acceptance.suite.dist.yml +++ b/tests/codeception/acceptance.suite.dist.yml @@ -51,3 +51,5 @@ gherkin: - Step\Acceptance\Administrator\Admin - Step\Acceptance\Administrator\Extension - Step\Acceptance\Administrator\Banner + - Step\Acceptance\Administrator\Menu + - Step\Acceptance\Administrator\MenuItem diff --git a/tests/codeception/acceptance/menu.feature b/tests/codeception/acceptance/menu.feature new file mode 100644 index 0000000000..9d67a5071c --- /dev/null +++ b/tests/codeception/acceptance/menu.feature @@ -0,0 +1,49 @@ +Feature: menu + In order to manage menu in the web + As an owner + I need to create modify trash publish and Unpublish menu + + Background: + When I Login into Joomla administrator with username "admin" and password "admin" + And I see the administrator dashboard + + Scenario: Verify available tabs in Menu + Given There is an menu link + When I check available tabs in menu + Then I see available tabs "Menu Details", "Permissions" + + Scenario: Create new menu + Given There is an menu link + When I fill mandatory fields for creating menu + | Title | + | Menu_1 | + Then I should see the menu "Menu_1" is created + + Scenario: Modify Menu + Given There is an menu link + When I search and select menu with title "Menu_1" + And I set the title as a "Modify_menu_1" + And I save the menu + Then I should see the menu "Modify_menu_1" is created + + + Scenario: Check menu if exist in frontend + Given There is joomla home page + When I should see "Modify_menu_1" + + Scenario: Unpublish menu + Given I have a menu with title "Modify_menu_1" which needs to be unpublish + When I unpublish the menu + Then I should see the menu is now unpublished + + Scenario: Trash menu + Given I have a menu with title "Modify_menu_1" which needs to be trash + When I trash the menu + Then I should see the menu "Modify_menu_1" in trash + + Scenario: Create menu without Title fails + Given There is an menu link + When I create new menu without field title + And I set Type as "Menu Type" + And I save the menu + Then I should see the "Invalid field: Title" diff --git a/tests/codeception/acceptance/menuItem.feature b/tests/codeception/acceptance/menuItem.feature new file mode 100644 index 0000000000..7acced213a --- /dev/null +++ b/tests/codeception/acceptance/menuItem.feature @@ -0,0 +1,70 @@ +Feature: menu Item + In order to manage menu item in the web + As an owner + I need to create modify trash publish and Unpublish menu item + + Background: + When I Login into Joomla administrator with username "admin" and password "admin" + And I see the administrator dashboard + + Scenario: Verify available tabs in Menu Items + Given There is an menu item link + When I check available tabs in menu item + Then I see the available tabs "Details", "Link Type", "Page Display", "Metadata", "Module Assignment" + + Scenario: Create new menu item + Given There is an menu item link + When I fill mandatory fields for creating menu item + | Title | + | MenuItem_1 | + Then I should see the menu item "MenuItem_1" is created + + Scenario: Modify Menu Item + Given There is an menu item link + When I search and select menu Item with title "MenuItem_1" + And I set the title as a "Modify_menuItem_1" + And I save the menu item + Then I should see the menu item "Modify_menuItem_1" is created + + Scenario: Unpublish menu item + Given I have a menu item with title "Modify_menuItem_1" which needs to be unpublish + When I unpublish the menu item + Then I should see the menu item is now unpublished + + Scenario: Trash menu item + Given I have a menu item with title "Modify_menuItem_1" which needs to be trash + When I trash the menu item + Then I should see the menu "Modify_menuItem_1" in trash + + Scenario: Create menu without Title fails + Given There is an menu item link + When I create new menu item without field title + And I choose menu item type "Archived Articles" and Menu "Main Menu" + And I save the menu item + Then I should see the "Invalid field: Title" + + Scenario: Create menu item for newly created menu + Given There is an menu link + When I fill mandatory fields for creating menu + | Title | + | Menu_1 | + Then I should see the menu "Menu" is created + And I create menu item with title "menuItem_2" + And I choose menu item type "Archived Articles" and Menu "Menu_1" + And I save the menu item + Then I should see the menu item "menuItem_1" is created + + Scenario: Change menu Item's Menu + Given There is an menu item link + When I search and select menu Item with title "menuItem_1" + And I set the menu as "Main Menu" + And I go to joomla home page + Then I should see "menuItem_1" + + Scenario: Menu Language settings // it should be of the menu item + Given There is an menu item link + When I search and select menu with title "menu_1" + And I set language as a "English (en-GB)" + And I save the menu item + Then I should see the menu item language as "English (en-GB)" + From af9be72cad883d413c5957ea3cab035b0d7fc217 Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 11:01:20 +0100 Subject: [PATCH 2/7] menu and menu Item tests wip --- .../Administrator/MenuItemManagerPage.php | 29 +++++++ .../Administrator/MenuManagerPage.php | 2 +- .../Step/Acceptance/Administrator/Admin.php | 11 +++ .../Acceptance/Administrator/MenuItem.php | 77 ++++++++++++------- .../Step/Acceptance/Administrator/menu.php | 31 +++++++- tests/codeception/acceptance/menu.feature | 5 -- tests/codeception/acceptance/menuItem.feature | 10 +-- 7 files changed, 123 insertions(+), 42 deletions(-) create mode 100644 tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php new file mode 100644 index 0000000000..d391bd01f5 --- /dev/null +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php @@ -0,0 +1,29 @@ +userAclPage = new UserAclPage($scenario); $this->menuManagerPage = new MenuManagerPage($scenario); $this->extensionManagerPage = new ExtensionManagerPage($scenario); + $this->menuItemManagerPage = new MenuItemManagerPage($scenario); } /** diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php index 2d5d1870e7..8fe798f9a2 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -10,7 +10,9 @@ namespace Step\Acceptance\Administrator; use Page\Acceptance\Administrator\AdminPage; +use Page\Acceptance\Administrator\MenuItemManagerPage; use Page\Acceptance\Administrator\MenuManagerPage; +use Behat\Gherkin\Node\TableNode; /** * Acceptance Step object class contains suits for Menu Manager. @@ -27,7 +29,10 @@ class MenuItem extends Admin */ public function thereIsAnMenuLink() { - throw new \Codeception\Exception\Incomplete("Step `There is an menu link` is not defined"); + $I = $this; + + $I->amOnPage(MenuItemManagerPage::$url); + $I->adminPage->clickToolbarButton('New'); } /** @@ -35,16 +40,20 @@ public function thereIsAnMenuLink() */ public function iCheckAvailableTabsInMenu() { - throw new \Codeception\Exception\Incomplete("Step `I check available tabs in menu` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('New'); + $I->waitForText('Menus: New Item'); } /** - * @Then I see available tabs :arg1, :arg2 + * @Then I see the available tabs :arg1, :arg2, :arg3, :arg4, :arg5 */ - public function iSeeAvailableTabs($arg1, $arg2) + public function iSeeTheAvailableTabs($arg1, $arg2, $arg3, $arg4, $arg5) { - throw new \Codeception\Exception\Incomplete("Step `I see available tabs :arg1, :arg2` is not defined"); - } + $I = $this; + + $I->adminPage->verifyAvailableTabs([$arg1, $arg2, $arg3, $arg4, $arg5]); } /** * @When I Login into Joomla administrator with username :arg1 and password :arg1 @@ -57,25 +66,42 @@ public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg /** * @When I fill mandatory fields for creating menu */ - public function iFillMandatoryFieldsForCreatingMenu() + public function iFillMandatoryFieldsForCreatingMenu(TableNode $title) { - throw new \Codeception\Exception\Incomplete("Step `I fill mandatory fields for creating menu` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('New'); + + $totalRows = count($title->getRows()); + $lastIndex = ($totalRows - 1); + + // Iterate over all rows + foreach ($title->getRows() as $index => $row) + { + if ($index !== 0) + { + $I->fillField(MenuItemManagerPage::$title, $row[0]); + + if ($index == $lastIndex) + { + $I->adminPage->clickToolbarButton('Save'); + } + else + { + $I->adminPage->clickToolbarButton('Save & New'); + } + } + } } /** * @Then I should see the menu :arg1 is created */ - public function iShouldSeeTheMenuIsCreated($arg1) + public function iShouldSeeTheMenuIsCreated($menu) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 is created` is not defined"); - } + $I = $this; - /** - * @When I search and select menu with title :arg1 - */ - public function iSearchAndSelectMenuWithTitle($arg1) - { - throw new \Codeception\Exception\Incomplete("Step `I search and select menu with title :arg1` is not defined"); + $I->MenuManagerPage->seeItemIsCreated($menu); } /** @@ -177,7 +203,7 @@ public function iCheckAvailableTabsInMenuItem() /** * @When I fill mandatory fields for creating menu item */ - public function iFillMandatoryFieldsForCreatingMenuItem() + public function iFillMandatoryFieldsForCreatingMenuItem(TableNode $title) { throw new \Codeception\Exception\Incomplete("Step `I fill mandatory fields for creating menu item` is not defined"); } @@ -262,19 +288,14 @@ public function iShouldSeeTheMenuItemLanguageAs($arg1) throw new \Codeception\Exception\Incomplete("Step `I should see the menu item language as :arg1` is not defined"); } - /** - * @Then I see the available tabs :arg1, :arg2, :arg3, :arg4, :arg5 - */ - public function iSeeTheAvailableTabs($arg1, $arg2, $arg3, $arg4, $arg5) - { - throw new \Codeception\Exception\Incomplete("Step `I see the available tabs :arg1, :arg2, :arg3, :arg4, :arg5` is not defined"); - } - /** * @When I search and select menu Item with title :arg1 */ - public function iSearchAndSelectMenuItemWithTitle($arg1) + public function iSearchAndSelectMenuItemWithTitle($title) { - throw new \Codeception\Exception\Incomplete("Step `I search and select menu Item with title :arg1` is not defined"); + $I = $this; + + $I->menuItemManagerPage->haveItemUsingSearch($title); + $I->adminPage->clickToolbarButton('edit'); } } \ No newline at end of file diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php index 758ba2e4e2..fcbab2d1a5 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php @@ -11,6 +11,7 @@ use Page\Acceptance\Administrator\AdminPage; use Page\Acceptance\Administrator\MenuManagerPage; +use Behat\Gherkin\Node\TableNode; /** * Acceptance Step object class contains suits for Menu Manager. @@ -29,7 +30,8 @@ public function thereIsAnMenuLink() $I = $this; $I->amOnPage(MenuManagerPage::$url); - $I->adminPage->clickToolbarButton('New'); } + $I->adminPage->clickToolbarButton('New'); + } /** * @When I check available tabs in menu @@ -62,9 +64,32 @@ public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg /** * @When I fill mandatory fields for creating menu */ - public function iFillMandatoryFieldsForCreatingMenu() + public function iFillMandatoryFieldsForCreatingMenu(TableNode $title) { - throw new \Codeception\Exception\Incomplete("Step `I fill mandatory fields for creating menu` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('New'); + + $totalRows = count($title->getRows()); + $lastIndex = ($totalRows - 1); + + // Iterate over all rows + foreach ($title->getRows() as $index => $row) + { + if ($index !== 0) + { + $I->fillField(MenuManagerPage::$title, $row[0]); + + if ($index == $lastIndex) + { + $I->adminPage->clickToolbarButton('Save'); + } + else + { + $I->adminPage->clickToolbarButton('Save & New'); + } + } + } } /** diff --git a/tests/codeception/acceptance/menu.feature b/tests/codeception/acceptance/menu.feature index 9d67a5071c..2816f45c1c 100644 --- a/tests/codeception/acceptance/menu.feature +++ b/tests/codeception/acceptance/menu.feature @@ -26,11 +26,6 @@ Feature: menu And I save the menu Then I should see the menu "Modify_menu_1" is created - - Scenario: Check menu if exist in frontend - Given There is joomla home page - When I should see "Modify_menu_1" - Scenario: Unpublish menu Given I have a menu with title "Modify_menu_1" which needs to be unpublish When I unpublish the menu diff --git a/tests/codeception/acceptance/menuItem.feature b/tests/codeception/acceptance/menuItem.feature index 7acced213a..8e2934b70c 100644 --- a/tests/codeception/acceptance/menuItem.feature +++ b/tests/codeception/acceptance/menuItem.feature @@ -52,18 +52,18 @@ Feature: menu Item And I create menu item with title "menuItem_2" And I choose menu item type "Archived Articles" and Menu "Menu_1" And I save the menu item - Then I should see the menu item "menuItem_1" is created + Then I should see the menu item "menuItem_2" is created Scenario: Change menu Item's Menu Given There is an menu item link - When I search and select menu Item with title "menuItem_1" + When I search and select menu Item with title "menuItem_2" And I set the menu as "Main Menu" And I go to joomla home page - Then I should see "menuItem_1" + Then I should see "menuItem_2" - Scenario: Menu Language settings // it should be of the menu item + Scenario: Menu item Language settings Given There is an menu item link - When I search and select menu with title "menu_1" + When I search and select menu Item with title "menuItem_2" And I set language as a "English (en-GB)" And I save the menu item Then I should see the menu item language as "English (en-GB)" From 0dab1965de856cea4f37957e2f38d8ccf49977a0 Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 12:31:59 +0100 Subject: [PATCH 3/7] menu and menu item tests wip --- .../Administrator/MenuItemManagerPage.php | 8 ++ .../Acceptance/Administrator/MenuItem.php | 119 ++++++++---------- .../Step/Acceptance/Administrator/menu.php | 23 +++- tests/codeception/acceptance/menu.feature | 2 +- tests/codeception/acceptance/menuItem.feature | 4 +- 5 files changed, 83 insertions(+), 73 deletions(-) diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php index d391bd01f5..0e4a0886f1 100644 --- a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php @@ -26,4 +26,12 @@ class MenuItemManagerPage extends AdminPage */ public static $url = 'administrator/index.php?option=com_menus&view=items'; + /** + * Locator for invalid category alert + * + * @var array + * @since __DEPLOY_VERSION__ + */ + public static $invalidTitle = ['class' => 'alert-error']; + } \ No newline at end of file diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php index 8fe798f9a2..1c34628867 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -13,6 +13,7 @@ use Page\Acceptance\Administrator\MenuItemManagerPage; use Page\Acceptance\Administrator\MenuManagerPage; use Behat\Gherkin\Node\TableNode; +use Page\Acceptance\Site\FrontPage; /** * Acceptance Step object class contains suits for Menu Manager. @@ -36,9 +37,9 @@ public function thereIsAnMenuLink() } /** - * @When I check available tabs in menu + * @When I check available tabs in menu item */ - public function iCheckAvailableTabsInMenu() + public function iCheckAvailableTabsInMenuItem() { $I = $this; @@ -64,9 +65,9 @@ public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg } /** - * @When I fill mandatory fields for creating menu + * @When I fill mandatory fields for creating menu item */ - public function iFillMandatoryFieldsForCreatingMenu(TableNode $title) + public function iFillMandatoryFieldsForCreatingMenuItem(TableNode $title) { $I = $this; @@ -101,7 +102,7 @@ public function iShouldSeeTheMenuIsCreated($menu) { $I = $this; - $I->MenuManagerPage->seeItemIsCreated($menu); + $I->menuManagerPage->seeItemIsCreated($menu); } /** @@ -109,47 +110,48 @@ public function iShouldSeeTheMenuIsCreated($menu) */ public function iSaveTheMenu() { - throw new \Codeception\Exception\Incomplete("Step `I save the menu` is not defined"); + $I = $this; + + $I->adminPage->waitForPageTitle('Menus: Add'); + $I->adminPage->clickToolbarButton('save & close'); } /** * @When I should see :arg1 */ - public function iShouldSee($arg1) + public function iShouldSee($menuItem) { - throw new \Codeception\Exception\Incomplete("Step `I should see :arg1` is not defined"); - } + $I = $this; - /** - * @Given I have a menu with title :arg1 which needs to be unpublish - */ - public function iHaveAMenuWithTitleWhichNeedsToBeUnpublish($arg1) - { - throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be unpublish` is not defined"); + $I->menuItemManagerPage->seeItemIsCreated($menuItem); } /** - * @When I unpublish the menu + * @When I should see error :arg1 */ - public function iUnpublishTheMenu() + public function iShouldSeeError($error) { - throw new \Codeception\Exception\Incomplete("Step `I unpublish the menu` is not defined"); + $I = $this; + + $I->see($error, MenuItemManagerPage::$invalidTitle); } /** - * @Then I should see the menu is now unpublished + * @Given I have a menu with title :arg1 which needs to be unpublished */ - public function iShouldSeeTheMenuIsNowUnpublished() + public function iHaveAMenuWithTitleWhichNeedsToBeUnpublished($title) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu is now unpublished` is not defined"); + $this->categoryManagerPage->haveItemUsingSearch($title); } /** - * @Given I have a menu with title :arg1 which needs to be trash + * @When I unpublish the menu */ - public function iHaveAMenuWithTitleWhichNeedsToBeTrash($arg1) + public function iUnpublishTheMenu() { - throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be trash` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('unpublish'); } /** @@ -157,31 +159,19 @@ public function iHaveAMenuWithTitleWhichNeedsToBeTrash($arg1) */ public function iTrashTheMenu() { - throw new \Codeception\Exception\Incomplete("Step `I trash the menu` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('trash'); } /** * @Then I should see the menu :arg1 in trash */ - public function iShouldSeeTheMenuInTrash($arg1) + public function iShouldSeeTheMenuInTrash($title) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 in trash` is not defined"); - } + $I = $this; - /** - * @When I create new menu without field title - */ - public function iCreateNewMenuWithoutFieldTitle() - { - throw new \Codeception\Exception\Incomplete("Step `I create new menu without field title` is not defined"); - } - - /** - * @When I set Type as :arg1 - */ - public function iSetTypeAs($arg1) - { - throw new \Codeception\Exception\Incomplete("Step `I set Type as :arg1` is not defined"); + $I->menuManagerPage->seeItemInTrash($title, 'Articles: Categories'); } /** @@ -189,31 +179,18 @@ public function iSetTypeAs($arg1) */ public function thereIsAnMenuItemLink() { - throw new \Codeception\Exception\Incomplete("Step `There is an menu item link` is not defined"); - } - - /** - * @When I check available tabs in menu item - */ - public function iCheckAvailableTabsInMenuItem() - { - throw new \Codeception\Exception\Incomplete("Step `I check available tabs in menu item` is not defined"); - } + $I = $this; - /** - * @When I fill mandatory fields for creating menu item - */ - public function iFillMandatoryFieldsForCreatingMenuItem(TableNode $title) - { - throw new \Codeception\Exception\Incomplete("Step `I fill mandatory fields for creating menu item` is not defined"); + $I->amOnPage(MenuItemManagerPage::$url); + $I->adminPage->clickToolbarButton('New'); } /** - * @Given I have a menu item with title :arg1 which needs to be unpublish + * @Given I have a menu item with title :arg1 which needs to be unpublished */ - public function iHaveAMenuItemWithTitleWhichNeedsToBeUnpublish($arg1) + public function iHaveAMenuItemWithTitleWhichNeedsToBeUnpublished($title) { - throw new \Codeception\Exception\Incomplete("Step `I have a menu item with title :arg1 which needs to be unpublish` is not defined"); + $this->menuItemManagerPage->haveItemUsingSearch($title); } /** @@ -221,7 +198,9 @@ public function iHaveAMenuItemWithTitleWhichNeedsToBeUnpublish($arg1) */ public function iUnpublishTheMenuItem() { - throw new \Codeception\Exception\Incomplete("Step `I unpublish the menu item` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('unpublish'); } /** @@ -243,9 +222,9 @@ public function iHaveAMenuItemWithTitleWhichNeedsToBeTrash($arg1) /** * @When I trash the menu item */ - public function iTrashTheMenuItem() + public function iTrashTheMenuItem($title) { - throw new \Codeception\Exception\Incomplete("Step `I trash the menu item` is not defined"); + $this->menuItemManagerPage->haveItemUsingSearch($title); } /** @@ -253,7 +232,13 @@ public function iTrashTheMenuItem() */ public function iCreateNewMenuItemWithoutFieldTitle() { - throw new \Codeception\Exception\Incomplete("Step `I create new menu item without field title` is not defined"); + $I = $this; + + $I->amOnPage(MenuItemManagerPage::$url); + $I->adminPage->clickToolbarButton('New'); + + $I->waitForText('Menus: New Item'); + $I->adminPage->clickToolbarButton('Save'); } /** @@ -277,7 +262,9 @@ public function iSetTheMenuAs($arg1) */ public function iGoToJoomlaHomePage() { - throw new \Codeception\Exception\Incomplete("Step `I go to joomla home page` is not defined"); + $I = $this; + + $I->amOnPage(FrontPage::$url); } /** diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php index fcbab2d1a5..0af6af385c 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php @@ -137,15 +137,16 @@ public function iUnpublishTheMenu() */ public function iShouldSeeTheMenuIsNowUnpublished() { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu is now unpublished` is not defined"); + $I = $this; + $I->seeNumberOfElements(MenuItemManagerPage::$seeUnpublished, 1); } /** * @Given I have a menu with title :arg1 which needs to be trash */ - public function iHaveAMenuWithTitleWhichNeedsToBeTrash($arg1) + public function iHaveAMenuWithTitleWhichNeedsToBeTrash($title) { - throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be trash` is not defined"); + $this->menuManagerPage->haveItemUsingSearch($title); } /** @@ -169,7 +170,13 @@ public function iShouldSeeTheMenuInTrash($arg1) */ public function iCreateNewMenuWithoutFieldTitle() { - throw new \Codeception\Exception\Incomplete("Step `I create new menu without field title` is not defined"); + $I = $this; + + $I->amOnPage(MenuManagerPage::$url); + $I->adminPage->clickToolbarButton('New'); + + $I->waitForText('Menus: New Item'); + $I->adminPage->clickToolbarButton('Save'); } /** @@ -187,4 +194,12 @@ public function iShouldSeeTheMenuLanguageAs($arg1) { throw new \Codeception\Exception\Incomplete("Step `I should see the menu language as :arg1` is not defined"); } + + /** + * @When I set menu Type as :arg1 + */ + public function iSetMenuTypeAs($arg1) + { + throw new \Codeception\Exception\Incomplete("Step `I set menu Type as :arg1` is not defined"); + } } \ No newline at end of file diff --git a/tests/codeception/acceptance/menu.feature b/tests/codeception/acceptance/menu.feature index 2816f45c1c..2a335759fc 100644 --- a/tests/codeception/acceptance/menu.feature +++ b/tests/codeception/acceptance/menu.feature @@ -39,6 +39,6 @@ Feature: menu Scenario: Create menu without Title fails Given There is an menu link When I create new menu without field title - And I set Type as "Menu Type" + And I set menu Type as "Menu Type" And I save the menu Then I should see the "Invalid field: Title" diff --git a/tests/codeception/acceptance/menuItem.feature b/tests/codeception/acceptance/menuItem.feature index 8e2934b70c..7a8f8f1a34 100644 --- a/tests/codeception/acceptance/menuItem.feature +++ b/tests/codeception/acceptance/menuItem.feature @@ -27,7 +27,7 @@ Feature: menu Item Then I should see the menu item "Modify_menuItem_1" is created Scenario: Unpublish menu item - Given I have a menu item with title "Modify_menuItem_1" which needs to be unpublish + Given I have a menu item with title "Modify_menuItem_1" which needs to be unpublished When I unpublish the menu item Then I should see the menu item is now unpublished @@ -41,7 +41,7 @@ Feature: menu Item When I create new menu item without field title And I choose menu item type "Archived Articles" and Menu "Main Menu" And I save the menu item - Then I should see the "Invalid field: Title" + Then I should see error "Invalid field: Title" Scenario: Create menu item for newly created menu Given There is an menu link From 3e4c27bdc75e3a38e95874af0e21e06fcef9ee86 Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 13:13:43 +0100 Subject: [PATCH 4/7] wip --- .../Administrator/MenuItemManagerPage.php | 16 ++++++++++++++++ .../Step/Acceptance/Administrator/MenuItem.php | 16 ++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php index 0e4a0886f1..34a62335a0 100644 --- a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php @@ -34,4 +34,20 @@ class MenuItemManagerPage extends AdminPage */ public static $invalidTitle = ['class' => 'alert-error']; + /** + * Locator for Menu Item unpublished icon + * + * @var array + * @since __DEPLOY_VERSION__ + */ + public static $seeUnpublished = ['xpath' => "//table[@id='itemList']//*//span[@class='icon-unpublish']"]; + + /** + * Locator for menu Item language field + * + * @var array + * @since __DEPLOY_VERSION__ + */ + public static $seeLanguage = ['xpath' => "//table[@id='itemList']//tr[1]//td[10]"]; + } \ No newline at end of file diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php index 1c34628867..a027dd9769 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -208,16 +208,17 @@ public function iUnpublishTheMenuItem() */ public function iShouldSeeTheMenuItemIsNowUnpublished() { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu item is now unpublished` is not defined"); + $I = $this; + + $I->seeNumberOfElements(MenuItemManagerPage::$seeUnpublished, 1); } /** * @Given I have a menu item with title :arg1 which needs to be trash */ - public function iHaveAMenuItemWithTitleWhichNeedsToBeTrash($arg1) + public function iHaveAMenuItemWithTitleWhichNeedsToBeTrash($title) { - throw new \Codeception\Exception\Incomplete("Step `I have a menu item with title :arg1 which needs to be trash` is not defined"); - } + $this->menuItemManagerPage->haveItemUsingSearch($title); } /** * @When I trash the menu item @@ -270,9 +271,12 @@ public function iGoToJoomlaHomePage() /** * @Then I should see the menu item language as :arg1 */ - public function iShouldSeeTheMenuItemLanguageAs($arg1) + public function iShouldSeeTheMenuItemLanguageAs($title) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu item language as :arg1` is not defined"); + $I = $this; + + $I->amOnPage(MenuItemManagerPage::$url); + $I->see($title, MenuItemManagerPage::$seeLanguage); } /** From 848c440a9ad378e7643830ff16139eea03ec8885 Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 13:42:59 +0100 Subject: [PATCH 5/7] wip --- .../Administrator/MenuItemManagerPage.php | 30 +++++++ .../Administrator/MenuManagerPage.php | 8 ++ .../Acceptance/Administrator/MenuItem.php | 85 ++----------------- .../Step/Acceptance/Administrator/menu.php | 76 +++++------------ tests/codeception/acceptance/menu.feature | 5 -- 5 files changed, 63 insertions(+), 141 deletions(-) diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php index 34a62335a0..6cf0316893 100644 --- a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php @@ -50,4 +50,34 @@ class MenuItemManagerPage extends AdminPage */ public static $seeLanguage = ['xpath' => "//table[@id='itemList']//tr[1]//td[10]"]; + public function selectMenuItemType($menuCategory, $menuItem) + { + + + // Open the category + $I->wait(1); + $I->waitForElement(['link' => $menuCategory], '60'); + $I->click(['link' => $menuCategory]); + + $I->comment("Choose the menu item type: $menuItem"); + $I->wait(1); + $I->waitForElement(['xpath' => "//a[contains(text()[normalize-space()], '$menuItem')]"], '60'); + $I->click(['xpath' => "//div[@id='collapseTypes']//a[contains(text()[normalize-space()], '$menuItem')]"]); + $I->comment('I switch back to the main window'); + } + + public function selectTypeAndMenu($type, $menu){ + + $I = $this; + + $I->comment("Open the menu types iframe"); + $I->click(['link' => "Select"]); + $I->waitForElement(['id' => 'menuTypeModal'], '60'); + $I->wait(1); + $I->switchToIFrame("Menu Item Type"); + + $I->comment("Open the menu category: $type"); + + + } } \ No newline at end of file diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuManagerPage.php index 7d8efda0ce..7e8141c79b 100644 --- a/tests/codeception/_support/Page/Acceptance/Administrator/MenuManagerPage.php +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuManagerPage.php @@ -59,6 +59,14 @@ class MenuManagerPage extends AdminPage */ public static $article = ['link' => 'Article']; + /** + * Locator for category unpublished icon + * + * @var array + * @since __DEPLOY_VERSION__ + */ + public static $seeUnpublished = ['xpath' => "//table[@id='categoryList']//*//span[@class='icon-unpublish']"]; + /** * This method is to set page object to choose an article dynamically. * diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php index a027dd9769..1e879a1254 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -25,17 +25,6 @@ class MenuItem extends Admin { - /** - * @Given There is an menu link - */ - public function thereIsAnMenuLink() - { - $I = $this; - - $I->amOnPage(MenuItemManagerPage::$url); - $I->adminPage->clickToolbarButton('New'); - } - /** * @When I check available tabs in menu item */ @@ -54,14 +43,7 @@ public function iSeeTheAvailableTabs($arg1, $arg2, $arg3, $arg4, $arg5) { $I = $this; - $I->adminPage->verifyAvailableTabs([$arg1, $arg2, $arg3, $arg4, $arg5]); } - - /** - * @When I Login into Joomla administrator with username :arg1 and password :arg1 - */ - public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg2) - { - throw new \Codeception\Exception\Incomplete("Step `I Login into Joomla administrator with username :arg1 and password :arg1` is not defined"); + $I->adminPage->verifyAvailableTabs([$arg1, $arg2, $arg3, $arg4, $arg5]); } /** @@ -95,27 +77,6 @@ public function iFillMandatoryFieldsForCreatingMenuItem(TableNode $title) } } - /** - * @Then I should see the menu :arg1 is created - */ - public function iShouldSeeTheMenuIsCreated($menu) - { - $I = $this; - - $I->menuManagerPage->seeItemIsCreated($menu); - } - - /** - * @When I save the menu - */ - public function iSaveTheMenu() - { - $I = $this; - - $I->adminPage->waitForPageTitle('Menus: Add'); - $I->adminPage->clickToolbarButton('save & close'); - } - /** * @When I should see :arg1 */ @@ -136,44 +97,6 @@ public function iShouldSeeError($error) $I->see($error, MenuItemManagerPage::$invalidTitle); } - /** - * @Given I have a menu with title :arg1 which needs to be unpublished - */ - public function iHaveAMenuWithTitleWhichNeedsToBeUnpublished($title) - { - $this->categoryManagerPage->haveItemUsingSearch($title); - } - - /** - * @When I unpublish the menu - */ - public function iUnpublishTheMenu() - { - $I = $this; - - $I->adminPage->clickToolbarButton('unpublish'); - } - - /** - * @When I trash the menu - */ - public function iTrashTheMenu() - { - $I = $this; - - $I->adminPage->clickToolbarButton('trash'); - } - - /** - * @Then I should see the menu :arg1 in trash - */ - public function iShouldSeeTheMenuInTrash($title) - { - $I = $this; - - $I->menuManagerPage->seeItemInTrash($title, 'Articles: Categories'); - } - /** * @Given There is an menu item link */ @@ -245,9 +168,11 @@ public function iCreateNewMenuItemWithoutFieldTitle() /** * @When I choose menu item type :arg1 and Menu :arg2 */ - public function iChooseMenuItemTypeAndMenu($arg1, $arg2) + public function iChooseMenuItemTypeAndMenu($type, $menu) { - throw new \Codeception\Exception\Incomplete("Step `I choose menu item type :arg1 and Menu :arg2` is not defined"); + $I = $this; + + $I->menuItemManagerPage->selectTypeAndMenu($type, $menu); } /** diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php index 0af6af385c..43220d93fe 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php @@ -51,14 +51,7 @@ public function iSeeAvailableTabs($tab1, $tab2) { $I = $this; - $I->adminPage->verifyAvailableTabs([$tab1, $tab2]); } - - /** - * @When I Login into Joomla administrator with username :arg1 and password :arg1 - */ - public function iLoginIntoJoomlaAdministratorWithUsernameAndPassword($arg1, $arg2) - { - throw new \Codeception\Exception\Incomplete("Step `I Login into Joomla administrator with username :arg1 and password :arg1` is not defined"); + $I->adminPage->verifyAvailableTabs([$tab1, $tab2]); } /** @@ -95,50 +88,33 @@ public function iFillMandatoryFieldsForCreatingMenu(TableNode $title) /** * @Then I should see the menu :arg1 is created */ - public function iShouldSeeTheMenuIsCreated($arg1) + public function iShouldSeeTheMenuIsCreated($menu) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 is created` is not defined"); + $I = $this; + + $I->menuManagerPage->seeItemIsCreated($menu); } /** * @When I search and select menu with title :arg1 */ - public function iSearchAndSelectMenuWithTitle($arg1) + public function iSearchAndSelectMenuWithTitle($title) { - throw new \Codeception\Exception\Incomplete("Step `I search and select menu with title :arg1` is not defined"); + $I = $this; + + $I->menuManagerPage->haveItemUsingSearch($title); + $I->adminPage->clickToolbarButton('edit'); } /** * @When I save the menu */ public function iSaveTheMenu() - { - throw new \Codeception\Exception\Incomplete("Step `I save the menu` is not defined"); - } - - /** - * @Given I have a menu with title :arg1 which needs to be unpublish - */ - public function iHaveAMenuWithTitleWhichNeedsToBeUnpublish($arg1) - { - throw new \Codeception\Exception\Incomplete("Step `I have a menu with title :arg1 which needs to be unpublish` is not defined"); - } - - /** - * @When I unpublish the menu - */ - public function iUnpublishTheMenu() - { - throw new \Codeception\Exception\Incomplete("Step `I unpublish the menu` is not defined"); - } - - /** - * @Then I should see the menu is now unpublished - */ - public function iShouldSeeTheMenuIsNowUnpublished() { $I = $this; - $I->seeNumberOfElements(MenuItemManagerPage::$seeUnpublished, 1); + + $I->adminPage->waitForPageTitle('Menus: Add'); + $I->adminPage->clickToolbarButton('save & close'); } /** @@ -154,15 +130,19 @@ public function iHaveAMenuWithTitleWhichNeedsToBeTrash($title) */ public function iTrashTheMenu() { - throw new \Codeception\Exception\Incomplete("Step `I trash the menu` is not defined"); + $I = $this; + + $I->adminPage->clickToolbarButton('trash'); } /** * @Then I should see the menu :arg1 in trash */ - public function iShouldSeeTheMenuInTrash($arg1) + public function iShouldSeeTheMenuInTrash($title) { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu :arg1 in trash` is not defined"); + $I = $this; + + $I->menuManagerPage->seeItemInTrash($title, 'Articles: Categories'); } /** @@ -179,22 +159,6 @@ public function iCreateNewMenuWithoutFieldTitle() $I->adminPage->clickToolbarButton('Save'); } - /** - * @Then I choose menu item type :arg1 and Menu :arg2 - */ - public function iChooseMenuItemTypeAndMenu($arg1, $arg2) - { - throw new \Codeception\Exception\Incomplete("Step `I choose menu item type :arg1 and Menu :arg2` is not defined"); - } - - /** - * @Then I should see the menu language as :arg1 - */ - public function iShouldSeeTheMenuLanguageAs($arg1) - { - throw new \Codeception\Exception\Incomplete("Step `I should see the menu language as :arg1` is not defined"); - } - /** * @When I set menu Type as :arg1 */ diff --git a/tests/codeception/acceptance/menu.feature b/tests/codeception/acceptance/menu.feature index 2a335759fc..f49faef1e2 100644 --- a/tests/codeception/acceptance/menu.feature +++ b/tests/codeception/acceptance/menu.feature @@ -26,11 +26,6 @@ Feature: menu And I save the menu Then I should see the menu "Modify_menu_1" is created - Scenario: Unpublish menu - Given I have a menu with title "Modify_menu_1" which needs to be unpublish - When I unpublish the menu - Then I should see the menu is now unpublished - Scenario: Trash menu Given I have a menu with title "Modify_menu_1" which needs to be trash When I trash the menu From 5fadc4c7f13dd6566424c4efd0944a41baa8cdce Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 14:02:30 +0100 Subject: [PATCH 6/7] wip --- .../Page/Acceptance/Administrator/MenuItemManagerPage.php | 4 ++-- .../_support/Step/Acceptance/Administrator/menu.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php index 6cf0316893..e44b5543ff 100644 --- a/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php +++ b/tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php @@ -10,7 +10,7 @@ namespace Page\Acceptance\Administrator; /** - * Acceptance Page object class to define menu manager page objects. + * Acceptance Page object class to define menu item manager page objects. * * @package Page\Acceptance\Administrator * @@ -19,7 +19,7 @@ class MenuItemManagerPage extends AdminPage { /** - * Link to the article category listing url. + * Link to the menu item listing url. * * @var string * @since __DEPLOY_VERSION__ diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php index 43220d93fe..abc0489581 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php @@ -41,7 +41,7 @@ public function iCheckAvailableTabsInMenu($tab1, $tab2) $I = $this; $I->adminPage->clickToolbarButton('New'); - $I->waitForText('Articles: New Category'); + $I->waitForText('Menus: Add'); } /** @@ -142,7 +142,7 @@ public function iShouldSeeTheMenuInTrash($title) { $I = $this; - $I->menuManagerPage->seeItemInTrash($title, 'Articles: Categories'); + $I->menuManagerPage->seeItemInTrash($title, 'Menus'); } /** From 5a8cfa5ea7d5a931ce9f46b41eb73efe028a6b4f Mon Sep 17 00:00:00 2001 From: kshitij Date: Sun, 11 Dec 2016 16:58:50 +0100 Subject: [PATCH 7/7] wip --- .../_support/Step/Acceptance/Administrator/MenuItem.php | 6 ++++-- .../_support/Step/Acceptance/Administrator/menu.php | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php index 1e879a1254..bfdb135de8 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php @@ -178,9 +178,11 @@ public function iChooseMenuItemTypeAndMenu($type, $menu) /** * @When I set the menu as :arg1 */ - public function iSetTheMenuAs($arg1) + public function iSetTheMenuAs($name) { - throw new \Codeception\Exception\Incomplete("Step `I set the menu as :arg1` is not defined"); + $I = $this; + + $I->adminPage->selectOptionInChosenById('jform_menutype', $name); } /** diff --git a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php index abc0489581..7ae0c1b561 100644 --- a/tests/codeception/_support/Step/Acceptance/Administrator/menu.php +++ b/tests/codeception/_support/Step/Acceptance/Administrator/menu.php @@ -162,8 +162,9 @@ public function iCreateNewMenuWithoutFieldTitle() /** * @When I set menu Type as :arg1 */ - public function iSetMenuTypeAs($arg1) + public function iSetMenuTypeAs($menuType) { - throw new \Codeception\Exception\Incomplete("Step `I set menu Type as :arg1` is not defined"); - } + $I = $this; + + $I->adminPage->selectOptionInChosenById('jform_menutype', $menuType); } } \ No newline at end of file