Тест транспортира - не удается прочитать свойство 'getProcessedConfig' из неопределенного
Я пытаюсь сгенерировать скриншоты, используя пакет 'jasmine2-protractor-utils' в файле config.ts. Однако, когда я запускаю свой config.js, он выводит на консоль сообщение об ошибке, в котором говорится "Cannot read property" getProcessedConfig "undefined", но все мои тесты в спецификации прошли успешно, но скриншоты не создавались. Любая помощь будет принята с благодарностью. Заранее спасибо!
Ниже мой файл config.ts:
import { Config, browser } from 'protractor';
export let config: Config = {
framework: 'jasmine2',
capabilities: {
browserName: 'chrome',
chromeOptions: {
prefs: {
download: {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': './dist/out-tsc/e2e/downloads',
}
}
}
},
jasmineNodeOpts: {
defaultTimeoutInterval: 2500000
},
plugins: [{
package: 'jasmine2-protractor-utils',
disableHTMLReport: false,
disableScreenshot: false,
screenshotPath: './reports/screenshots',
screenshotOnExpectFailure: 'failure+success',
screenshotOnSpecFailure: true,
clearFoldersBeforeTest: true,
htmlReportDir: './reports/htmlReports',
failTestOnErrorLog: {
failTestOnErrorLogLevel: 900,
excludeKeywords: ['keyword1', 'keyword2']
}
}],
onPrepare: function () {
browser.ignoreSynchronization = true;
browser.manage().window().setSize(1600, 1600);
browser.manage().window().maximize();
const jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'testresults',
filePrefix: 'xmloutput'
}));
return browser.getProcessedConfig().then(function (config) {
});
},
onComplete: function () {
var browserName, browserVersion;
var capsPromise = browser.getCapabilities();
capsPromise.then(function (caps) {
browserName = caps.get('browserName');
browserVersion = caps.get('version');
var HTMLReport = require('protractor-html-reporter');
const testConfig = {
reportTitle: 'Test Execution Report',
outputPath: './reports/htmlReports',
screenshotPath: './reports/screenshots',
testBrowser: browserName,
browserVersion: browserVersion,
modifiedSuiteName: false,
screenshotsOnlyOnFailure: true
};
new HTMLReport().from('./testresults/xmloutput.xml', testConfig);
});
},
specs: ['./tests/viewOfferings.js'],
seleniumAddress: 'http://localhost:4444/wd/hub',
noGlobals: true
};
Ниже ошибка напечатана на консоли:
[23:34:28] I/plugins - Fail: jasmine2-protractor-utils Plugin Tests
[23:34:28] E/plugins - Failure during setup: Cannot read property 'getProcessedConfig' of undefined
[23:34:28] E/plugins - TypeError: Cannot read property 'getProcessedConfig' of undefined
at Function.protractorUtil.takeScreenshotOnExpectFail (/usr/local/lib/node_modules/jasmine2-protractor-utils/index.js:44:30)
at protractorUtil.setup (/usr/local/lib/node_modules/jasmine2-protractor-utils/index.js:320:24)
at resolver (/usr/local/lib/node_modules/protractor/lib/plugins.ts:471:52)
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
at Plugins.safeCallPluginFun (/usr/local/lib/node_modules/protractor/lib/plugins.ts:482:16)
at promises.pluginObjs.filter.map.pluginObj (/usr/local/lib/node_modules/protractor/lib/plugins.ts:510:28)
at Array.map (native)
at Plugins.setup (/usr/local/lib/node_modules/protractor/lib/plugins.ts:508:16)
at q.then.then.then (/usr/local/lib/node_modules/protractor/lib/runner.ts:407:26)
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
[23:34:29] I/plugins - Fail: jasmine2-protractor-utils Runtime
[23:34:29] E/plugins - Failure during postResults: Cannot read property 'getProcessedConfig' of undefined
[23:34:29] E/plugins - TypeError: Cannot read property 'getProcessedConfig' of undefined
at protractorUtil.postResults (/usr/local/lib/node_modules/jasmine2-protractor-utils/index.js:340:26)
at resolver (/usr/local/lib/node_modules/protractor/lib/plugins.ts:471:52)
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
at Plugins.safeCallPluginFun (/usr/local/lib/node_modules/protractor/lib/plugins.ts:482:16)
at promises.pluginObjs.filter.map.pluginObj (/usr/local/lib/node_modules/protractor/lib/plugins.ts:510:28)
at Array.map (native)
at Plugins.postResults (/usr/local/lib/node_modules/protractor/lib/plugins.ts:508:16)
at q.then.then.then.then.then.then.then.then (/usr/local/lib/node_modules/protractor/lib/runner.ts:488:26)
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
[23:34:29] I/launcher - 0 instance(s) of WebDriver still running
[23:34:29] I/launcher - chrome #01 failed 1 test(s)
[23:34:29] I/launcher - overall: 1 failed spec(s)
[23:34:29] E/launcher - Process exited with error code 1