-
-
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
Wrap test function with before after step hooks #4354
Wrap test function with before after step hooks #4354
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4354 +/- ##
==========================================
+ Coverage 99.28% 99.29% +0.01%
==========================================
Files 188 192 +4
Lines 4765 4856 +91
Branches 1020 1039 +19
==========================================
+ Hits 4731 4822 +91
Misses 31 31
Partials 3 3
Continue to review full report at Codecov.
|
* | ||
* @param {object} wrapFunctions executeHooksWithArgs, executeAsync, runSync | ||
* @param {string} type Test/Step or Hook | ||
* @param {object} spec specFn and specFnArgs |
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.
not sure it makes much sense to pass spec, before, after as objects
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.
Tiny comments
Please remove the work-in-progress label if it is ready for review |
PR is ready for review |
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.
I am a bit worried to add a dependency to @wdio/utils
given that the package should contain minimal helper functions that don't require a dependency to a different sub package. This can lead to a circular dependency issue. Do you think we can reorg this?
@christian-bromann updated PR according to comments |
added more unit tests and removed |
@christian-bromann rebased, added temporary pac-resolver mock f5ae88d to prove that all tests are passing |
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.
some more comments
@christian-bromann updated PR according to comments. Please note that due to lot's of changes in imports I'd recommend to release all the packages after merging this one |
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.
This is a great refactoring effort , well done 👏
NOTE
Please bump version of all the packages when doing release!
Problem
Currently we use mocha/jasmine before/afterEach hooks as wdio before/afterTest hooks.
This has certain limitations, for example if test looks like this
there is no way to capture screenshot, because screenshot is taken after
afterEach
hook.Proposed changes
it
,beforeEach
and others) with wdio hooks like this:fixes #4004
same for hooks
have same approach for all test frameworks: mocha, jasmine and cucumber. See file
packages/wdio-utils/src/test-framework/testFnWrapper.js
allow mixing async and sync like this:
Types of changes
there might be some regressions for mocha/jasmine users that strongly rely on beforeTest/afterTest in some very specific way, sorry to say I might miss some use cases, it should be easy to deal with them.
Cucumber users are not affected.
TODO
Reviewers: @webdriverio/technical-committee