Improve the stability of WebDriver when Selenium server is gone #3534

Merged
merged 24 commits into from Oct 12, 2016

Conversation

Projects
None yet
5 participants
@eXorus
Contributor

eXorus commented Sep 21, 2016

Fix issue #3531

Step to reproduce :

  • Launch Selenium Server
  • Launch Codeception (Acceptance Test)
  • Stop Selenium Server

Each time I stopped server during the $I->wait() and before $I->acceptPopup()
This is all the the fix I need to do to be able to have an Codeception that never exit and that finish all the tests and give the feedback about how many errors ....

Can solved this issue:

  • Failed to connect to localhost port 4446: Connection refused

  • Error forwarding the request 172.17.0.4:5555 failed to respond

  • Session xxx was terminated due to FORWARDING_TO_NODE_FAILED

    Exception Found
    WebDriver.php:xxx
    WebDriver.php:xxx

    Fix x
    method that throw exception => description what it does before fix
    description what it does after fix

    WebDriverCurlException
    WebDriver.php:389
    WebDriver.php:374

    Fix 1
    debugWebDriverLogs => catch only UnknownServerException for IE
    so now catch all exception

    WebDriverCurlException
    WebDriver.php:513
    WebDriver.php:377

    Fix 2
    _saveScreenshot => no catch, bad design
    so now I'm using Exception to trap it

    WebDriverCurlException
    WebDriver.php:537
    WebDriver.php:378

    Fix 3
    _savePageSource => no catch, bad design
    so now I'm using Exception to trap it

    WebDriverCurlException
    WebDriver.php:439
    WebDriver.php:364

    Fix 4
    cleanWebDriver => catch only UnknownServerException
    so now I'm using Exception to trap it

    ConnectionException
    WebDriver.php:308
    WebDriver.php:324

    Fix 5
    _initialize => catch only WebDriverCurlException to throw ConnectionException
    so now I'm replacing to catch all Exception, move the catch at the end and remove new exception

The last fix is not enough good for me:
If I throw ConnectionException, the script exit => bad
If I only print debug line => the test is runned and failed because WebDriver is null ([PHPUnit_Framework_Exception] Undefined property: Codeception\Module\WebDriver::$webDriver)

The best way was to mark the test has skipped but I didn't succeed to call this function in WebDriver module.

src/Codeception/Module/WebDriver.php
- $e->getMessage() . "\n \nPlease make sure that Selenium Server or PhantomJS is running."
- );
+ $this->webDriver->manage()->timeouts()->implicitlyWait($this->config['wait']);
+ $this->initialWindowSize();

This comment has been minimized.

@Naktibalda

Naktibalda Sep 22, 2016

Member

Could you explain these 2 lines?

@Naktibalda

Naktibalda Sep 22, 2016

Member

Could you explain these 2 lines?

This comment has been minimized.

@eXorus

eXorus Sep 23, 2016

Contributor

These 2 lines was already existing but I put them in the try to catch exception from Selenium.

@eXorus

eXorus Sep 23, 2016

Contributor

These 2 lines was already existing but I put them in the try to catch exception from Selenium.

This comment has been minimized.

@Naktibalda

Naktibalda Sep 23, 2016

Member

oh, it is fine then.

@Naktibalda

Naktibalda Sep 23, 2016

Member

oh, it is fine then.

