Skip to content

Commit bafb00e

Browse files
committed
Merge pull request #82 from puneet0191/Resolution
Adding a tool bar logic for smaller screen resolutions
2 parents 75c5cfc + 6bbe8ab commit bafb00e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/JoomlaBrowser.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public function setErrorReportingToDevelopment()
290290
$this->debug('I wait for error reporting dropdown');
291291
$I->selectOptionInChosen('Error Reporting', 'Development');
292292
$this->debug('I click on save');
293-
$I->click(['xpath' => "//button[@onclick=\"Joomla.submitbutton('config.save.application.apply')\"]"]);
293+
$I->clickToolbarButton('save');
294294
$this->debug('I wait for global configuration being saved');
295295
$I->waitForText('Global Configuration',60,['css' => '.page-title']);
296296
$I->see('Configuration successfully saved.',['id' => 'system-message-container']);
@@ -505,7 +505,7 @@ public function enablePlugin($pluginName)
505505
$I->waitForElement($this->searchResultPluginName($pluginName), 30);
506506
$I->checkExistenceOf($pluginName);
507507
$I->click(['xpath' => "//input[@id='cb0']"]);
508-
$I->click(['xpath' => "//div[@id='toolbar-publish']/button"]);
508+
$I->clickToolbarButton('publish');
509509
$I->see('successfully enabled', ['id' => 'system-message-container']);
510510
}
511511

@@ -653,7 +653,7 @@ public function setModulePosition($module, $position = 'position-7')
653653
$I->click(['link' => $module]);
654654
$I->waitForText($module, 30, ['css' => 'H3']);
655655
$I->selectOptionInChosen('Position', $position);
656-
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
656+
$I->clickToolbarButton('save');
657657
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
658658
}
659659

@@ -668,7 +668,7 @@ public function publishModule($module)
668668
$I->amOnPage('administrator/index.php?option=com_modules');
669669
$I->searchForItem($module);
670670
$I->checkAllResults();
671-
$I->click(['xpath' => "//div[@id='toolbar-publish']/button"]);
671+
$I->clickToolbarButton('publish');
672672
$I->waitForText('1 module successfully published.',30,['id' => 'system-message-container']);
673673
}
674674

@@ -688,7 +688,7 @@ public function displayModuleOnAllPages($module)
688688
$I->waitForElement(['id' => 'jform_menus-lbl'], 30);
689689
$I->click(['id' => 'jform_assignment_chzn']);
690690
$I->click(['xpath' => "//li[@data-option-array-index='0']"]);
691-
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
691+
$I->clickToolbarButton('save');
692692
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
693693
}
694694

@@ -702,6 +702,11 @@ public function clickToolbarButton($button)
702702
$I = $this;
703703
$input = strtolower($button);
704704

705+
$element = $this->webDriver->findElements(WebDriverBy::linkText("Toolbar"));
706+
if(!empty($element) && $element[0]->isDisplayed())
707+
{
708+
$I->click('Toolbar');
709+
}
705710
switch($input)
706711
{
707712
case "new":
@@ -776,7 +781,7 @@ public function createMenuItem($menuTitle, $menuCategory, $menuItem, $menu = 'Ma
776781
$this->checkForPhpNoticesOrWarnings();
777782

778783
$I->debug("I click new");
779-
$I->click("New");
784+
$I->clickToolbarButton('new');
780785
$I->waitForText('Menus: New Item', '60', ['css' => 'h1']);
781786
$this->checkForPhpNoticesOrWarnings();
782787
$I->fillField(['id' => 'jform_title'], $menuTitle);
@@ -803,7 +808,7 @@ public function createMenuItem($menuTitle, $menuCategory, $menuItem, $menu = 'Ma
803808
$I->selectOptionInChosen('Language', $language);
804809
$I->waitForText('Menus: New Item','30', ['css' => 'h1']);
805810
$I->debug('I save the menu');
806-
$I->click("Save");
811+
$I->clickToolbarButton('save');
807812

808813
$I->waitForText('Menu item successfully saved', '60', ['id' => 'system-message-container']);
809814
}

0 commit comments

Comments
 (0)