revamp tests

This commit is contained in:
Yann Braga 2022-11-30 14:24:25 +01:00
parent 9a1fce8222
commit 30642d2913
2 changed files with 7 additions and 6 deletions

View File

@ -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' } });
},
};

View File

@ -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