Jasmine/Protractor reporters work in Electron, but Jasmine2HtmlReporter reporter does not
corvinrok opened this issue · 0 comments
Protractor's configuration allows you to set an executable as the binary, as in:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['./Test Cases/app/test_suite.js'],
capabilities: {
browserName: 'chrome',
count: 1,
chromeOptions: {
binary: 'C:/Program Files (x86)/Software Company/AppDir/MyApp.exe'
},
useAllAngular2AppRoots: true,
onPrepare: function () {
browser.resetUrl = 'file://';
}
},
Since Electron is essentially a frame around a Chrome embedded browser, this means that you can run protractor tests against any properly built Electron app. In my case, I have utilized the JUnitXmlReporter
and all works well, being configured as follows inside of the same exports.config
definition shown above :
framework: 'jasmine2',
onPrepare: function() {
var config = require('./gulp.config')();
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: config.ci,
filePrefix: 'protractor-tests.xml'
}));
This works fine, as do others such as the TerminalReporter
included with the standard set, and individual reporters such as the jasmine2-reporter
.
Seeing the Jasmine reporter extensibility seemed to be compatible, I implemented the Jasmine2HtmlReporter
as follows:
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: config.ci,
filePrefix: 'protractor-htmlReport',
fileNameDateSuffix: true
})
);
However, it appears the screenshot method within the reporter is failing within that CEB. Here is the spewed error:
[09:56:13] E/launcher - unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: content shell=)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.11 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'xxxxxxxxxxxxxxxxx', ip: 'xx.xx.xx.xx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Us
ers\myUserName\AppData\Local\Temp\scoped_dir6272_1573}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=, platform=XP, browserConnectionEnabled=false, nat
iveEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 318c11ce92d6b682ce911fda200bd6a4
[09:56:13] E/launcher - WebDriverError: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: content shell=)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.11 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'xxxxxxxxxxxxxx', ip: 'xx.xx.xx.xx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Us
ers\myUserName\AppData\Local\Temp\scoped_dir6272_1573}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=, platform=XP, browserConnectionEnabled=false, nat
iveEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 318c11ce92d6b682ce911fda200bd6a4
at Object.checkLegacyResponse (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:505:15)
at parseHttpResponse (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.takeScreenshot()
at thenableWebDriverProxy.schedule (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:816:17)
at thenableWebDriverProxy.takeScreenshot (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:1092:17)
at ProtractorBrowser.to.(anonymous function) [as takeScreenshot] (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\lib\browser.ts:94:25)
at Jasmine2HTMLReporter.self.specDone (C:\git\test-batch-designer\node_modules\protractor-jasmine2-html-reporter\index.js:203:21)
at dispatch (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1966:28)
at ReportDispatcher.specDone (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1949:11)
at Spec.specResultCallback [as resultCallback] (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:903:18)
at complete (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:368:12)
at QueueRunner.clearStack (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:660:9)
at QueueRunner.run (C:\Users\myUserName\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1881:12)
[09:56:13] E/launcher - Process exited with error code 199
npm ERR! Test failed. See above for more details.