Skip to content

Commit

Permalink
Add VRT story highlighting the bug/issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Oct 31, 2024
1 parent 54bf470 commit 76ba1b0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/eui/.storybook/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const customWithin = (canvasElement: HTMLElement) => {
await waitFor(() =>
expect(canvasElement.querySelector('[data-popover-open]')).toBeVisible()
),
waitForEuiPopoverHidden: async () =>
await waitFor(() =>
expect(
canvasElement.querySelector('[data-popover-panel]')
).not.toBeInTheDocument()
),
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import moment from 'moment';
import type { Meta, StoryObj } from '@storybook/react';
import { expect } from '@storybook/test';
import { expect, waitFor, fireEvent } from '@storybook/test';
import { within } from '../../../../.storybook/test';
import { LOKI_SELECTORS } from '../../../../.storybook/loki';
import { enableFunctionToggleControls } from '../../../../.storybook/utils';
Expand Down Expand Up @@ -123,3 +123,49 @@ function CustomPanel({ applyTime }: { applyTime?: ApplyTime }) {
<EuiLink onClick={applyMyCustomTime}>Entire dataset timerange</EuiLink>
);
}

/**
* VRT only
*/
export const OverflowingChildren: Story = {
tags: ['vrt-only'],
args: {
start: 'Dec 31, 1999',
end: 'Jan 1, 2000',
},
decorators: [
(Story) => (
<div style={{ maxWidth: 400 }}>
<Story />
</div>
),
],
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement);

step('Switch to longer absolute text', async () => {
await waitFor(async () => {
const startButton = canvas.getByTestSubject(
'superDatePickerstartDatePopoverButton'
);
const endButton = canvas.getByTestSubject(
'superDatePickerendDatePopoverButton'
);
const getAbsoluteTab = () =>
canvas.getByTestSubject('superDatePickerAbsoluteTab');

await fireEvent.click(startButton);
await canvas.waitForEuiPopoverVisible();
await fireEvent.click(getAbsoluteTab());
await fireEvent.click(startButton);
await canvas.waitForEuiPopoverHidden();

await fireEvent.click(endButton);
await canvas.waitForEuiPopoverVisible();
await fireEvent.click(getAbsoluteTab());
await fireEvent.click(endButton);
await canvas.waitForEuiPopoverHidden();
});
});
},
};

0 comments on commit 76ba1b0

Please sign in to comment.