diff --git a/composer.lock b/composer.lock index 2ac7273..aa96306 100644 --- a/composer.lock +++ b/composer.lock @@ -5,7 +5,6 @@ "This file is @generated automatically" ], "hash": "a92f2be1ccb2397e6cc71bcb0287cff5", - "content-hash": "48d3e6cb6a82e49be6cf95b54abd5364", "packages": [], "packages-dev": [ { @@ -527,12 +526,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "b0056ff0018c529cc2a143f6d78004bce8f9d5b0" + "reference": "cdc02b3e3d7c112d83d625db7ea410dac4ce3142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/b0056ff0018c529cc2a143f6d78004bce8f9d5b0", - "reference": "b0056ff0018c529cc2a143f6d78004bce8f9d5b0", + "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/cdc02b3e3d7c112d83d625db7ea410dac4ce3142", + "reference": "cdc02b3e3d7c112d83d625db7ea410dac4ce3142", "shasum": "" }, "require": { @@ -570,7 +569,7 @@ "acceptance testing", "joomla" ], - "time": "2015-10-31 11:00:18" + "time": "2015-10-31 15:09:12" }, { "name": "joomla-projects/robo", diff --git a/tests/acceptance/administrator/AdministratorCategoriesCest.php b/tests/acceptance/administrator/AdministratorCategoriesCest.php index fe00030..b521566 100644 --- a/tests/acceptance/administrator/AdministratorCategoriesCest.php +++ b/tests/acceptance/administrator/AdministratorCategoriesCest.php @@ -9,6 +9,68 @@ */ class AdministratorCategoriesCest { + /** + * Function to delete the menuItem + * + * @param string $menuItem Title of the menuItem which is to be deleted + * @return void + */ + private function deleteMenuItem(AcceptanceTester $I, $menuItem) + { + $I->amGoingTo('Delete the just saved MenuItem'); + $I->amOnPage('/administrator/index.php?option=com_menus&view=items'); + $I->searchForItem($menuItem); + $I->checkAllResults(); + $I->clickToolbarButton('Trash'); + $I->expectTo('see a success message and the menuItem removed from the list'); + $I->see('1 menu item successfully trashed.', ['id' => 'system-message-container']); + $I->searchForItem($menuItem); + $I->setFilter('select status', 'Trashed'); + $I->checkAllResults(); + $I->clickToolbarButton('empty trash'); + $I->see("1 menu item successfully deleted.", ['id' => 'system-message-container']); + } + + /** + * Creates a weblink with category + * + * @param string $title The title for the weblink + * @param string $url The url for the + * @param string $cat The category of the weblink + * + */ + private function createWeblinkWithCategory(AcceptanceTester $I, $title, $url, $cat) + { + $I->comment('I navigate to Weblinks page in /administrator/'); + $I->amOnPage('administrator/index.php?option=com_weblinks'); + $I->waitForText('Web Links', '30', ['css' => 'h1']); + $I->comment('I see weblinks page'); + $I->comment('I try to save a weblink with a filled title and URL'); + $I->click('New'); + $I->waitForText('Web Link: New', '30', ['css' => 'h1']); + $I->fillField(['id' => 'jform_title'], $title); + $I->fillField(['id' => 'jform_url'], $url); + $I->selectOptionInChosen('Category', "- " . $cat); + $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('weblink.save')\"]"]); + $I->waitForText('Web link successfully saved', '30', ['id' => 'system-message-container']); + } + + private function deleteWeblink(AcceptanceTester $I, $weblinkTitle) + { + $I->amGoingTo('Delete the just saved Weblink'); + $I->amOnPage('/administrator/index.php?option=com_weblinks'); + $I->searchForItem($weblinkTitle); + $I->checkAllResults(); + $I->clickToolbarButton('Trash'); + $I->expectTo('see a success message and the weblink removed from the list'); + $I->see('1 web link successfully trashed.', ['id' => 'system-message-container']); + $I->selectOptionInChosen('- Select Status -', 'Trashed'); + $I->searchForItem($weblinkTitle); + $I->checkAllResults(); + $I->clickToolbarButton('empty trash'); + $I->see("1 web link successfully deleted.", ['id' => 'system-message-container']); + } + public function administratorVerifyAvailableTabs(\Step\Acceptance\category $I) { $I->am('Administrator'); @@ -144,4 +206,76 @@ class AdministratorCategoriesCest $I->setFilter('select status','Archived'); $I->trashCategory('automated testing arch'.$salt); } + + public function administratorMenuWeblinkCategory(\Step\Acceptance\category $I) + { + $I->am('Administrator'); + $salt = rand(1, 100); + $categoryName = 'automated testing' . $salt; + + $I->doAdministratorLogin(); + $I->amGoingTo('Navigate to Categories page in /administrator/ and create a Category'); + $I->createCategory($categoryName); + $title = 'weblink' . $salt; + $url = 'www.google.com'; + $this->createWeblinkWithCategory($I, $title, $url, $categoryName); + $menuTitle = 'menuItem' . $salt; + $I->createMenuItem($menuTitle, $menuCategory = 'Weblinks', $menuItem = 'List Web Links in a Category', $menu = 'Main Menu', $language = 'All'); + $I->selectOptionInChosen('Select a Category', $categoryName); + $I->click('Save & Close'); + + // Go to the frontend + $I->comment('I want to check if the menu entry exists in the frontend'); + $I->amOnPage('index.php/'); + $I->click(['link' => $menuTitle]); + $I->waitForText($categoryName, 60, ['css' => 'h2']); + $I->seeElement(['xpath' => "//a[contains(text(),'" . $title . "')]"]); + + //Go to backend + $I->amOnPage('/administrator/'); + $this->deleteWeblink($I, $title); + $I->trashCategory($categoryName); + $this->deleteMenuItem($I, $menuTitle); + } + + + public function administratorWeblinkSubmit(\Step\Acceptance\category $I) + { + $I->am('Administrator'); + $I->wantToTest('Weblink creation in /administrator/'); + + $I->doAdministratorLogin(); + + // Get the weblink StepObject + $I->amGoingTo('Navigate to Weblinks page in /administrator/'); + $I->amOnPage('administrator/index.php?option=com_weblinks'); + $I->clickToolbarButton('options'); + $I->waitForText("Web Links Manager Options",30,['css' => 'h1']); + $I->click(['xpath' => "//a[contains(text(),'Permissions')]"]); + $I->selectOption('Create','Allowed'); + $I->clickToolbarButton('Save & Close'); + $I->waitForText("Web Links",30,['css' => 'h1']); + $I->amGoingTo('Navigate to Categories page in /administrator/ and create a Category'); + $salt = rand(1,100); + $categoryName = 'automated testing' . $salt; + $I->createCategory($categoryName); + $title = 'weblink' . $salt; + $url = 'www.google.com'; + $menuTitle = 'menuItem' . $salt; + $I->createMenuItem($menuTitle, $menuCategory = 'Weblinks', $menuItem = 'Submit a Web Link', $menu = 'Main Menu', $language = 'All'); + $I->click('Save & Close'); + + // Go to the frontend + $I->comment('I want to check if the menu entry exists in the frontend'); + $I->amOnPage('index.php/'); + $I->click(['link' => $menuTitle]); + $I->fillField(['id' => 'jform_title'], $title); + $I->selectOptionInChosen('Category', "- " . $categoryName); + $I->fillField(['id' => 'jform_url'], 'www.google.com'); + $I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('weblink.save')\"]"]); + $I->see('Web Link successfully submitted.', ['id' => 'system-message-container']); + + $I->trashCategory($categoryName); + $this->deleteMenuItem($I, $menuTitle); + } }