question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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
                },
            }
        }
    },

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ktryniszewski-mdsolcommented, Jan 4, 2021

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: https://github.com/codeceptjs/CodeceptJS/pull/2745

0reactions
ShawnBaumbachcommented, Apr 13, 2021

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.<anonymous> (e2e\src\tests\features\send-to-agent_test.js:43:3)”, “diff”: null },

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mochawesome HTML report: Missing scenario steps (stack) in ...
Mochawesome report shows scenario steps (stack) when a scenario fails. It's useful because of context - when it's not clear in which step...
Read more >
Reporters - CodeceptJS
By default, CodeceptJS provides cli reporter with console output. Test names and failures will be printed out on screen. GitHub -- ✓ search...
Read more >
Codeception/CodeceptJS - Gitter
I'm trying to add an url to mochawesome testing report and did it in 2 places: _failed hook ... I don't wan't to...
Read more >
How To Generate Mocha Reports With Mochawesome?
Mochawesome is a custom Mocha reporter that allows you to create standalone HTML/CSS test reports based on the execution of your Mocha test ......
Read more >
How can I get full HTML mochawesome report using ...
I am using codeceptjs library in order to develop and run automated tests. Currently I'm in process of run those tests in paralell...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found