-
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 #54 from aik099/session-sharing-isnt-working
Session sharing not working
- Loading branch information
Showing
9 changed files
with
215 additions
and
55 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
48 changes: 48 additions & 0 deletions
48
tests/aik099/PHPUnit/Integration/IsolatedSessionStrategyTest.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,48 @@ | ||
<?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 tests\aik099\PHPUnit\Integration; | ||
|
||
|
||
class IsolatedSessionStrategyTest extends SauceLabsAwareTestCase | ||
{ | ||
|
||
/** | ||
* Browser list to be used in tests. | ||
* | ||
* @var array | ||
*/ | ||
public static $browsers = array( | ||
array( | ||
'alias' => 'saucelabs', | ||
'sessionStrategy' => 'isolated', | ||
), | ||
); | ||
|
||
public function testOne() | ||
{ | ||
$session = $this->getSession(); | ||
$session->visit('https://www.google.com'); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @depends testOne | ||
*/ | ||
public function testTwo() | ||
{ | ||
$session = $this->getSession(); | ||
$url = $session->getCurrentUrl(); | ||
|
||
$this->assertNotContains('https://www.google.com', $url); | ||
} | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
tests/aik099/PHPUnit/Integration/SauceLabsAwareTestCase.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,76 @@ | ||
<?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 tests\aik099\PHPUnit\Integration; | ||
|
||
|
||
use aik099\PHPUnit\BrowserTestCase; | ||
|
||
abstract class SauceLabsAwareTestCase extends BrowserTestCase | ||
{ | ||
|
||
/** | ||
* Browser list to be used in tests. | ||
* | ||
* @var array | ||
*/ | ||
public static $browsers = array( | ||
array('alias' => 'saucelabs'), | ||
); | ||
|
||
/** | ||
* Set session meta-info for "Sauce Labs". | ||
* | ||
* @return void | ||
*/ | ||
protected function setUp() | ||
{ | ||
if ( !getenv('SAUCE_USERNAME') || !getenv('SAUCE_ACCESS_KEY') ) { | ||
$this->markTestSkipped('SauceLabs integration is not configured'); | ||
} | ||
|
||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* Whatever or not code coverage information should be gathered. | ||
* | ||
* @return boolean | ||
* @throws \RuntimeException When used before test is started. | ||
*/ | ||
public function getCollectCodeCoverageInformation() | ||
{ | ||
// FIXME: Workaround for https://github.com/minkphp/phpunit-mink/issues/35 bug. | ||
return false; | ||
} | ||
|
||
/** | ||
* Gets browser configuration aliases. | ||
* | ||
* Allows to decouple actual test server connection details from test cases. | ||
* | ||
* @return array | ||
*/ | ||
public function getBrowserAliases() | ||
{ | ||
return array( | ||
'saucelabs' => array( | ||
'type' => 'saucelabs', | ||
'apiUsername' => getenv('SAUCE_USERNAME'), | ||
'apiKey' => getenv('SAUCE_ACCESS_KEY'), | ||
|
||
'browserName' => 'chrome', | ||
'desiredCapabilities' => array('version' => 28), | ||
'baseUrl' => 'http://www.google.com', | ||
), | ||
); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
tests/aik099/PHPUnit/Integration/SharedSessionStrategyTest.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,48 @@ | ||
<?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 tests\aik099\PHPUnit\Integration; | ||
|
||
|
||
class SharedSessionStrategyTest extends SauceLabsAwareTestCase | ||
{ | ||
|
||
/** | ||
* Browser list to be used in tests. | ||
* | ||
* @var array | ||
*/ | ||
public static $browsers = array( | ||
array( | ||
'alias' => 'saucelabs', | ||
'sessionStrategy' => 'shared', | ||
), | ||
); | ||
|
||
public function testOne() | ||
{ | ||
$session = $this->getSession(); | ||
$session->visit('https://www.google.com'); | ||
|
||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @depends testOne | ||
*/ | ||
public function testTwo() | ||
{ | ||
$session = $this->getSession(); | ||
$url = $session->getCurrentUrl(); | ||
|
||
$this->assertContains('https://www.google.com', $url); | ||
} | ||
|
||
} |
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