mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-19 05:02:40 +08:00
revamp tests
This commit is contained in:
parent
9a1fce8222
commit
30642d2913
@ -31,9 +31,10 @@ export const Step = {
|
||||
export const TypeAndClear = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await userEvent.type(canvas.getByTestId('value'), 'initial value');
|
||||
await userEvent.clear(canvas.getByTestId('value'));
|
||||
await userEvent.type(canvas.getByTestId('value'), 'final value');
|
||||
// TODO: seems like userEvent.type + userEvent.clear + userEvent.type is not working for Svelte and Vue2/3. We should probably investigate, might be a bug in userEvent or in our implementation.
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'initial value' } });
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: '' } });
|
||||
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'final value' } });
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -66,9 +66,9 @@ test.describe('addon-interactions', () => {
|
||||
const panel = sbPage.panelContent();
|
||||
const runStatusBadge = await panel.locator('[aria-label="Status of the test run"]');
|
||||
await expect(runStatusBadge).toContainText(/Pass/);
|
||||
await expect(panel).toContainText(/initial value/);
|
||||
await expect(panel).toContainText(/userEvent.clear/);
|
||||
await expect(panel).toContainText(/final value/);
|
||||
await expect(panel).toContainText(/value: "initial value"/);
|
||||
await expect(panel).toContainText(/value: ""/);
|
||||
await expect(panel).toContainText(/value: "final value"/);
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
// Test interactions debugger - Stepping through works, count is correct and values are as expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user