-
-
Notifications
You must be signed in to change notification settings - Fork 723
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
added examples in docblocks of new network test steps in Playwright helper #3758
added examples in docblocks of new network test steps in Playwright helper #3758
Conversation
@kobenguyent please merge if you think it is good |
lib/helper/Playwright.js
Outdated
* Examples: | ||
* | ||
* ```js | ||
* await I.mockTraffic('/api/users/1', '{ id: 1, name: 'John Doe' }'); |
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.
do we need await here?
lib/helper/Playwright.js
Outdated
* Examples: | ||
* | ||
* ```js | ||
* await I.blockTraffic('http://example.com/css/style.css'); |
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.
do we always need await?
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.
No. We don't need actually.
Good catch.
I made hands-on tests and they all worked just fine without await
.
-> I updated the examples in docblock. I didn't yet change it in the functional code to make the methods sync, that don't need to be async. A
ctually almost all new steps are sync methods except await I.seeTraffic
seeTraffic
is async because we decided to have waiting mechanism in there for up to 10 seconds (default value).
lib/helper/Playwright.js
Outdated
* | ||
* ```js | ||
* await I.getTrafficUrl('https://api.example.com/session'); | ||
* await I.getTrafficUrl(/session.*start/); |
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 just thought, maybe we should use grab
prefix?
juist to keep one standard
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 agree with DavertMilk.
I also would prefer "grabTrafficUrl".
@kobenguyent please merge it |
…-more-custom-steps-docs
f337b78
into
codeceptjs:feat-playwright-more-custom-steps
Motivation/Description of the PR
async
fromdontSeeTraffic
, because there is no need for it. The evaluating code inside runs synchronously.getTrafficUrl
fail hard when recording of traffic has not yet started. I think this is helpful for the test automation engineer. I cannot imagine there is usecase where this new behavior is unwanted.Applicable helpers:
Type of change
Checklist:
npm run docs
)npm run lint
)npm test
)