diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php index e1b0acc..1dfaa93 100644 --- a/src/JoomlaBrowser.php +++ b/src/JoomlaBrowser.php @@ -571,4 +571,55 @@ private function searchResultLanguageName($languageName) return $xpath; } + + /** + * Publishes a module on all frontend pages + * + * @param string $module The full name of the module + * @param string $position The template position of a module. Right position by default + */ + public function setModulePosition($module, $position = 'position-7') + { + $I = $this; + $I->amOnPage('administrator/index.php?option=com_modules'); + $I->searchForItem($module); + $I->click(['link' => $module]); + $I->selectOptionInChosen('Position', $position); + $I->click(['xpath' => "//div[@id='toolbar-apply']/button"]); + $I->waitForText('Module successfully saved',30,['id' => 'system-message-container']); + } + + /** + * Publishes a module on all frontend pages + * + * @param string $module The full name of the module + */ + public function publishModule($module) + { + $I = $this; + $I->amOnPage('administrator/index.php?option=com_modules'); + $I->searchForItem($module); + $I->checkAllResults(); + $I->click(['xpath' => "//div[@id='toolbar-publish']/button"]); + $I->waitForText('1 module successfully published.',30,['id' => 'system-message-container']); + } + + /** + * Changes the module Menu assignment to be shown on all the pages of the website + * + * @param string $module The full name of the module + */ + public function displayModuleOnAllPages($module) + { + $I = $this; + $I->amOnPage('administrator/index.php?option=com_modules'); + $I->searchForItem($module); + $I->click(['link' => $module]); + $I->click(['link' => 'Menu Assignment']); + $I->waitForElement(['id' => 'jform_menus-lbl'], 30); + $I->click(['id' => 'jform_assignment_chzn']); + $I->click(['xpath' => "//li[@data-option-array-index='0']"]); + $I->click(['xpath' => "//div[@id='toolbar-apply']/button"]); + $I->waitForText('Module successfully saved',30,['id' => 'system-message-container']); + } }