-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Feature] component testing mount result #15919
Comments
Thanks for another useful use case. I meant to ask a while ago, would you be interested in contributing patches for the components story? |
I'm somewhat limited in time, but I'd love to! How would you like to proceed? |
@sand4rt I'm adding unmount in the PR above, you can follow the pattern and implement |
Awesome, i will have a look at Wondering why you would choose for |
There is no |
Have you taken into account that the test('work', ({ mount, update }) => {
const component = mount<Props>(Component, {
props: { title: 'test' }
})
update<Props>(component, { props: { title: 'test' }}) // Must specifically specify the type here
}) instead of test('work', ({ mount }) => {
const component = mount<Props>(Component, {
props: { title: 'test' }
})
component.update({ props: { title: 'test' }}) // Reuse of the same type defined in mount<Props>()
}) In addition, Testing Library, Vue Test Utils and partially Cypress component testing are using the same API. If you decide to use the same API as well, context switching and the migration to Playwright will becomes easier. We now have feature requests for the following functions and i think a few more will follow. Assuming it will be a breaking change, why not release it sooner rather than later? component.unmount()
component.update()
component.emitted() // if feature request gets accepted Arguably, but a minor inconvenience is that you will have some line breaks if we have many function props, making the code more verbose in some situtations.. test('some test description', ({
page,
mount,
update,
unmount
}) => {
// arrange, act, expect
}) Maybe i'm nitpicking here, but would like to know what you think. |
We have until v1.25 branch point to make this decision. I agree with your points, we can put those calls on the Locator subclass. The unfortunate bit is that they might end up being different for each framework, but I guess we can live with it. Do you want to send a patch that does it? |
Partial fix for microsoft#15919
closes: #15057 closes: #15919 Signed-off-by: sand4rt <[email protected]>
Hey guys any documentation on this? I've just been winging it until now would be nice to see some solid examples! |
Hey @basickarl help is definitely appreciated :) feel free to add more topics/idea's in the ticket above |
Can the
update
and theunmount
functions be added? This is useful for Vue, React and Svelte:TODO
The text was updated successfully, but these errors were encountered: