@@ -722,6 +722,9 @@ public function clickToolbarButton($button)
722722 case "cancel " :
723723 $ I ->click (['xpath ' => "//div[@id='toolbar-cancel']//button " ]);
724724 break ;
725+ case "empty trash " :
726+ $ I ->click (['xpath ' => "//div[@id='toolbar-delete']//button " ]);
727+ break ;
725728 }
726729 }
727730
@@ -780,4 +783,37 @@ public function createMenuItem($menuTitle, $menuCategory, $menuItem, $menu = 'Ma
780783
781784 $ I ->waitForText ('Menu item successfully saved ' , '60 ' , ['id ' => 'system-message-container ' ]);
782785 }
786+
787+ /**
788+ * Function to filter results in Joomla! Administrator.
789+ *
790+ * @param string $label Label of the Filter you want to use.
791+ * @param string $value Value you want to set in the filters.
792+ *
793+ * @return void
794+ */
795+ public function setFilter ($ label , $ value )
796+ {
797+ $ label = strtolower ($ label );
798+ $ filters = array (
799+ "select status " => "filter_published " ,
800+ "select access " => "filter_access " ,
801+ "select language " => "filter_language " ,
802+ "select tag " => "filter_tag " ,
803+ "select max levels " => "filter_level "
804+ );
805+ $ I = $ this ;
806+ $ I ->click (['xpath ' => "//button[@data-original-title='Filter the list items.'] " ]);
807+ $ I ->debug ('I try to select the filters ' );
808+ foreach ($ filters as $ fieldName => $ id )
809+ {
810+ if ($ fieldName == $ label )
811+ {
812+ $ I ->waitForElement (['xpath ' => "//div[@id=' " . $ id . "_chzn']/a " ], 10 );
813+ $ I ->click (['xpath ' => "//div[@id=' " . $ id . "_chzn']/a " ]);
814+ $ I ->click (['xpath ' => "//div[@id=' " . $ id . "_chzn']//ul[@class='chzn-results']/li[contains(.,' " . $ value . "')] " ]);
815+ }
816+ }
817+ $ I ->debug ('Applied filters ' );
818+ }
783819}
0 commit comments