-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from aik099/webdriver-classic-support
Added support for WebdriverClassicDriver Mink's Driver
- Loading branch information
Showing
7 changed files
with
93 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
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
74 changes: 74 additions & 0 deletions
74
library/aik099/PHPUnit/MinkDriver/WebdriverClassicFactory.php
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,74 @@ | ||
<?php | ||
/** | ||
* This file is part of the phpunit-mink library. | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
* | ||
* @copyright Alexander Obuhovich <[email protected]> | ||
* @link https://github.com/aik099/phpunit-mink | ||
*/ | ||
|
||
|
||
namespace aik099\PHPUnit\MinkDriver; | ||
|
||
|
||
use aik099\PHPUnit\BrowserConfiguration\BrowserConfiguration; | ||
|
||
class WebdriverClassicFactory extends AbstractDriverFactory | ||
{ | ||
|
||
/** | ||
* Returns driver name, that can be used in browser configuration. | ||
* | ||
* @return string | ||
*/ | ||
public function getDriverName() | ||
{ | ||
return 'webdriver-classic'; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getDriverPackageUrl() | ||
{ | ||
return 'https://packagist.org/packages/mink/webdriver-classic-driver'; | ||
} | ||
|
||
/** | ||
* Returns default values for browser configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function getDriverDefaults() | ||
{ | ||
return array( | ||
'port' => 4444, | ||
'driverOptions' => array(), | ||
); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function createDriver(BrowserConfiguration $browser) | ||
{ | ||
$this->assertInstalled('Mink\WebdriverClassicDriver\WebdriverClassicDriver'); | ||
|
||
$browser_name = $browser->getBrowserName(); | ||
$capabilities = $browser->getDesiredCapabilities(); | ||
$capabilities['browserName'] = $browser_name; | ||
|
||
// TODO: Maybe doesn't work! | ||
ini_set('default_socket_timeout', $browser->getTimeout()); | ||
|
||
$driver = new \Mink\WebdriverClassicDriver\WebdriverClassicDriver( | ||
$browser_name, | ||
$capabilities, | ||
'http://' . $browser->getHost() . ':' . $browser->getPort() . '/wd/hub' | ||
); | ||
|
||
return $driver; | ||
} | ||
|
||
} |
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