Skip to content

Commit 77fe304

Browse files
committed
Add Publish module on all Pages function
1 parent 3139845 commit 77fe304

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/JoomlaBrowser.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,4 +571,28 @@ private function searchResultLanguageName($languageName)
571571

572572
return $xpath;
573573
}
574+
575+
/**
576+
* Publishes a module on all frontend pages
577+
*
578+
* @param string $module The name of the module
579+
* @param string $position The template position where to publish the module. Right position by default
580+
*/
581+
public function publishModuleOnAllPages($module, $position = 'position-7')
582+
{
583+
$I = $this;
584+
$I->amOnPage('administrator/index.php?option=com_modules');
585+
$I->searchForItem($module);
586+
$I->checkAllResults();
587+
$I->click(['xpath' => "//div[@id='toolbar-publish']/button"]);
588+
$I->waitForText('1 module successfully published.',30,['id' => 'system-message-container']);
589+
$I->click(['link' => $module]);
590+
$I->selectOptionInChosen('Position', $position);
591+
$I->click(['link' => 'Menu Assignment']);
592+
$I->waitForElement(['id' => 'jform_menus-lbl'], 30);
593+
$I->click(['id' => 'jform_assignment_chzn']);
594+
$I->click(['xpath' => "//li[@data-option-array-index='0']"]);
595+
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
596+
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
597+
}
574598
}

0 commit comments

Comments
 (0)