Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: Subclass Facebook web driver to LimeSurveyWebDriver
- Loading branch information
1 parent
004e4fa
commit f94d21d
Showing
4 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace ls\tests; | ||
|
||
use Facebook\WebDriver\Remote\RemoteWebDriver; | ||
use Facebook\WebDriver\WebDriverBy; | ||
|
||
/** | ||
* Subclass of Facebook webdriver. | ||
* This class contains helper methods to interact with a LimeSurvey | ||
* survey, like filling in questions, going to next question group, | ||
* changing language etc. | ||
*/ | ||
class LimeSurveyWebDriver extends RemoteWebDriver | ||
{ | ||
/** | ||
* @param string $newLang Like 'de' or 'en'. | ||
* @return void | ||
*/ | ||
public function changeLanguage($newLang) | ||
{ | ||
$langSelectOption = $this->findElement( | ||
WebDriverBy::cssSelector( | ||
sprintf( | ||
'#langchangerSelectMain option[value="%s"]', | ||
$newLang | ||
) | ||
) | ||
); | ||
$langSelectOption->click(); | ||
} | ||
|
||
/** | ||
* Go to next question/question group. | ||
* @return void | ||
*/ | ||
public function next() | ||
{ | ||
$nextButton = $this->findElement(WebDriverBy::id('ls-button-submit')); | ||
$nextButton->click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters