You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2022/09/12 12:39:21 UTC
[superset] branch master updated: test: Fix act errors in CustomFrame test (#21427)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new cf7c420e01 test: Fix act errors in CustomFrame test (#21427)
cf7c420e01 is described below
commit cf7c420e01628513c6a2559698c2a7d72b9450df
Author: Lyndsi Kay Williams <55...@users.noreply.github.com>
AuthorDate: Mon Sep 12 07:39:08 2022 -0500
test: Fix act errors in CustomFrame test (#21427)
---
.../controls/DateFilterControl/components/CustomFrame.test.tsx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.test.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.test.tsx
index aa7da5fedf..811e50e7fa 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.test.tsx
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.test.tsx
@@ -24,6 +24,8 @@ import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import { CustomFrame } from '.';
+jest.useFakeTimers();
+
const emptyValue = '';
const nowValue = 'now : now';
const todayValue = 'today : today';
@@ -137,7 +139,7 @@ test('triggers onChange when the value changes', () => {
expect(onChange).toHaveBeenCalled();
});
-test('triggers onChange when the mode changes', () => {
+test('triggers onChange when the mode changes', async () => {
const onChange = jest.fn();
render(
<Provider store={store}>
@@ -145,8 +147,12 @@ test('triggers onChange when the mode changes', () => {
</Provider>,
);
userEvent.click(screen.getByTitle('Midnight'));
+ expect(await screen.findByTitle('Relative Date/Time')).toBeInTheDocument();
userEvent.click(screen.getByTitle('Relative Date/Time'));
userEvent.click(screen.getAllByTitle('Now')[1]);
+ expect(
+ await screen.findByText('Configure custom time range'),
+ ).toBeInTheDocument();
userEvent.click(screen.getAllByTitle('Specific Date/Time')[1]);
expect(onChange).toHaveBeenCalledTimes(2);
});
@@ -159,8 +165,10 @@ test('triggers onChange when the grain changes', async () => {
</Provider>,
);
userEvent.click(screen.getByText('Days Before'));
+ expect(await screen.findByText('Weeks Before')).toBeInTheDocument();
userEvent.click(screen.getByText('Weeks Before'));
userEvent.click(screen.getByText('Days After'));
+ expect(await screen.findByText('Weeks After')).toBeInTheDocument();
userEvent.click(screen.getByText('Weeks After'));
expect(onChange).toHaveBeenCalledTimes(2);
});