-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
chore(tests): Update RTL tests and misc improvements to helpers #7293
Conversation
tests/browser/test/test_setup.js
Outdated
@@ -116,23 +116,14 @@ async function getBlockElementById(browser, id) { | |||
/** | |||
* @param browser The active WebdriverIO Browser object. | |||
* @param categoryName The name of the toolbox category to find. | |||
* @return A Promise that resolves to the root element of the toolbox | |||
* category with the given name, as an interactable browser element. | |||
* @return The root element of the toolbox category with the given name, as an interactable browser element. |
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.
Why was the previous doc wrong? As always, I'm shaky on Promises, but I thought that the return value of an async function is always a promise, and the only type question is what it resolves to.
If that's wrong, I also need to update the other functions in this file.
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, you're right, it does. I think I changed it because I added the await before returning so I was thinking the promise would be resolved before returning, but because it's async it just gets wrapped in another promise. @_@
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.
Cool--that matches my understanding.
This has been rebased and is ready for re-review |
tests/browser/test/test_setup.js
Outdated
@@ -312,6 +303,7 @@ async function connect( | |||
async function switchRTL(browser) { | |||
const ltrForm = await browser.$('#options > select:nth-child(1)'); | |||
await ltrForm.selectByIndex(1); | |||
browser.pause(500); |
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.
missing 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.
lgtm once you add the missing await
The basics
npm run format
andnpm run lint
The details
Resolves
Fixes an issue with RTL test in field_edit_tests where the test code was being executed before the page actually switched to RTL mode
Proposed Changes
await
in the field edit tests so that that test does actually wait before continuingwaitForExist
instead of pausesbrowser.pause
instead ofsetTimeout
in some placesbrowser.click()
since that's how the examples do itBehavior Before Change
field edit test wasn't actually running in rtl always
Behavior After Change
all tests pass, hopefully
Reason for Changes
Test Coverage
Documentation
Additional Information