Incorrect doc: WebdriverIO Sync
See original GitHub issuePre-check
- I’m aware that I can edit the docs and submit a pull request
Describe the improvement
I’d like to report
- Unclear documentation
- A typo
- Missing documentation
- Other
Description of the improvement / report I am trying to test an async helper method I have created in sync mode to make sure users of the helper can use it in both sync and async mode using the following doc Using WebdriverIO as standalone package and noticed the following issues:
.then((browser) =>
- Typescript error:
TS2339: Property 'then' does not exist on type 'BrowserObject'
- Looking at
node_modules/webdriverio/webdriverio.d.ts
I seeremote()
returns aBrowserObject
not a promise - If I suppress the error (assuming possible incorrect typedef) and run the test using wdio cli the
then
block does not run.- e.g.
}).then((browser) => sync(() => { expect(true).toBe(false); })
still passes
- e.g.
- Typescript error:
- Can you please add/improve doc to describe how to use a async helper method that uses
browser
object to work insync
mode. How can I design helper method or browser command that works in both sync and async mode?- If I try using my async helper method (e.g.
checkIssues()
) within thesync()
block (without creating aremote
, I get aUnhandledPromiseRejectionWarning: Unhandled promise rejection.
sync(() => { browser.url(htmlFileWithIssues); expect(() => checkIssues()).toThrow(); });
- using
browser.call()
to wrap the async method as described in the doc doesn’t helpit('should work with sync mode', () => { const sync = require('@wdio/sync').default; sync(() => { browser.url(htmlFileWithIssues); browser.call(async () => { expect(await checkIssues()).toThrow(); }); });
- If I try using my async helper method (e.g.
runner: true,
runner
is a string, no longer a boolean, needs to be fixed e.g. torunner: 'local'
(Fixed in https://github.com/webdriverio/webdriverio/pull/5598)
- Switching Between Sync And Async has a typo:
you can still switch between both boths by using the
(Fixed in https://github.com/webdriverio/webdriverio/pull/5598)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Configuration File - WebdriverIO
The configuration file contains all necessary information to run your test suite. It's a NodeJS module that exports a JSON.
Read more >Investigate if WebdriverIO `sync: false` would be useful to us ...
With version 4, it is supposed to be synchronous by default. Setting sync: false being for people still having async tests so they...
Read more >webdriverio/webdriverio - Gitter
Is there a problem there? Radim Daniel Pánek. @rdpanek. Hello, i try documentation for v6 and this page doesn't exist https://webdriver.io/docs/sync-vs- ...
Read more >WebdriverIO Sync mode update | WebdriverIO v7 to v8 changes
webdriverio #automationbroIs WebdriverIO getting rid of the Sync mode? How to use WebdriverIO in Async mode?
Read more >BrowserStack, WDIO, Cucumber, TypeScript - Stack Overflow
It's a pretty late answer, but it looks like the problem is with the types ... Please avoid importing webdriverio or @wdio/sync explicitly....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in #5599
You can just check if @wdio/sync is installed or not.