I am currently searching for and experimenting with alternatives to @web/test-runner and @open-oc/testing for testing custom components and also stumbled over playwright-ct and your library. For simple use cases it seems to work well, but I have created some tests already with @web/test-runner, which I fail to rewrite using mount.
For example one of the problems is, that mount seems to only work for creating single component instances:
const component = await mount(Button, {
props: {
title: 'Submit',
},
});
This only works for the very simplest of use-cases. A more real-world usage (especially in the example of testing a custom button component) would be something like this, where not only the component itself, but maybe some wrapper element or children are necessary to construct a realistic test case:
const el = await fixture(html`
<form>
<my-button type="submit">Submit</my-button>
</form>
`);
I was wondering if it was possible to make mount more powerful and provide something similar to the fixtures helper from https://www.npmjs.com/package/@open-wc/testing-helpers#user-content-test-a-custom-element-with-properties? Even better if one could (optionally) provide a template using lit-html to write better readable test cases.
I am currently searching for and experimenting with alternatives to
@web/test-runnerand@open-oc/testingfor testing custom components and also stumbled overplaywright-ctand your library. For simple use cases it seems to work well, but I have created some tests already with@web/test-runner, which I fail to rewrite usingmount.For example one of the problems is, that
mountseems to only work for creating single component instances:This only works for the very simplest of use-cases. A more real-world usage (especially in the example of testing a custom button component) would be something like this, where not only the component itself, but maybe some wrapper element or children are necessary to construct a realistic test case:
I was wondering if it was possible to make
mountmore powerful and provide something similar to thefixtureshelper from https://www.npmjs.com/package/@open-wc/testing-helpers#user-content-test-a-custom-element-with-properties? Even better if one could (optionally) provide a template usinglit-htmlto write better readable test cases.