src/Codeception/Module/WebDriver.php
- if ($this->webDriver !== null) {
+ try {
+ if ($this->webDriver === null) {
+ throw new \Exception("WebDriver::_saveScreenshot method has been called when webDriver is not set");

This comment has been minimized.

@Naktibalda

Naktibalda Sep 22, 2016

Member

I am not sure if it is a very good idea to throw exception and catch it immediately,
wouldn't it be better to print some debug output and return?

@Naktibalda

Naktibalda Sep 22, 2016

Member

I am not sure if it is a very good idea to throw exception and catch it immediately,
wouldn't it be better to print some debug output and return?

This comment has been minimized.

@eXorus

eXorus Sep 23, 2016

Contributor

I agree with you but I didn't know how to do that. I don't want to repeat the error.

try {
if ($this->webDriver === null) {
throw new \Exception("WebDriver::_saveScreenshot method has been called when webDriver is not set");
}
$this->webDriver->takeScreenshot($filename);
 } catch (\Exception $e) {
 $this->debug("Unable to retrieve screenshot from Selenium : ".$e->getMessage());
}

or I can do that if you prefer

if ($this->webDriver === null) {
$this->debug("WebDriver::_saveScreenshot method has been called when webDriver is not set");
}

try {
$this->webDriver->takeScreenshot($filename);
 } catch (\Exception $e) {
 $this->debug("Unable to retrieve screenshot from Selenium : ".$e->getMessage());
}
@eXorus

eXorus Sep 23, 2016

Contributor

I agree with you but I didn't know how to do that. I don't want to repeat the error.

try {
if ($this->webDriver === null) {
throw new \Exception("WebDriver::_saveScreenshot method has been called when webDriver is not set");
}
$this->webDriver->takeScreenshot($filename);
 } catch (\Exception $e) {
 $this->debug("Unable to retrieve screenshot from Selenium : ".$e->getMessage());
}

or I can do that if you prefer

if ($this->webDriver === null) {
$this->debug("WebDriver::_saveScreenshot method has been called when webDriver is not set");
}

try {
$this->webDriver->takeScreenshot($filename);
 } catch (\Exception $e) {
 $this->debug("Unable to retrieve screenshot from Selenium : ".$e->getMessage());
}

This comment has been minimized.

@Naktibalda

Naktibalda Sep 23, 2016

Member
if ($this->webDriver === null) {
    $this->debug("WebDriver::_saveScreenshot method has been called when webDriver is not set");
    return;
}
@Naktibalda

Naktibalda Sep 23, 2016

Member
if ($this->webDriver === null) {
    $this->debug("WebDriver::_saveScreenshot method has been called when webDriver is not set");
    return;
}
@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Sep 22, 2016

Member

@eXorus I have added spaces around concatenation operator, please pull before making more changes.

Member

Naktibalda commented Sep 22, 2016

@eXorus I have added spaces around concatenation operator, please pull before making more changes.

@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Sep 23, 2016

Contributor

And could you help me for the skipped test in initialize() ? because for the moment this PR can't be merged.

Contributor

eXorus commented Sep 23, 2016

And could you help me for the skipped test in initialize() ? because for the moment this PR can't be merged.

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Sep 23, 2016

Member

I updated _before method, please test.

Member

Naktibalda commented Sep 23, 2016

I updated _before method, please test.

src/Codeception/Module/WebDriver.php
- ElementLocator,
- ConflictsWithModule,
- RequiresPackage
+WebInterface,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
- ConflictsWithModule,
- RequiresPackage
+WebInterface,
+RemoteInterface,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
- RequiresPackage
+WebInterface,
+RemoteInterface,
+MultiSessionInterface,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+WebInterface,
+RemoteInterface,
+MultiSessionInterface,
+SessionSnapshot,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+RemoteInterface,
+MultiSessionInterface,
+SessionSnapshot,
+ScreenshotSaver,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+MultiSessionInterface,
+SessionSnapshot,
+ScreenshotSaver,
+PageSourceSaver,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+SessionSnapshot,
+ScreenshotSaver,
+PageSourceSaver,
+ElementLocator,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+ScreenshotSaver,
+PageSourceSaver,
+ElementLocator,
+ConflictsWithModule,

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
+PageSourceSaver,
+ElementLocator,
+ConflictsWithModule,
+RequiresPackage

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Expected 4 spaces before interface name; 0 found

src/Codeception/Module/WebDriver.php
@@ -302,15 +302,13 @@ public function _initialize()
$this->requestTimeoutInMs,
$this->httpProxy,
$this->httpProxyPort
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

src/Codeception/Module/WebDriver.php
@@ -340,7 +342,7 @@ protected function loadFirefoxProfile()
throw new ModuleConfigException(
__CLASS__,
"Firefox profile does not exist under given path " . $firefox_profile
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

src/Codeception/Module/WebDriver.php
@@ -391,17 +393,15 @@ public function debugWebDriverLogs()
$logEntries = array_slice(
$this->webDriver->manage()->getLog($logType),
-$this->config['debug_log_entries']
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 16 spaces but found 20

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 16 spaces but found 20

src/Codeception/Module/WebDriver.php
@@ -467,7 +467,7 @@ public function _getUrl()
throw new ModuleConfigException(
__CLASS__,
"Module connection failure. The URL for client can't bre retrieved"
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

src/Codeception/Module/WebDriver.php
@@ -582,7 +589,7 @@ function ($c) {
return $c['name'];
},
$cookies
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -595,7 +602,7 @@ function ($c) {
return $c['name'];
},
$cookies
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -645,7 +652,7 @@ protected function filterCookies($cookies, $params = [])
function ($item) use ($filter, $params) {
return $item[$filter] == $params[$filter];
}
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

src/Codeception/Module/WebDriver.php
@@ -709,7 +716,7 @@ public function seeInPageSource($text)
$this->webDriver->getPageSource(),
new PageConstraint($text, $this->_getCurrentUri()),
''
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -723,7 +730,7 @@ public function dontSeeInPageSource($text)
$this->webDriver->getPageSource(),
new PageConstraint($text, $this->_getCurrentUri()),
''
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -772,7 +779,7 @@ protected function findClickable($page, $link)
".//button[normalize-space(.)=$locator]",
".//a/img[normalize-space(@alt)=$locator]/ancestor::a",
".//input[./@type = 'submit' or ./@type = 'image' or ./@type = 'button'][normalize-space(@value)=$locator]"
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -787,7 +794,7 @@ protected function findClickable($page, $link)
".//button[contains(normalize-space(string(.)), $locator)]",
".//input[./@type = 'submit' or ./@type = 'image' or ./@type = 'button'][./@name = $locator]",
".//button[./@name = $locator]"
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -823,7 +830,7 @@ protected function findFields($selector)
".//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][(((./@name = $locator) or ./@id = //label[contains(normalize-space(string(.)), $locator)]/@for) or ./@placeholder = $locator)]",
".//label[contains(normalize-space(string(.)), $locator)]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]"
// @codingStandardsIgnoreEnd
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
@@ -868,7 +875,7 @@ public function seeLink($text, $url = null)
function (WebDriverElement $e) use ($url) {
return trim($e->getAttribute('href')) == trim($url);
}
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 12 spaces but found 16

src/Codeception/Module/WebDriver.php
@@ -889,7 +896,7 @@ public function dontSeeLink($text, $url = null)
function (WebDriverElement $e) use ($url) {
return trim($e->getAttribute('href')) == trim($url);
}
- );
+ );

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Multi-line function call not indented correctly; expected 8 spaces but found 12

src/Codeception/Module/WebDriver.php
- } else {
- $currentValues[] = $el->getAttribute('value');
- }
+ if ($el->getAttribute('type') === 'radio' || $el->getAttribute('type') === 'checkbox') {

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Line indented incorrectly; expected 20 spaces, found 16

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Line indented incorrectly; expected 20 spaces, found 16

src/Codeception/Module/WebDriver.php
+ $radio = null;
+ foreach ($els as $el) {
+ $radio = $this->findCheckable($el, $option, true);
+ if ($radio) {

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Line indented incorrectly; expected 16 spaces, found 20

@Nitpick-CI

Nitpick-CI Sep 23, 2016

Line indented incorrectly; expected 16 spaces, found 20

eXorus added some commits Sep 23, 2016

Improve initializeSession
initialize and initializeSession are almost the same so I merged them like this initializeSession are also improved
@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Sep 23, 2016

Contributor

It's working well:
The first one failed: [Facebook\WebDriver\Exception\UnknownServerException] cannot forward the request Connect to 172.17.0.6:5555 [/172.17.0.6] failed: Connection refused
And the others are skipped.
Tests: 101, Assertions: 597, Errors: 2, Skipped: 91.

Tests are OK for me

Contributor

eXorus commented Sep 23, 2016

It's working well:
The first one failed: [Facebook\WebDriver\Exception\UnknownServerException] cannot forward the request Connect to 172.17.0.6:5555 [/172.17.0.6] failed: Connection refused
And the others are skipped.
Tests: 101, Assertions: 597, Errors: 2, Skipped: 91.

Tests are OK for me

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Sep 24, 2016

Member

I think that it would be better to allow _initialize fail hard. Because it usually means that Selenium is not running.

This PR must be approved by @davert.

Member

Naktibalda commented Sep 24, 2016

I think that it would be better to allow _initialize fail hard. Because it usually means that Selenium is not running.

This PR must be approved by @davert.

@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Sep 25, 2016

Contributor

I understand it's a choice to do.
Fail hard or fail for the first and skip the others tests.

Contributor

eXorus commented Sep 25, 2016

I understand it's a choice to do.
Fail hard or fail for the first and skip the others tests.

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Sep 29, 2016

Member

Thanks.
I made a few tries and I think this can't be done in current way.
If selenium is not running - all tests are skipped, no errors.

OK, but incomplete, skipped, or risky tests!
Tests: 197, Assertions: 0, Skipped: 197.

This means that the overall result is OK, and no failures in exit code. It's good to skip other tests but at least one test should fail to indicate problem

Member

DavertMik commented Sep 29, 2016

Thanks.
I made a few tries and I think this can't be done in current way.
If selenium is not running - all tests are skipped, no errors.

OK, but incomplete, skipped, or risky tests!
Tests: 197, Assertions: 0, Skipped: 197.

This means that the overall result is OK, and no failures in exit code. It's good to skip other tests but at least one test should fail to indicate problem

@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Sep 30, 2016

Contributor

Sorry I'm not able to do it.
I don't know how to failed $test in the method _before() in the module WebDriver.

Any help ?

Contributor

eXorus commented Sep 30, 2016

Sorry I'm not able to do it.
I don't know how to failed $test in the method _before() in the module WebDriver.

Any help ?

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Sep 30, 2016

Member

I think that we have to introduce new methods setFail and getFail to
Codeception\Test\Metadata, similar to setSkip and setIncomplete.

A handling of failure should be added to IgnoreIfMetadataBlocked feature and Unit format.

Member

Naktibalda commented Sep 30, 2016

I think that we have to introduce new methods setFail and getFail to
Codeception\Test\Metadata, similar to setSkip and setIncomplete.

A handling of failure should be added to IgnoreIfMetadataBlocked feature and Unit format.

@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Sep 30, 2016

Contributor

lol, I just begin to do that before you read ... I will continue

Contributor

eXorus commented Sep 30, 2016

lol, I just begin to do that before you read ... I will continue

src/Codeception/Module/WebDriver.php
+
+ if (!isset($this->webDriver)) {
+ $test->getMetadata()->setFail('WebDriver failed to initialise, please make sure that Selenium Server or PhantomJS is running');
+ }

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

src/Codeception/Module/WebDriver.php
+
+ if (!isset($this->webDriver)) {
+ $test->getMetadata()->setFail('WebDriver failed to initialise, please make sure that Selenium Server or PhantomJS is running');
+ }

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

src/Codeception/Module/WebDriver.php
+
+ if (!isset($this->webDriver)) {
+ $test->getMetadata()->setFail('WebDriver failed to initialise, please make sure that Selenium Server or PhantomJS is running');
+ }

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

src/Codeception/Module/WebDriver.php
+
+ if (!isset($this->webDriver)) {
+ $test->getMetadata()->setFail('WebDriver failed to initialise, please make sure that Selenium Server or PhantomJS is running');
+ }

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

@Nitpick-CI

Nitpick-CI Sep 30, 2016

Whitespace found at end of line

eXorus added some commits Sep 30, 2016

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Oct 7, 2016

Member

@DavertMik it is good now, right?

Member

Naktibalda commented Oct 7, 2016

@DavertMik it is good now, right?

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Oct 10, 2016

Member

@eXorus There are some internal changes which I'd like to avoid.
I see what you are up to but probably I have a better solution. #3598 This will allow us to throw exceptions in _before if it is needed.

Please revert your changes to metadata behavior and merge with my branch (or just copy-paste my code, actually). Then WebDriver._before will be able just to throw exception in case a connection can't be established. $this->fail would be ok

Member

DavertMik commented Oct 10, 2016

@eXorus There are some internal changes which I'd like to avoid.
I see what you are up to but probably I have a better solution. #3598 This will allow us to throw exceptions in _before if it is needed.

Please revert your changes to metadata behavior and merge with my branch (or just copy-paste my code, actually). Then WebDriver._before will be able just to throw exception in case a connection can't be established. $this->fail would be ok

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Oct 11, 2016

Member

Also it should be noted and not forgotten. This breaks AngularJS module. Execute codecept run angular to see output

Member

DavertMik commented Oct 11, 2016

Also it should be noted and not forgotten. This breaks AngularJS module. Execute codecept run angular to see output

eXorus added some commits Oct 11, 2016

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Oct 12, 2016

Member

Thanks! That was a long story but finally it is ready to be merged 👍

Member

DavertMik commented Oct 12, 2016

Thanks! That was a long story but finally it is ready to be merged 👍

@DavertMik DavertMik merged commit 40a9c88 into Codeception:2.2 Oct 12, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
@eXorus

This comment has been minimized.

Show comment
Hide comment
@eXorus

eXorus Oct 12, 2016

Contributor

Thanks for your help @DavertMik and @Naktibalda
Each day I learn more about Codeception :)

Contributor

eXorus commented Oct 12, 2016

Thanks for your help @DavertMik and @Naktibalda
Each day I learn more about Codeception :)

chris1312 added a commit to chris1312/Codeception that referenced this pull request Jun 16, 2017

Improve the stability of WebDriver when Selenium server is gone (#3534)
* Improve debugWebDriverLogs

* Improve _saveScreenshot

* Improve _savePageSource

* Improve cleanWebDriver

* Improve _initialize

* Improve _saveScreenshot when webDriver is null

* Fix Inline control structures are not allowed

* Update WebDriver.php

* Added spaces around concatenation operator

* Skip test if WebDriver failed to initialize

* Update _saveScreenshot

* Update WebDriver.php

* Improve initializeSession

initialize and initializeSession are almost the same so I merged them like this initializeSession are also improved

* Update WebDriver.php

* Update Metadata.php

* Update IgnoreIfMetadataBlocked.php

* Update Unit.php

* Update WebDriver.php

* Update WebDriver.php

* Remove metadata

* Reset changes

* Reset changes

* Reset changes

* Catch errors in _before for not to crash and continue test execution

Implement  #3598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment