-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add context to before/after scenario hooks issue 5394 #5483
Add context to before/after scenario hooks issue 5394 #5483
Conversation
tests/helpers/cucumber-hooks.conf.js
Outdated
@@ -7,9 +7,10 @@ exports.config = Object.assign({}, config, { | |||
await browser.pause(30) | |||
browser.Cucumber_Test = 0 | |||
}, | |||
beforeScenario: () => { | |||
beforeScenario: (world) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
world
should be the 5th parameter, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; suspended work on this for now as it's not working. Erwin Heitzman suggested the hooks should be wrapped (similar to before/afterStep) but that also didn't seem to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed to link @wdio/cucumber-framework but it doesn't seem to be working at all. (In fact, can't even get context to console.log in before/afterStep where it is supposed to already be supported). Will close PR for now.
tests/helpers/cucumber-hooks.conf.js
Outdated
@@ -27,9 +28,15 @@ exports.config = Object.assign({}, config, { | |||
} | |||
browser.Cucumber_Test = 1 | |||
}, | |||
afterScenario: () => { | |||
afterScenario: (world) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Co-authored-by: Christian Bromann <github@christian-bromann.com>
Not working locally; closing for now |
I recommend to use our smoke test to check if changes work. You can just try reproduce your desired scenario in our cucumber smoke project and run it while you are changing files. |
Thanks for the tips. Am a little confused about how to use the cucumber smoke project because the thing that isn't 'working' is logging out the 'context' parameter in before/afterStep, before/afterScenario hood (before/afterStep even before the changes in this PR), and there is no config file with hooks in the smoke project. In any case the cucumberTestrunner tests are also failing but it's not clear why: PS C:\webdriverio> npm run test:smoke cucumberTestrunner
Running smoke tests... Execution of 2 spec files started at 2020-06-12T16:42:03.397Z [BABEL] Note: The code generator has deoptimised the styling of C:\webdriverio\packages\wdio-webdriver-mock-service\node_modules\lodash\lodash.js as it exceeds the max of 500KB. Spec Files: 0 passed, 2 failed, 2 total (100% completed) in 00:00:13 ========== LOG OUPUT wdio-0-0.log ========== LOG OUPUT wdio-0-1.log ========== LOG OUPUT wdio.log Error: Smoke test failed npm ERR! A complete log of this run can be found in: |
Is this with your change or without? |
Both with and without changes. |
Can you try on a fresh checked out repository? These tests should pass (see CI pipeline). |
Tried with a freshly cloned/checked out repository and the tests still fail. (Also had to install @wdio/local-runner separately after npm install and npm run setup-full to run smoke tests.) |
@christian-bromann just fyi the cucumber smoke tests pass when run in a standalone command prompt, but not from the same directory within VSCode. |
Can you explain a bit further what you mean by that? |
Sorry, the above comment is incorrect. The command "npm run test:smoke cucumberTestrunner" results in the same Failed result both in a command prompt and in VSCode's terminal window. It only says "All tests passed" when misspelled as "npm run test:smoke cucumberTestrunne" (presumably because then there are no tests to run). In any case the PR should be closed as the code changes don't work. |
@osmolyar I think the change still makes a lot of sense? Let's re-open and we jump on a 1:1 session through the WebdriverIO Office Hours?! |
Ok- in a meeting for the next hour but otherwise anytime. Thanks |
Please use the link to schedule a time. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks so much! That was a successful session.
Proposed changes
Add context to before/after scenario hooks to resolve issue #5394
//: # Addressing issue #5394.
Types of changes Modeled on changes in https://github.com/webdriverio/webdriverio/pull/4545/files to add context parameter to hooks
Checklist
Further comments
Reviewers: @webdriverio/project-committers