question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebdriverIO testing library

See original GitHub issue

Describe the feature you’d like:

I absolutely love the API provided by DOM Testing Library, we use React Testing Library at work and it has improved our tests so much. For our E2E testing we use WebdriverIO. I was looking for ways to use the DOM Testing Library API in our E2E tests and found Nightwatch Testing Library, Puppeteer Testing Library and TestCafe Testing Library.

It would be great to see a version of DOM Testing Library that works with WebdriverIO.

Suggested implementation:

Because I was interested I decided to implement something myself 😄. I have an initial version based heavily off of Nightwatch Testing Library. I tried to keep the API and tests as similar as possible. Here is the repo, I’ve added some more information in the readme: https://github.com/olivierwilkinson/webdriverio-testing-library.

Describe alternatives you’ve considered:

My original thought was to use Puppeteer Testing Library with WebdriverIOs underlying puppeteer instance but there are some limitations:

  • Puppeteer is not always available

Puppeteer is used when the tests are run locally and there is no browser driver detected at localhost:4444. This means the Puppeteer instance isn’t available in some setups (including mine).

  • Unable to use WebdriverIO specific APIs

APIs like Element.waitForDisplayed are no longer available since the queries return Puppeteer ElementHandles.

Teachability, Documentation, Adoption, Migration Strategy:

If this is something Testing Library would like to maintain I would happily transfer ownership of the repo. I made sure to keep the same packages, setup and workflows from Nightwatch Testing Library so hopefully that wouldn’t be a hassle. I’m also very happy to maintain and publish the package if this isn’t something Testing Library wants to pursue, in which case I would appreciate some direction in terms of attribution as I don’t want to step on anybody’s toes.

Thanks in advance for any help/feedback you can give me here!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
MatanBobicommented, Feb 24, 2021

Since WebdriverIO is now a part of the testing-library organisation, I’m closing this one 😃 For future visitors, the repo is here. Thanks!

1reaction
nickmccurdycommented, Feb 18, 2021

Good idea. I’ve added it to the Discord channel and git readme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebdriverIO Testing Library
webdriverio -testing-library allows the use of dom-testing-library queries in WebdriverIO for end-to-end web testing.
Read more >
webdriverio-testing-library - GitHub
Simple and complete WebdriverIO DOM testing utilities that encourage good testing practices. - GitHub - testing-library/webdriverio-testing-library: ...
Read more >
@testing-library/webdriverio - npm
Start using @testing-library/webdriverio in your project by running `npm i @testing-library/webdriverio`. There is 1 other project in the ...
Read more >
Component Testing - WebdriverIO
It is totally up to you what you want to run in your tests and how you like to render the components. However...
Read more >
React | WebdriverIO
The React preset requires @vitejs/plugin-react to be installed. Also we recommend using Testing Library for rendering the component into the test page.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found