[Feature] component testing mount result
See original GitHub issueCan the update
and the unmount
functions be added? This is useful for Vue, React and Svelte:
test('update props', ({ mount }) => {
const component = await mount(Component, {
props: { name: 'test' }
});
await component.update({ props: { name: 'test2' }});
await expect(component).toHaveText('test2');
})
test('display a pending changes conformation', ({ mount }) => {
const component = await mount(Component);
await component.unmount();
await expect(component.locator('#conformation-dialog')).toBeVisible();
})
TODO
- update Svelte
- update Solid
- update React
- update Vue
- update Vue2
- unmount Svelte
- unmount Solid
- unmount React
- unmount Vue
- unmount Vue2
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Cypress Component Testing
Our Test Runner is browser-based, allowing you to test not only your component's functionality but also styles and appearance. You can visually see...
Read more >Testing React components with Cypress - CircleCI
This test suite first mounts the component with the cy.mount() command. It then checks to see if the input field has a placeholder...
Read more >How to perform Component Testing using Cypress
Step 1: Create a sample react application The component testing needs the application code to be present locally on the machine. Component ......
Read more >Getting started with Playwright component testing
By default, the component tests will be executed in a headless mode without opening the Chromium, Webkit, and Firefox browsers. Add the -- ......
Read more >JavaScript testing #3. Testing props, the mount function and ...
Tests that include using snapshots are quite useful. During such tests, the component is rendered and a snapshot of it is created. It...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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?
Have you taken into account that the
update
will not automatically be type safe as well if i follow the current implementation ofunmount
?instead of
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?
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…
Maybe i’m nitpicking here, but would like to know what you think.