Skip to content

Commit 833e113

Browse files
authored
Merge pull request #127 from astridx/develop_selenium_update_v3
update selenium_v3.0.1.2
2 parents fcfc9b4 + d196815 commit 833e113

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/JoomlaBrowser.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ public function installJoomla()
153153
$I->debug('I select dk-DK as installation language');
154154

155155
// Select a random language to force reloading of the lang strings after selecting English
156-
$I->selectOptionInChosen('#jform_language', 'Danish (DK)');
157-
$I->waitForText('Generel konfiguration', 60, 'h3');
156+
$I->selectOptionInChosenWithTextField('#jform_language', 'Spanish (Español)');
157+
$I->waitForText('Configuración principal', 60, 'h3');
158158

159159
// Wait for chosen to render the field
160160
$I->debug('I select en-GB as installation language');
161161
$I->debug('Wait for chosen to render the Languages list field');
162162
$I->wait(2);
163-
$I->selectOptionInChosen('#jform_language', 'English (United Kingdom)');
163+
$I->selectOptionInChosenWithTextField('#jform_language', 'English (United Kingdom)');
164164
$I->waitForText('Main Configuration', 60, 'h3');
165165
$this->debug('I fill Site Name');
166166
$I->fillField(['id' => 'jform_site_name'], 'Joomla CMS test');
@@ -309,7 +309,7 @@ public function setErrorReportingToDevelopment()
309309
$this->debug('I wait for error reporting dropdown');
310310
$I->selectOptionInChosen('Error Reporting', 'Development');
311311
$this->debug('I click on save');
312-
$this->clickToolbarButton('save');
312+
$I->click(['xpath' => "//div[@id='toolbar-apply']//button"]);
313313
$this->debug('I wait for global configuration being saved');
314314
$I->waitForText('Global Configuration', 60, ['css' => '.page-title']);
315315
$I->see('Configuration successfully saved.', ['id' => 'system-message-container']);
@@ -461,6 +461,30 @@ public function selectOptionInChosen($label, $option)
461461
$I->wait(1);
462462
}
463463

464+
/**
465+
* Selects an option in a Chosen Selector based on its label with filling the textfield
466+
*
467+
* @param string $label The text in the <label> with for attribute that links to the <select> element
468+
* @param string $option The text in the <option> to be selected in the chosen selector
469+
*
470+
* @return void
471+
*/
472+
public function selectOptionInChosenWithTextField($label, $option)
473+
{
474+
$select = $this->findField($label);
475+
$selectID = $select->getAttribute('id');
476+
$chosenSelectID = $selectID . '_chzn';
477+
$I = $this;
478+
$this->debug("I open the $label chosen selector");
479+
$I->click(['css' => 'div#' . $chosenSelectID]);
480+
$this->debug("I select $option");
481+
$I->fillField(['xpath' => "//div[@id='$chosenSelectID']/div/div/input"], $option);
482+
$I->click(['xpath' => "//div[@id='$chosenSelectID']/div/ul/li[1]"]);
483+
484+
// Gives time to chosen to close
485+
$I->wait(1);
486+
}
487+
464488
/**
465489
* Selects an option in a Chosen Selector based on its id
466490
*

0 commit comments

Comments
 (0)