Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mochawesome HTML report: Missing scenario steps (stack) in CodeceptJS 3 when scenario fails #3028

mirao started this conversation in General
Discussion options

What are you trying to achieve?

Mochawesome report shows scenario steps (stack) when a scenario fails. It's useful because of context - when it's not clear in which step it occurred.
This is how it looks in CodeeceptJS 2.6.11:

image

What do you get instead?

Missing scenario steps in CodeceptJS 3.0.3. There is only an "internal" stack from node modules which isn't too much useful:

image

Provide console output if related. Use --verbose mode for more details.

# codeceptjs run --grep "Test login screen" --profile jobr --reporter mocha-multi

Details

  • CodeceptJS version: 3.0.3
  • NodeJS Version: v12.20.0
  • mocha-multi: 1.1.3
  • mochawesome: 6.1.1
  • Operating System: Ubuntu 20.04/20.10
  • Configuration file:
 mocha: {
 reporterOptions: {
 "codeceptjs-cli-reporter": {
 stdout: "-",
 options: {
 verbose: false,
 debug: true,
 steps: true
 }
 },
 mochawesome: {
 stdout: "./output/console.log",
 options: {
 reportDir: "./output",
 reportFilename: "report"
 }
 },
 "mocha-junit-reporter": {
 stdout: "./output/console.log",
 options: {
 mochaFile: "./output/result.xml",
 jenkinsMode: true,
 attachments: true //add screenshot for a failed test
 },
 }
 }
 },
You must be logged in to vote

Replies: 6 comments 1 reply

Comment options

yep, I see this error too on 3.0.2

For failed tests there are error stack and recorder code
image

For successful tests - some code
image

I am using WebDriver helper without gherkin steps.

Do you use gherkin, @mirao ?

You must be logged in to vote
0 replies
Comment options

@elukoyanov No, I do not. I'm also using WebDriver without gherkin

You must be logged in to vote
0 replies
Comment options

I think I accidentally suppressed the gherkin error in 3.0.3 when i was adding logic for bddStep event. Instead of throwing the error it was returning on the whole step when error is encountered. I am not sure if this is related, but I have a fix for that here: #2745

You must be logged in to vote
0 replies
Comment options

Hi, I face the same issue. I can not see any steps/verbose information in the report.

image

You must be logged in to vote
0 replies
Comment options

I'm having the same issue, in the json file, context becomes null and the code is replaced with the same recorder.errHandler blob you posted.

Using the latest versions of mochawesome (6.2.2) and codeceptjs (3.0.6)

This only happens if you retry the test. The old data is replaced with this incorrect data.

Screenshots remain in the folder, but are also not displayed.

This was not a problem with 2.x.x

"context": null,
"code": "recorder.errHandler((err) => {\n recorder.session.start('teardown');\n recorder.cleanAsyncErr();\n if (test.throws) { // check that test should actually fail\n try {\n assertThrown(err, test.throws);\n event.emit(event.test.passed, test);\n event.emit(event.test.finished, test);\n recorder.add(() => done());\n return;\n } catch (newErr) {\n err = newErr;\n }\n }\n event.emit(event.test.failed, test, err);\n event.emit(event.test.finished, test);\n recorder.add(() => done(err));\n});\nif (isAsyncFunction(testFn)) {\n event.emit(event.test.started, test);\n const catchError = e => {\n recorder.throw(e);\n recorder.catch((e) => {\n const err = (recorder.getAsyncErr() === null) ? e : recorder.getAsyncErr();\n recorder.session.start('teardown');\n recorder.cleanAsyncErr();\n event.emit(event.test.failed, test, err);\n event.emit(event.test.finished, test);\n recorder.add(() => done(err));\n });\n };\n let injectedArguments;\n try {\n injectedArguments = getInjectedArguments(testFn, test);\n } catch (e) {\n catchError(e);\n return;\n }\n testFn.call(test, injectedArguments).then(() => {\n recorder.add('fire test.passed', () => {\n event.emit(event.test.passed, test);\n event.emit(event.test.finished, test);\n });\n recorder.add('finish test', () => done());\n recorder.catch();\n }).catch(catchError);\n return;\n}\ntry {\n event.emit(event.test.started, test);\n testFn.call(test, getInjectedArguments(testFn, test));\n} catch (err) {\n recorder.throw(err);\n} finally {\n recorder.add('fire test.passed', () => {\n event.emit(event.test.passed, test);\n event.emit(event.test.finished, test);\n });\n recorder.add('finish test', () => done());\n recorder.catch();\n}",
"err": {
"message": "Error: Text "We've sent your info to" was not found on page after 10 sec\nwaiting for function failed: timeout 10000ms exceeded",
"estack": "Error: Text "We've sent your info to" was not found on page after 10 sec\nwaiting for function failed: timeout 10000ms exceeded\n at C:\PLM\auto-quote-and-buy-ui\node_modules\codeceptjs\lib\helper\Puppeteer.js:2091:13\n at async Actor.takeScreenshot (e2e\src\steps\basic.steps.js:118:5)\n at async Test. (e2e\src\tests\features\send-to-agent_test.js:43:3)",
"diff": null
},

You must be logged in to vote
1 reply
Comment options

still repoduces
3.1.3 + 6.2.3 and 3.2.3 + 7.0.1 with retries >=1

Comment options

Related issue: #3274

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Converted from issue

This discussion was converted from issue #2727 on September 05, 2021 17:40.

AltStyle によって変換されたページ (->オリジナル) /