Svelte API
Methods​
mount​
import { mount } from 'cypress/svelte'
| Description | Mounts a Svelte component inside the Cypress browser |
| Signature | mount(Component: Component<Record<string, any>, Record<string, any>, any>, options?: MountOptions): Cypress.Chainable<MountReturn> |
| Returns | Cypress.Chainable<MountReturn> |
| Name | Type | Description |
| component | Component<Record<string, any>, Record<string, any>, any> | Svelte component being mounted |
| options | MountOptions (optional) | options to customize the component being mounted |
Example​
import Counter from './Counter.svelte'
import { mount } from 'cypress/svelte'
it('should render', () => {
mount(Counter, { props: { count: 42 } })
cy.get('button').contains(42)
})
Interfaces​
MountOptions​
| Name | Type | Description |
| anchor | Element (optional) | |
| context | Map<any, any> (optional) | |
| intro | boolean (optional) | |
| log | boolean (optional) | |
| props | Record<string any> (optional) |
MountReturn​
Type that the mount function yields
| Name | Type | Description |
| component | Record<string, any> |