storybook/docs/snippets/vue/portable-stories-cypress-ct-async.ts.mdx
2024-02-27 11:09:30 -07:00

27 lines
648 B
Plaintext

```ts
// Button.test.ts
import { composeStories } from '@storybook/vue3';
import * as stories from './Button.stories';
const { CSF3Primary } = composeStories(stories);
describe('<Button />', () => {
it('renders with loaders and play function', () => {
cy.then(async () => {
await CSF3Primary.load();
});
cy.mount(CSF3Primary());
cy.then(async () => {
await CSF3Primary.play({
// data-cy-root is Cypress "App". The top-most wrapping element
canvasElement: document.querySelector('[data-cy-root]'),
});
// Cypress assertions happen inside of this scope, after play
});
});
});
```