Closed sairam9994 closed 1 year ago
@epszaw @BorisOsipov any ideas?
Will investigate the problem as soon as possible 👍
Hi, Could you please let me know if any update on the issue?
Don't have any update for now
@sairam9994 Could you please create a reproducible example via https://webdriver.io/docs/gettingstarted and share it with us via github repo?
I am also facing issue of not able to see the screenshot in the report after following all required configuration/settings for @wdio/allure-reporter, after upgrading it to the latest version 8.16.3. Kindly please fix this issue as we're not able to see screenshot in the report and have to share execution result to the client. @BorisOsipov @epszaw could you guys please have a look into this issue as we're blcoked with this issue.
Try
afterTest: async function (test, context, { error, result, duration, passed, retries }) { if (!passed) { allureReporter.addAttachment('Screenshot', Buffer.from(await browser.takeScreenshot(), 'base64'), 'image/png'); }
as a workaround.
I'm getting cannot read property error while running test. Any suggestions here?
[0-0] 2023-09-12T16:45:36.349Z ERROR @wdio/utils:shim: TypeError: Cannot read properties of undefined (reading 'addAttachment')
[0-0] at Object.afterTest (/wdio.conf.js:335:28)
[0-0] at file:///node_modules/@wdio/utils/build/shim.js:31:27
[0-0] at new Promise (<anonymous>)
[0-0] at file://node_modules/@wdio/utils/build/shim.js:28:47
[0-0] at Array.map (<anonymous>)
[0-0] at executeHooksWithArgsShim (file:///node_modules/@wdio/utils/build/shim.js:28:33)
[0-0] at UserContext.testFrameworkFnWrapper (file:///node_modules/@wdio/utils/build/test-framework/testFnWrapper.js:60:46)
[0-0] 2023-09-12T16:45:36.349Z DEBUG @wdio/utils:shim: Finished to run "afterTest" hook in 12ms
[0-0] Error in "AfterTest Hook"
Cannot read properties of undefined (reading 'addAttachment')
wdio.conf.js
const { allureReporter } = require('@wdio/allure-reporter');
afterTest: async function (test, context, { error, result, duration, passed, retries }) {
if (!passed) {
allureReporter.addAttachment('Screenshot', Buffer.from(await browser.takeScreenshot(), 'base64'), 'image/png');
}
},
Try
CJS
const allureReporter = require('@wdio/allure-reporter').default
ESM
import allureReporter from '@wdio/allure-reporter'
Try
afterTest: async function (test, context, { error, result, duration, passed, retries }) { if (!passed) { allureReporter.addAttachment('Screenshot', Buffer.from(await browser.takeScreenshot(), 'base64'), 'image/png'); }
as a workaround.
Doing by this every time we have to download the screenshot, this is temporary fix. Can we get the earlier behavior by which we can directly access the attach screenshot without needing of downloading it and can quickly access and see the screenshot.
@sairam9994 any updates on the reproducible example?
Closing, as no reproducible example can be provided.
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
8.16.4
Node.js Version
18.16.0
Mode
Standalone Mode
Which capabilities are you using?
What happened?
Unable to attach screenshots to allure report after adding the takeScreenshot in afterTest hook in the wdio.confg.js
What is your expected behavior?
After test execution failed, It should attach screenshot as per afterTest hook in Allure Report. I can add console log but no screenshot for failures.
How to reproduce the bug.
I've attached the versions & wdio.conf.js file. wdio.conf.js: capabilities: [{ maxInstances: 6, browserName: 'chrome', browserVersion: 'stable', acceptInsecureCerts: true, 'goog:chromeOptions': { args: [ '--no-sandbox', '--disable-infobars', '--headless', '--disable-gpu', '--window-size=1440,735', '--disable-colors', '--disable-translate', '--disable-dev-shm-usage', '--disable-extensions', '--enable-clipboard', 'disable-popup-blocking', 'disable-notifications', '--allow-site-access-from-files' ]},
reporters: [ ['allure', { outputDir: 'allure-results', disableWebdriverStepsReporting: true, disableWebdriverScreenshotsReporting: false, addConsoleLogs:true }], ], onComplete: function() { const reportError = new Error('Could not generate Allure report') const generation = allure(['generate', 'allure-results', '--clean']) return new Promise((resolve, reject) => { const generationTimeout = setTimeout( () => reject(reportError), 5000)
}, framework: 'jasmine',
Relevant log output
I don't see much related to afterTest hook issue. I've updated config entry
logLevel: 'trace'
to get more info about the execution.Code of Conduct
Is there an existing issue for this?