Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If taking screenshot fails because of driver issues, test is not included in BDD report #1108

Closed
kutzi opened this issue Feb 6, 2018 · 3 comments

Comments

@kutzi
Copy link
Contributor

kutzi commented Feb 6, 2018

Occassionally we have chrome driver issues when trying to take a screenshot after a failed test. E.g.

11:57:24   (Session info: chrome=63.0.3239.132)
11:57:24   (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.4.105-1.el7.elrepo.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
11:57:24 Command duration or timeout: 0 milliseconds
11:57:24 Build info: version: '3.9.0', revision: '698b3178f0', time: '2018-02-05T14:26:55.441Z'
11:57:24 System info: host: 'xxx', ip: 'xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.105-1.el7.elrepo.x86_64', java.version: '1.8.0_151'
11:57:24 Driver info: org.openqa.selenium.chrome.ChromeDriver
11:57:24 Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.34.522913 (36222509aa6e81..., userDataDir: /tmp/.org.chromium.Chromium...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: accept, unhandledPromptBehavior: accept, version: 63.0.3239.132, webStorageEnabled: true}
11:57:24 Session ID: 00c6489474f6c2a75c122b346063432c
11:57:24 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
11:57:24 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
11:57:24 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
11:57:24 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
11:57:24 	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
11:57:24 	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
11:57:24 	at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
11:57:24 	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
11:57:24 	at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
11:57:24 	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160)
11:57:24 	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
11:57:24 	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
11:57:24 	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
11:57:24 	at org.openqa.selenium.remote.RemoteWebDriver.getPageSource(RemoteWebDriver.java:483)
11:57:24 	at net.serenitybdd.core.photography.PageSourceRecorder.getPageSource(PageSourceRecorder.java:40)
11:57:24 	at net.serenitybdd.core.photography.PageSourceRecorder.intoDirectory(PageSourceRecorder.java:26)
11:57:24 	at net.thucydides.core.steps.BaseStepListener.grabScreenshot(BaseStepListener.java:864)
11:57:24 	at net.thucydides.core.steps.BaseStepListener.take(BaseStepListener.java:765)
11:57:24 	at net.thucydides.core.steps.BaseStepListener.takeEndOfStepScreenshotFor(BaseStepListener.java:746)
11:57:24 	at net.thucydides.core.steps.BaseStepListener.stepFailed(BaseStepListener.java:658)
11:57:24 	at net.thucydides.core.steps.StepEventBus.stepFailed(StepEventBus.java:380)
11:57:24 	at cucumber.runtime.formatter.SerenityReporter.failed(SerenityReporter.java:769)
11:57:24 	at cucumber.runtime.formatter.SerenityReporter.recordStepResult(SerenityReporter.java:722)
11:57:24 	at cucumber.runtime.formatter.SerenityReporter.handleResult(SerenityReporter.java:712)
11:57:24 	at cucumber.runtime.formatter.SerenityReporter.handleTestStepFinished(SerenityReporter.java:280)```

The chrome driver issue is one thing, but at least the test should be included into the report even if taking the screenshot fails
kutzi added a commit to Lotto24/serenity-core that referenced this issue Feb 6, 2018
@kutzi
Copy link
Contributor Author

kutzi commented Feb 6, 2018

As far as I can see, this could be fixed by catching exceptions in PhotoSession.
See #1109

wakaleo added a commit that referenced this issue Feb 6, 2018
Catch exceptions while taking a screenshot (#1108)
@wakaleo
Copy link
Member

wakaleo commented Feb 8, 2018

Should be fixed in the next release

@wakaleo
Copy link
Member

wakaleo commented Mar 3, 2018

Fixed in 1.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants