@@ -86,11 +86,8 @@ public function installJoomla()
8686 $ this ->debug ('I wait for Main Configuration ' );
8787 $ I ->waitForText ('Main Configuration ' , 10 ,['xpath ' => '//h3 ' ]);
8888
89- $ this ->debug ('I click Language Selector ' );
90- $ I ->click (['xpath ' => "//div[@id='jform_language_chzn']/a " ]); // Language Selector
91- $ this ->debug ('I select en-GB ' );
92- $ I ->click (['xpath ' => "//li[text()='English (United Kingdom)'] " ]); // English (United Kingdom)
93- $ I ->wait (1 );
89+ $ I ->debug ('I select en-GB as installation language ' );
90+ $ I ->selectOptionInChosen ('Select Language ' , 'English (United Kingdom) ' );
9491 $ this ->debug ('I fill Site Name ' );
9592 $ I ->fillField (['id ' => 'jform_site_name ' ], 'Joomla CMS test ' );
9693 $ this ->debug ('I fill Site Description ' );
@@ -165,12 +162,7 @@ public function setErrorReportingToDevelopment()
165162 $ this ->debug ('I open the Server Tab ' );
166163 $ I ->click (['link ' => 'Server ' ]);
167164 $ this ->debug ('I wait for error reporting dropdown ' );
168- $ I ->waitForElementVisible (['xpath ' => "//div[@id='jform_error_reporting_chzn']/a " ]); // Error reporting Dropdown
169- $ this ->debug ('I click on error reporting dropdown ' );
170- $ I ->click (['xpath ' => "//div[@id='jform_error_reporting_chzn']/a " ]);
171- $ this ->debug ('I click on development option ' );
172- $ I ->click (['xpath ' => "//div[@id='jform_error_reporting_chzn']/div/ul/li[contains(text(), 'Development')] " ]); // Development
173- $ I ->wait (1 );
165+ $ I ->selectOptionInChosen ('Error Reporting ' , 'Development ' );
174166 $ this ->debug ('I click on save ' );
175167 $ I ->click (['xpath ' => "//button[@onclick= \"Joomla.submitbutton('config.save.application.apply') \"] " ]);
176168 $ this ->debug ('I wait for global configuration being saved ' );
@@ -195,6 +187,7 @@ public function installExtensionFromDirectory($path)
195187 // @todo: we need to find a better locator for the following Install button
196188 $ I ->click (['xpath ' => "//input[contains(@onclick,'Joomla.submitbutton3()')] " ]); // Install button
197189 $ I ->waitForText ('was successful ' , 10 , ['id ' => 'system-message-container ' ]);
190+ $ this ->debug ('Extension successfully installed from ' . $ path );
198191 }
199192
200193 /**
@@ -216,4 +209,22 @@ public function checkForPhpNoticesOrWarnings($page = null)
216209 $ I ->dontSeeInPageSource ('Notice: ' );
217210 $ I ->dontSeeInPageSource ('Warning: ' );
218211 }
212+
213+ /**
214+ * Selects an option in a Chosen Selector based on its label
215+ *
216+ * @return void
217+ */
218+ public function selectOptionInChosen ($ label , $ option )
219+ {
220+ $ select = $ this ->findField ($ label );
221+ $ selectID = $ select ->getAttribute ('id ' );
222+ $ chosenSelectID = $ selectID . '_chzn ' ;
223+ $ I = $ this ;
224+ $ this ->debug ("I open the $ label chosen selector " );
225+ $ I ->click (['xpath ' => "//div[@id=' $ chosenSelectID']/a/div/b " ]);
226+ $ this ->debug ("I select $ option " );
227+ $ I ->click (['xpath ' => "//div[@id=' $ chosenSelectID']//li[text()=' $ option'] " ]);
228+ $ I ->wait (1 ); // Gives time to chosen to close
229+ }
219230}
0 commit comments