Skip to content

Commit

Permalink
Update workflow_detail.test.tsx
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Medhini Reddy Maryada <[email protected]>
  • Loading branch information
saimedhi authored Sep 10, 2024
1 parent 68c43af commit 182b7d4
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions public/pages/workflow_detail/workflow_detail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('WorkflowDetail', () => {
const history = createMemoryHistory({
initialEntries: [`/workflow/${workflowId}`],
});
const { getAllByText, getByText, getByRole } = renderWithRouter(
const { getAllByText, getByText, getByRole, getAllByRole, container } = renderWithRouter(
workflowId,
workflowName,
type,
Expand Down Expand Up @@ -107,12 +107,54 @@ describe('WorkflowDetail', () => {
expect(createRadio).toBeChecked();
expect(skipRadio).not.toBeChecked();

// Testing closing the WorkflowDetail
expect(getByText('Close')).toBeInTheDocument();

// Testing Export button
await waitFor(() =>
userEvent.click(getByRole('button', { name: 'Export' }))
);
expect(getByText('Export '+ workflowName)).toBeInTheDocument();

// closing the Export
await waitFor(() =>
userEvent.click(getByRole('button', { name: 'Close' }))
);
expect(
getAllByText((content) => content.startsWith('Last updated:')).length
).toBeGreaterThan(0);

// Testing collapsible Tools panel
await waitFor(() => {
const button = container.querySelector(
'button[aria-label="Press to toggle this panel"].euiResizableToggleButton--vertical'
);
userEvent.click(button!);

// userEvent.click(getAllByRole('button', { name: 'Press to toggle this panel' })[0]);
});

// Check if the "Tools" text is hidden
const toolsText = getByText('Tools');
expect(toolsText).not.toBeVisible(); // Assert that "Tools" is hidden

await waitFor(() => {
const button = container.querySelector(
'button[aria-label="Press to toggle this panel"].euiResizableToggleButton--vertical'
);
userEvent.click(button!);





// Testing closing the WorkflowDetail
await waitFor(() =>
userEvent.click(getByRole('button', { name: 'Close' }))
);
expect(history.location.pathname).toBe('/workflows');
// expect(
// getAllByText((content) => content.startsWith('Last updated:')).length
// ).toBeGreaterThan(0);
});
});
});

0 comments on commit 182b7d4

Please sign in to comment.