super controversial opinion: testing is good
32 replies
@zachleat hells ya. testing html can be a bit weird! how are you doing it these days? we're basically comparing strings using parse5 and its fiiiine but feels like a thing that could be much better
@brianleroux same! still rocking ava js too
@brianleroux @zachleat WebdriverIO will ship with a browser runner in the upcoming major release that makes it finally very easy to render and test components in a real browser using standardized user interactions through the WebDriver protocol. All powered by Vite. Some examples can be found here: https://github.com/webdriverio/component-testing-examples
@brianleroux @zachleat sure, it comes with a basic Vite setup that allows you to write TypeScript and import dependencies. As a User you don’t even see that it is Vite under the hood unless you like to customize the dev server. What you do in your tests is totally up to you!
@brianleroux @zachleat yeah that will totally work, it will import any plain module into the browser for you to use
@brianleroux let me actually add an example using Enhance 😉
@bromann now we're talking! 🙏 Seriously tho just a blank test.html page is cool too.
@brianleroux here you go: https://github.com/webdriverio/component-testing-examples/blob/main/enhance/tests/specs/example.test.js .. a simple example but should demonstrate how it could look like. This targets more the component testing usecase which is why I had to strip out the HTML and Body tag. Compared to the proposed solution in the Enhance docs this uses the actual browser and could run anywhere where the web is supported, even mobile 😉
-
@jhofker the great litmus test of life
@zachleat ah but have you TESTED that opinion
tap.pass('yes testing is good')
@sil I’ll be in touch for maintenance on that one
-
@skidvis SHIP IT
@zachleat this very much feels like a test
@rikschennink you passed
@zachleat I'm so relieved
-
@zachleat Good testing is good. Bad testing is really bad (I changed the text of a button, now I have 500 test failures that will take me significantly longer to fix than fixing the button).
The more you do it the better it gets!
@zachleat we’re not supposed to just commit to production and wait for angry emails?
@zachleat Remember the maxim: "Everyone has a testing environment. If you're very lucky it's separate from your production environment!"
-
-
@zachleat .... Until it's not :)