Skip to content

Commit d3d870a

Browse files
committed
Merge pull request #54 from javigomez/publishmodule2
Publish module feature
2 parents 3139845 + 5b0fecd commit d3d870a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

src/JoomlaBrowser.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,4 +571,55 @@ 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 full name of the module
579+
* @param string $position The template position of a module. Right position by default
580+
*/
581+
public function setModulePosition($module, $position = 'position-7')
582+
{
583+
$I = $this;
584+
$I->amOnPage('administrator/index.php?option=com_modules');
585+
$I->searchForItem($module);
586+
$I->click(['link' => $module]);
587+
$I->selectOptionInChosen('Position', $position);
588+
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
589+
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
590+
}
591+
592+
/**
593+
* Publishes a module on all frontend pages
594+
*
595+
* @param string $module The full name of the module
596+
*/
597+
public function publishModule($module)
598+
{
599+
$I = $this;
600+
$I->amOnPage('administrator/index.php?option=com_modules');
601+
$I->searchForItem($module);
602+
$I->checkAllResults();
603+
$I->click(['xpath' => "//div[@id='toolbar-publish']/button"]);
604+
$I->waitForText('1 module successfully published.',30,['id' => 'system-message-container']);
605+
}
606+
607+
/**
608+
* Changes the module Menu assignment to be shown on all the pages of the website
609+
*
610+
* @param string $module The full name of the module
611+
*/
612+
public function displayModuleOnAllPages($module)
613+
{
614+
$I = $this;
615+
$I->amOnPage('administrator/index.php?option=com_modules');
616+
$I->searchForItem($module);
617+
$I->click(['link' => $module]);
618+
$I->click(['link' => 'Menu Assignment']);
619+
$I->waitForElement(['id' => 'jform_menus-lbl'], 30);
620+
$I->click(['id' => 'jform_assignment_chzn']);
621+
$I->click(['xpath' => "//li[@data-option-array-index='0']"]);
622+
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
623+
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
624+
}
574625
}

0 commit comments

Comments
 (0)