Skip to content

Commit

Permalink
add frontend test
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Mar 1, 2022
1 parent 9c0fdf3 commit 3678612
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
18 changes: 18 additions & 0 deletions superset-frontend/src/views/CRUD/alert/AlertReportModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,22 @@ describe('AlertReportModal', () => {
await waitForComponentToPaint(wrapper);
expect(wrapper.find('textarea[name="recipients"]')).toHaveLength(1);
});

it('renders bypass cache checkbox', async () => {
const bypass = wrapper.find('[data-test="bypass-cache"]');
expect(bypass).toExist();
});

it('renders no bypass cache checkbox when alert', async () => {
const props = {
...mockedProps,
alert: mockData,
isReport: false,
};

const alertWrapper = await mountAndWait(props);

const bypass = alertWrapper.find('[data-test="bypass-cache"]');
expect(bypass).not.toExist();
});
});
23 changes: 12 additions & 11 deletions superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1368,19 +1368,20 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
)}
</StyledRadioGroup>
</div>
{isReport && (
<div className="inline-container">
<StyledCheckbox
className="checkbox"
checked={forceScreenshot}
onChange={onForceScreenshotChange}
>
Ignore cache when generating screenshot
</StyledCheckbox>
</div>
)}
</>
)}
{isReport && (
<div className="inline-container">
<StyledCheckbox
data-test="bypass-cache"
className="checkbox"
checked={forceScreenshot}
onChange={onForceScreenshotChange}
>
Ignore cache when generating screenshot
</StyledCheckbox>
</div>
)}
<StyledSectionTitle>
<h4>{t('Notification method')}</h4>
<span className="required">*</span>
Expand Down
7 changes: 0 additions & 7 deletions tests/integration_tests/reports/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,6 @@ def test_email_dashboard_report_schedule_force_screenshot(
notification_targets = get_target_from_report_schedule(
create_report_email_dashboard_force_screenshot
)
# assert that the link sent is correct
assert (
'<a href="http://0.0.0.0:8080/superset/dashboard/'
f"{create_report_email_dashboard_force_screenshot.id}"
'/?standalone=0&force=true">Explore in Superset</a>'
in email_mock.call_args[0][2]
)

# Assert the email smtp address
assert email_mock.call_args[0][0] == notification_targets[0]
Expand Down

0 comments on commit 3678612

Please sign in to comment.