Closed BorisOsipov closed 5 years ago
@igerasimov23 the error appears because rp reporter isn't initialized properly cuz it is not enabled. Do you agree that I need check it in reporter.waitLaunchFinished()
to avoid this?
btw I believe error doesn't appear if you will use https://github.com/BorisOsipov/wdio-reportportal-service
I was trying to use initially https://github.com/BorisOsipov/wdio-reportportal-service but RP never finished active sessions for me. I added as you showed in docs:
const RpService = require("wdio-reportportal-service"); //how much time will wait till launch finishes. default 5000 ms const rpService = new RpService(5000);
and services: [rpService]
Am I missing here something?
@igerasimov23 the error appears because rp reporter isn't initialized properly cuz it is not enabled. Do you agree that I need check it in
reporter.waitLaunchFinished()
to avoid this?
This error looks like appears only in new method reporter.waitLaunchFinished()
. as it works fine with old methods such as reporter.sendLogToTest(test, 'info', passMsg)
when 'reportportal' disabled in wdio conf
I was trying to use initially BorisOsipov/wdio-reportportal-service but RP never finished active sessions for me.
I've tested this on my projects and it works fine. I will have a look deeper to find why the issue appears. One question, doesn't you interrupt tests by ctrl+c
? In such a case launch isn't finish in any way AFAIK and waiting is useless(it is another thing to improve as I think)
Also your wdio config will help to test it, please share if you can. Thanks in advance.
I don't interrupt suite during execution. I used following config and rpService does not complete suite:
const util = require('./utils');
const globals = require('./globals');
const reporter = require('wdio-reportportal-reporter');
const RpService = require("wdio-reportportal-service");
//how much time will wait till launch finishes. default 5000 ms
const rpService = new RpService(10000);
const chai = require('chai');
const assertArrays = require('chai-arrays');
const assertions = require('./customCommands/assertions');
exports.config = {
host: util.setHost(),
port: 4444,
path: '/wd/hub',
sync: true,
//
// Level of logging verbosity: silent | verbose | command | data | result | error
logLevel: 'data',
//
// Enables colors for log output.
coloredLogs: true,
//
// Warns when a deprecated command is used
deprecationWarnings: true,
bail: 0,
//
baseUrl: util.setUrl(),
//
// Default timeout for all waitFor* commands.
waitforTimeout: globals.baseConfig.waitForTimeout,
// Default timeout in milliseconds for request
// if Selenium Grid doesn't send response
connectionRetryTimeout: process.env.CONNECTRETRYTIMEOUT || 90000,
//
// Default request retries count
connectionRetryCount: 3,
framework: 'mocha',
maxInstances: process.env.PARALLELTHREADS || 20,
capabilities: [
{
userCred: globals.userCredArray.cred9,
version: '',
browserName: 'chrome',
specs: [
'./test/features/footer/test-footer.js'
],
}
],
services: [ 'selenium-standalone', rpService],
reporters: ['reportportal'],
reporterOptions: {
reportportal: {
rpConfig: {
token: process.env.RP_UUID,
endpoint: 'https://testreportingsystem.nyt.net/api/v1',
launch: process.env.JOB_NAME,
project: 'cooking',
mode: 'DEFAULT',
debug: false
},
enableSeleniumCommandReporting: true,
enableScreenshotsReporting: false,
seleniumCommandsLogLevel: 'debug',
screenshotsLogLevel: 'info',
enableRetriesWorkaround: true,
parseTagsFromTestTitle: true,
}
},
mochaOpts: {
timeout: process.env.MOCHATIMEOUT || 900000,
ui: 'bdd',
grep: process.env.npm_config_grep,
compilers: ['js:babel-register'],
},
beforeSession: function (config, capabilities, specs) {
//runs block for every capability
exports.userCred = capabilities.userCred;
// get sessions and user for parallel in the future
},
before: function () {
chai.config.includeStack = true;
global.expect = chai.expect;
global.AssertionError = chai.AssertionError;
global.Assertion = chai.Assertion;
global.assert = assertions;
let options = {defaultWait: 5000};
let chaiWebdriver = require('chai-webdriverio').default;
chai.use(chaiWebdriver(browser, options));
chai.use(assertArrays);
},
beforeSuite: function (suite) {
//setting viewport size
util.setViewportSize();
},
afterTest: function (test) {
// logging Pass or Fail for test
if (test.passed) {
let passMsg = `******* TEST '${test.title}' PASSED ******* `;
console.log('info', passMsg);
reporter.sendLogToTest(test, 'info', passMsg)
} else {
let failMsg = `******* TEST '${test.title}' FAILED ******* `;
console.log(failMsg);
reporter.sendLogToTest(test, 'info', failMsg);
const screenshot = browser.saveScreenshot();
reporter.sendFileToTest(test, 'info', `${test.title}.png`, screenshot);
}
},
};
Let me know what you think
Replace reporters: ['reportportal'],
=> reporters: [reporter],
Thank you. works as expected when using rpService
works as expected when using rpService
@igerasimov23 Nice! Btw I will fix initial issue a bit later.
"wdio-reportportal-reporter": "^0.0.21"
Following errors occurs in console when:
onComplete: async function (exitCode, config, capabilities) { await reporter.waitLaunchFinished(); }
AND reportportal reporter disabled in wdio conf:reporters: ['spec', 'dot', /*'reportportal'*/],
Originally posted by @igerasimov23 in https://github.com/BorisOsipov/wdio-reportportal-reporter/issues/1#issuecomment-454532733