-
Notifications
You must be signed in to change notification settings - Fork 421
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
docs(testing): adding WebdriverIO docs #1346
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
f12070a
to
11e8bd1
Compare
Adding the rest of the team here - I encourage everyone to run through these instructions on your machine. Please play with the docs + examples here as if you were an end user attempting to use WebdriverIO and use that to drive feedback |
98e3117
to
f91757d
Compare
3397add
to
c810003
Compare
c810003
to
1e87b04
Compare
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 questions and comments!
|
||
- __Cross Browser Support__: WebdriverIO is designed to support all platforms, either on desktop or mobile. You can run tests on actual browser your users are using, including covering different versions of them. | ||
- __Real User Interaction__: Interacting with elements in WebdriverIO through the WebDriver protocol is the closes you can get to reality compared to emulated interaction in virtual DOM environments. | ||
- __Web Platform Support__: Running tests in actual browser allows you to tap into the latest Web Platform features for testing your components, often not available when using virtual DOM environments. |
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.
- __Web Platform Support__: Running tests in actual browser allows you to tap into the latest Web Platform features for testing your components, often not available when using virtual DOM environments. | |
- __Web Platform Support__: Running tests in actual browsers allows you to tap into the latest Web Platform features for testing your components, often not available when using virtual DOM environments. |
should we maybe highlight that this keeps polyfills out of the picture, i.e. if you test an integration with a given DOM API you're testing the integration with an actual browser engine and not the integration with however it's implemented in JSDom (which could be anything from quite close to standards-compliant to way, way off)
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.
add a 4th point>
- Real Environments: Run your tests in an environment that your users are using and not somewhere that re-implements web standards with polyfills like JSDOM.
To get started with WebdriverIO, all you need to do is to run their project starter: | ||
|
||
```sh | ||
npm init wdio@latest . |
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.
npm run wdio | ||
``` | ||
|
||
More information on setting up WebdriverIO can be found in their [documentation](https://webdriver.io/docs/component-testing/stencil). |
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 was able to stand up a new project easily with npm init wdio@latest
and so on and faced no issues, however when I tried to add webdriverio stuff to an existing project I faced a bit of an issue.
I first created a new test stencil project like so:
mkdir /tmp/test && cd /tmp/test
npm init stencil component test-adding-wdio
then after doing an npm install
and whatnot I ran:
npm init wdio@latest .
this ran through the wizard with no problems, and it looks like it cleanly installed things over my existing setup, but then when I try npm run wdio
I get:
I then went to install ts-node
and then get a different error:
I have no idea what I'm doing with wdio so probably missing something! But j/w two things:
- is adding wdio tests to an existing project using the
init
starter something that's supported? - if so, is that something we should document here?
I imagine there's going to be some interest in using this approach for the e2e tests in existing projects, so we might want to make sure that's documented.
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.
Two errors happened here which are bad DX and a bug in WebdriverIO:
- first, currently WebdriverIO assumes
ts-node
to be installed for all TypeScript projects, this assumption is wrong though. I raised an issue in the WebdriverIO project and can tackle this quickly. - second, the config is written in ESM while a new Stencil project is set up as CJS project - it is currently very difficult to find out what environment the project is set up with but this is DX I can also fix on the WebdriverIO side - in the meantime, let me add a comment to rename the config to
.mts
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 ran into this as well - would renaming the config extension to .mts
work? I tried that locally and ran into issues there:
ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///private/tmp/wdio-basic-test/wdio.conf.ts: Cannot find module '/private/tmp/wdio-basic-test/wdio.conf.ts' imported from /private/tmp/wdio-basic-test/node_modules/@wdio/config/build/node/RequireLibrary.js
Error: Cannot find module '/private/tmp/wdio-basic-test/wdio.conf.ts' imported from /private/tmp/wdio-basic-test/node_modules/@wdio/config/build/node/RequireLibrary.js
at finalizeResolution (/private/tmp/wdio-basic-test/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:366:11)
at moduleResolve (/private/tmp/wdio-basic-test/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:801:10)
at Object.defaultResolve (/private/tmp/wdio-basic-test/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
at /private/tmp/wdio-basic-test/node_modules/ts-node/src/esm.ts:218:35
at entrypointFallback (/private/tmp/wdio-basic-test/node_modules/ts-node/src/esm.ts:168:34)
at /private/tmp/wdio-basic-test/node_modules/ts-node/src/esm.ts:217:14
at addShortCircuitFlag (/private/tmp/wdio-basic-test/node_modules/ts-node/src/esm.ts:409:21)
at resolve (/private/tmp/wdio-basic-test/node_modules/ts-node/src/esm.ts:197:12)
at nextResolve (node:internal/modules/esm/hooks:865:28)
at Hooks.resolve (node:internal/modules/esm/hooks:303:30)
Wouldn't the config file need to be a CJS module? Or am I misunderstanding the issue here?
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.
@rwaskiewicz I think you missed to update the wdio
script in the package.json
which still points to a wdio.conf.ts
file. I tested it and changing to .mts
works. The problem is that the Stencil starter project is a CJS project unless you do either of the two changes:
- rename
wdio.conf.ts
towdio.conf.mts
(my preferred choice) - add
"type": "module"
topackage.json
(related to work proposed in STENCIL-1051)
The other option is to have WebdriverIO compose the whole thing as CJS (use require
instead import
) but that sounds like a step backwards to me.
I will add an admonition telling users to make this change, and check the ESM state of their project as I think this is the easiest way to unblock this.
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 added the following two admonitions:
The example component generated by WebdriverIO uses fragments which causes TypeScript to fail due to missing jsxFragmentFactory
settings. I left this out as it seems straightforward how to fix it and chances are that users either don't generate them or remove them immediately. Let me know if I should add an admonition for this too.
d3c994f
to
15d339e
Compare
7ad79db
to
6533083
Compare
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.
Content looks good! Just some grammatical stuff and marked a few spots to use npm2yarn
|
||
:::info | ||
|
||
Missing an `await` can be a simple oversight and can cause us long hours of debugging. To avoid this and ensure promises are handled properly, it is recommended to use an ESLint rule called [`require-await`](https://eslint.org/docs/latest/rules/require-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.
Ooh nice, we'll wanna recommend this in Playwright too. Sean said Framework has a lint rule, but idk if they used a published rule or rolled their own.
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.
Nice! I had a few comments/asks, most of which are minor little nitpicks.
One more general ask - it's not clear to me from the documentation how well WebdriverIO (or any other testing framework) would integrate with npx stencil test
out of the box. Can we add a blurb somewhere that explains/answers:
- "Should I continue using
npx stencil test
?" - "How do existing tests integrate with my existing Stencil setup?"
241e08b
to
f309b3b
Compare
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Ryan Waskiewicz <[email protected]>
Co-authored-by: Alice Pote <[email protected]>
Co-authored-by: Alice Pote <[email protected]>
Co-authored-by: Alice Pote <[email protected]>
Co-authored-by: Alice Pote <[email protected]>
Co-authored-by: Alice Pote <[email protected]>
65a917c
to
4469715
Compare
…#1344) * docs(testing): re-organize testing up to allow adding more frameworks * prettier * fix wording * fix links * Update docs/testing/stencil-testrunner/02-config.md Co-authored-by: Ryan Waskiewicz <[email protected]> * fixed json formatting * fixed wording * Update docs/testing/01-overview.md Co-authored-by: Ryan Waskiewicz <[email protected]> * deprecate visual diff capabilities * prettier * Revert "deprecate visual diff capabilities" This reverts commit f91757d. * Update docs/testing/01-overview.md Co-authored-by: Alice Pote <[email protected]> * Update docs/testing/01-overview.md Co-authored-by: Tanner Reits <[email protected]> * Update docs/testing/stencil-testrunner/01-overview.md Co-authored-by: Tanner Reits <[email protected]> * Update docs/testing/stencil-testrunner/03-unit-testing.md Co-authored-by: Tanner Reits <[email protected]> * docs(testing): adding WebdriverIO docs (#1346) * docs(testing): adding WebdriverIO docs * add webdriverio to cspell list * add visual docs * minor wording * prettier update * Update docs/testing/webdriverio/01-overview.md Co-authored-by: Alice Pote <[email protected]> * fix example * Update docs/testing/webdriverio/03-mocking.md Co-authored-by: Tanner Reits <[email protected]> * Update docs/testing/webdriverio/01-overview.md Co-authored-by: Tanner Reits <[email protected]> * use npm2yarn * fix admonition * pr feedback * Update docs/testing/webdriverio/01-overview.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/01-overview.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/04-visual-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Ryan Waskiewicz <[email protected]> * add description on what a service is * added a section on integration with Stencil testing capabilities * minor tweak to code example * add section on components list * add admonition * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Alice Pote <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Alice Pote <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Alice Pote <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Alice Pote <[email protected]> * Update docs/testing/webdriverio/02-unit-testing.md Co-authored-by: Alice Pote <[email protected]> * fix code example meeting * add note how to run both test runners --------- Co-authored-by: Alice Pote <[email protected]> Co-authored-by: Tanner Reits <[email protected]> Co-authored-by: Ryan Waskiewicz <[email protected]> * use code references for Screenshot connector --------- Co-authored-by: Ryan Waskiewicz <[email protected]> Co-authored-by: Alice Pote <[email protected]> Co-authored-by: Tanner Reits <[email protected]>
This patch adds docs on top of the docs-reorg PR for WebdriverIO Testing.
In the docs you will see that I am trying to get some basic docs in place but mostly reference to the WebdriverIO project docs.