Skip to content

Commit 18e9733

Browse files
committed
Adding a new Function to increase readability.
1 parent 3cfe403 commit 18e9733

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/JoomlaBrowser.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,60 @@ public function displayModuleOnAllPages($module)
671671
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
672672
}
673673

674+
/**
675+
* Function to select Toolbar buttons in Joomla! Admin Toolbar Panel
676+
*
677+
* @param string $button The full name of the button
678+
*/
679+
public function clickToolbarButton($button)
680+
{
681+
$I = $this;
682+
$input = strtolower($button);
683+
684+
switch($input)
685+
{
686+
case "new":
687+
$I->click(['xpath' => "//div[@id='toolbar-new']//button"]);
688+
break;
689+
case "edit":
690+
$I->click(['xpath' => "//div[@id='toolbar-edit']//button"]);
691+
break;
692+
case "publish":
693+
$I->click(['xpath' => "//div[@id='toolbar-publish']//button"]);
694+
break;
695+
case "unpublish":
696+
$I->click(['xpath' => "//div[@id='toolbar-unpublish']//button"]);
697+
break;
698+
case "archive":
699+
$I->click(['xpath' => "//div[@id='toolbar-archive']//button"]);
700+
break;
701+
case "check-in":
702+
$I->click(['xpath' => "//div[@id='toolbar-checkin']//button"]);
703+
break;
704+
case "batch":
705+
$I->click(['xpath' => "//div[@id='toolbar-batch']//button"]);
706+
break;
707+
case "rebuild":
708+
$I->click(['xpath' => "//div[@id='toolbar-refresh']//button"]);
709+
break;
710+
case "trash":
711+
$I->click(['xpath' => "//div[@id='toolbar-trash']//button"]);
712+
break;
713+
case "save":
714+
$I->click(['xpath' => "//div[@id='toolbar-apply']//button"]);
715+
break;
716+
case "save & close":
717+
$I->click(['xpath' => "//div[@id='toolbar-save']//button"]);
718+
break;
719+
case "save & new":
720+
$I->click(['xpath' => "//div[@id='toolbar-save-new']//button"]);
721+
break;
722+
case "cancel":
723+
$I->click(['xpath' => "//div[@id='toolbar-cancel']//button"]);
724+
break;
725+
}
726+
}
727+
674728
/**
675729
* Creates a menu item with the Joomla menu manager, only working for menu items without additional required fields
676730
*

0 commit comments

Comments
 (0)