am('Administrator'); $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); $I->expectTo('see categories page'); $I->checkForPhpNoticesOrWarnings(); $I->amGoingTo('try to save a category with a filled title'); $I->clickToolbarButton('New'); $I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']); $I->fillField(['id' => 'jform_title'], $categoryName); $I->clickToolbarButton('Save & Close'); $I->expectTo('see a success message after saving the category'); $I->see('Category successfully saved', ['id' => 'system-message-container']); } /** * Function to Trash a Category in Joomla! * * @param String $categoryName Name of the category which is to be trashed * * @return void * @throws \Exception */ public function trashCategory($categoryName) { $I = $this; $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); $I->searchForItem($categoryName); $I->amGoingTo('Select the weblink result'); $I->checkAllResults(); $I->clickToolbarButton("Trash"); $I->see('category successfully trashed.', ['id' => 'system-message-container']); } /** * Function to Delete a Category in Joomla! * * @param String $categoryName Name of the category which is to be deleted * * @return void * @throws \Exception */ public function deleteCategory($categoryName) { $I = $this; $I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks'); $I->waitForText('Weblinks: Categories', '30', ['css' => 'h1']); $I->setFilter('select status', 'Trashed'); $I->searchForItem($categoryName); $I->amGoingTo('Select the weblink result'); $I->checkAllResults(); $I->clickToolbarButton("empty trash"); $I->see('category successfully deleted.', ['id' => 'system-message-container']); } }