This repository was archived by the owner on Mar 17, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 28
Com menu/test #107
Open
kshitijSharma2014
wants to merge
7
commits into
joomla-projects:staging
Choose a base branch
from
kshitijSharma2014:com_menu/test
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Com menu/test #107
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
tests/codeception/_support/Page/Acceptance/Administrator/MenuItemManagerPage.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| <?php | ||
| /** | ||
| * @package Joomla.Test | ||
| * @subpackage AcceptanceTester.Page | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| namespace Page\Acceptance\Administrator; | ||
|
|
||
| /** | ||
| * Acceptance Page object class to define menu item manager page objects. | ||
| * | ||
| * @package Page\Acceptance\Administrator | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class MenuItemManagerPage extends AdminPage | ||
| { | ||
| /** | ||
| * Link to the menu item listing url. | ||
| * | ||
| * @var string | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| 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']; | ||
|
|
||
| /** | ||
| * 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]"]; | ||
|
|
||
| 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){ | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CodeStyle my friend ;) |
||
| $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"); | ||
|
|
||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
219 changes: 219 additions & 0 deletions
219
tests/codeception/_support/Step/Acceptance/Administrator/MenuItem.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,219 @@ | ||
| <?php | ||
| /** | ||
| * @package Joomla.Test | ||
| * @subpackage AcceptanceTester.Step | ||
| * | ||
| * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | ||
| * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
| */ | ||
|
|
||
| namespace Step\Acceptance\Administrator; | ||
|
|
||
| use Page\Acceptance\Administrator\AdminPage; | ||
| 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. | ||
| * | ||
| * @package Step\Acceptance\Administrator | ||
| * | ||
| * @since __DEPLOY_VERSION__ | ||
| */ | ||
| class MenuItem extends Admin | ||
| { | ||
|
|
||
| /** | ||
| * @When I check available tabs in menu item | ||
| */ | ||
| public function iCheckAvailableTabsInMenuItem() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->adminPage->clickToolbarButton('New'); | ||
| $I->waitForText('Menus: New Item'); | ||
| } | ||
|
|
||
| /** | ||
| * @Then I see the available tabs :arg1, :arg2, :arg3, :arg4, :arg5 | ||
| */ | ||
| public function iSeeTheAvailableTabs($arg1, $arg2, $arg3, $arg4, $arg5) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->adminPage->verifyAvailableTabs([$arg1, $arg2, $arg3, $arg4, $arg5]); | ||
| } | ||
|
|
||
| /** | ||
| * @When I fill mandatory fields for creating menu item | ||
| */ | ||
| public function iFillMandatoryFieldsForCreatingMenuItem(TableNode $title) | ||
| { | ||
| $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'); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @When I should see :arg1 | ||
| */ | ||
| public function iShouldSee($menuItem) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->menuItemManagerPage->seeItemIsCreated($menuItem); | ||
| } | ||
|
|
||
| /** | ||
| * @When I should see error :arg1 | ||
| */ | ||
| public function iShouldSeeError($error) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->see($error, MenuItemManagerPage::$invalidTitle); | ||
| } | ||
|
|
||
| /** | ||
| * @Given There is an menu item link | ||
| */ | ||
| public function thereIsAnMenuItemLink() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->amOnPage(MenuItemManagerPage::$url); | ||
| $I->adminPage->clickToolbarButton('New'); | ||
| } | ||
|
|
||
| /** | ||
| * @Given I have a menu item with title :arg1 which needs to be unpublished | ||
| */ | ||
| public function iHaveAMenuItemWithTitleWhichNeedsToBeUnpublished($title) | ||
| { | ||
| $this->menuItemManagerPage->haveItemUsingSearch($title); | ||
| } | ||
|
|
||
| /** | ||
| * @When I unpublish the menu item | ||
| */ | ||
| public function iUnpublishTheMenuItem() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->adminPage->clickToolbarButton('unpublish'); | ||
| } | ||
|
|
||
| /** | ||
| * @Then I should see the menu item is now unpublished | ||
| */ | ||
| public function iShouldSeeTheMenuItemIsNowUnpublished() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->seeNumberOfElements(MenuItemManagerPage::$seeUnpublished, 1); | ||
| } | ||
|
|
||
| /** | ||
| * @Given I have a menu item with title :arg1 which needs to be trash | ||
| */ | ||
| public function iHaveAMenuItemWithTitleWhichNeedsToBeTrash($title) | ||
| { | ||
| $this->menuItemManagerPage->haveItemUsingSearch($title); } | ||
|
|
||
| /** | ||
| * @When I trash the menu item | ||
| */ | ||
| public function iTrashTheMenuItem($title) | ||
| { | ||
| $this->menuItemManagerPage->haveItemUsingSearch($title); | ||
| } | ||
|
|
||
| /** | ||
| * @When I create new menu item without field title | ||
| */ | ||
| public function iCreateNewMenuItemWithoutFieldTitle() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->amOnPage(MenuItemManagerPage::$url); | ||
| $I->adminPage->clickToolbarButton('New'); | ||
|
|
||
| $I->waitForText('Menus: New Item'); | ||
| $I->adminPage->clickToolbarButton('Save'); | ||
| } | ||
|
|
||
| /** | ||
| * @When I choose menu item type :arg1 and Menu :arg2 | ||
| */ | ||
| public function iChooseMenuItemTypeAndMenu($type, $menu) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->menuItemManagerPage->selectTypeAndMenu($type, $menu); | ||
| } | ||
|
|
||
| /** | ||
| * @When I set the menu as :arg1 | ||
| */ | ||
| public function iSetTheMenuAs($name) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->adminPage->selectOptionInChosenById('jform_menutype', $name); | ||
| } | ||
|
|
||
| /** | ||
| * @When I go to joomla home page | ||
| */ | ||
| public function iGoToJoomlaHomePage() | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->amOnPage(FrontPage::$url); | ||
| } | ||
|
|
||
| /** | ||
| * @Then I should see the menu item language as :arg1 | ||
| */ | ||
| public function iShouldSeeTheMenuItemLanguageAs($title) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->amOnPage(MenuItemManagerPage::$url); | ||
| $I->see($title, MenuItemManagerPage::$seeLanguage); | ||
| } | ||
|
|
||
| /** | ||
| * @When I search and select menu Item with title :arg1 | ||
| */ | ||
| public function iSearchAndSelectMenuItemWithTitle($title) | ||
| { | ||
| $I = $this; | ||
|
|
||
| $I->menuItemManagerPage->haveItemUsingSearch($title); | ||
| $I->adminPage->clickToolbarButton('edit'); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this many free lines? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yvesh I need to commit changes, will correct it in the next commit :)