diff --git a/public/pages/workflow_detail/resizable_workspace.tsx b/public/pages/workflow_detail/resizable_workspace.tsx index f08744f8..73f54b56 100644 --- a/public/pages/workflow_detail/resizable_workspace.tsx +++ b/public/pages/workflow_detail/resizable_workspace.tsx @@ -237,7 +237,7 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) { - + { +describe('WorkflowDetail with create ingestion', () => { Object.values(WORKFLOW_TYPE).forEach((type) => { test(`renders the page with ${type} type`, async () => { const { @@ -104,13 +104,13 @@ describe('WorkflowDetail', () => { expect(searchPipelineButton).toBeInTheDocument(); expect(searchPipelineButton).toBeDisabled(); - // // "Create an ingest pipeline" option should be selected by default - // const createIngestRadio = getByLabelText('createIngestPipelineOption'); - // expect(createIngestRadio).toBeChecked(); + // "Create an ingest pipeline" option should be selected by default + const createIngestRadio = container.querySelector("#create"); + expect(createIngestRadio).toBeChecked(); - // // "Skip ingestion pipeline" option should be disabled by default - // const skipIngestRadio = getByTestId('skipIngestPipelineOption'); - // expect(skipIngestRadio).not.toBeChecked(); + // "Skip ingestion pipeline" option should be disabled by default + const skipIngestRadio = container.querySelector("#skip"); + expect(skipIngestRadio).not.toBeChecked(); // Clicking the "Export" button should open the export component await waitFor(() => userEvent.click(getByTestId('exportButton'))); @@ -127,65 +127,64 @@ describe('WorkflowDetail', () => { await waitFor(() => userEvent.click(jsonButton)); expect(jsonButton).toHaveClass('euiFilterButton-hasActiveFilters'); - // Testing collapsible Tools panel - const toolsPanel = getByTestId('toolsPanelCollapseButton'); // Assuming the collapse button has the 'toolsPanelCollapseButton' test id - - const toolsPanelContainer = getByTestId('toolsPanelId'); // Assuming the Tools panel has a test ID 'toolsPanel' - - // Initial state: Tools panel should be open and not collapsed - expect(getByText('Tools')).toBeVisible(); - expect(toolsPanelContainer).not.toHaveClass( + + // Testing collapsible Tools panel + // Get the initial state of the Tools panel + + const toolsPanelInitially = container.querySelector('#tools_panel_id'); + expect(toolsPanelInitially).toBeVisible(); + // Find and click the button to adjust panel sizes + // const adjustPanelSizeButton = getByTestId('toolsPanelSizeAdjustButton'); + // // const adjustPanelSizeButton = container.querySelector( + // // 'button[aria-label="Press up or down to adjust panels size"].euiResizableButton--vertical' + // // ); + // expect(adjustPanelSizeButton).toBeInTheDocument(); + //console.log("toolsPanelInitially printed", toolsPanelInitially); + // await waitFor(() => userEvent.click(adjustPanelSizeButton!)); + // Find the toggle button for the Tools panel + const toggleButton = toolsPanelInitially?.querySelector( + 'button[type="button"]' + // aria-label="Press to toggle this panel"].euiResizableToggleButton--vertical' + ); + //console.log("toggleButton printed", toggleButton); + expect(toggleButton).toBeInTheDocument(); + // expect(toggleButton).toHaveClass('euiResizableToggleButton-isVisible'); + // Collapse the Tools panel + await waitFor(() => userEvent.click(toggleButton!)); + const toolsPanelAfterCollapse = container.querySelector( + '#tools_panel_id' + )!; + expect(toolsPanelAfterCollapse).toHaveClass( 'euiResizablePanel-isCollapsed' ); - - // Click to collapse the Tools panel - await waitFor(() => userEvent.click(toolsPanel)); - - // After collapsing, the Tools panel should not be visible and should have the collapsed class - // expect(getByText('Tools')).not.toBeVisible(); - expect(toolsPanelContainer).toHaveClass('euiResizablePanel-isCollapsed'); - - // Click again to expand the Tools panel - await waitFor(() => userEvent.click(toolsPanel)); - - // After expanding, the Tools panel should be visible and should not have the collapsed class - expect(getByText('Tools')).toBeVisible(); - expect(toolsPanelContainer).not.toHaveClass( + // Expand the Tools panel + await waitFor(() => userEvent.click(toggleButton!)); + const toolsPanelAfterExpand = container.querySelector('#tools_panel_id')!; + expect(toolsPanelAfterExpand).not.toHaveClass( 'euiResizablePanel-isCollapsed' ); - // // Testing collapsible Tools panel - // // // Get the initial state of the Tools panel - // // const toolsPanelInitially = container.querySelector('#tools_panel_id'); - // // expect(toolsPanelInitially).toBeVisible(); - // // Find and click the button to adjust panel sizes - // const adjustPanelSizeButton = getByTestId('toolsPanelCollapseButton'); - // expect(adjustPanelSizeButton).toBeInTheDocument(); - // await waitFor(() => userEvent.click(adjustPanelSizeButton!)); - // // Find the toggle button for the Tools panel - // const toggleButton = container.querySelector( - // 'button[aria-label="Press to toggle this panel"].euiResizableToggleButton--vertical' - // ); - // expect(toggleButton).toBeInTheDocument(); - // expect(toggleButton).toHaveClass('euiResizableToggleButton-isVisible'); - // // Collapse the Tools panel - // await waitFor(() => userEvent.click(toggleButton!)); - // const toolsPanelAfterCollapse = container.querySelector( - // '#tools_panel_id' - // )!; - // expect(toolsPanelAfterCollapse).toHaveClass( - // 'euiResizablePanel-isCollapsed' - // ); - // // Expand the Tools panel - // await waitFor(() => userEvent.click(toggleButton!)); - // const toolsPanelAfterExpand = container.querySelector('#tools_panel_id')!; - // expect(toolsPanelAfterExpand).not.toHaveClass( - // 'euiResizablePanel-isCollapsed' - // ); - // Clicking the "close" button should go back to the list page await waitFor(() => userEvent.click(getByTestId('closeButton'))); expect(history.location.pathname).toBe('/workflows'); }); }); }); + +describe('WorkflowDetail skip ingestion pipeline', () => { + Object.values(WORKFLOW_TYPE).forEach((type) => { + test(`renders the page with ${type} type`, async () => { + const { + container, + } = renderWithRouter(workflowId, workflowName, type); + + const skipIngestRadio = container.querySelector("#skip"); + expect(skipIngestRadio).not.toBeChecked(); + + // Clicking the "Export" button should open the export component + await waitFor(() => userEvent.click(skipIngestRadio!)); + expect(skipIngestRadio).toBeChecked(); + + }); + }); +}); diff --git a/public/pages/workflow_detail/workflow_inputs/workflow_inputs.tsx b/public/pages/workflow_detail/workflow_inputs/workflow_inputs.tsx index 64898856..3d28561b 100644 --- a/public/pages/workflow_detail/workflow_inputs/workflow_inputs.tsx +++ b/public/pages/workflow_detail/workflow_inputs/workflow_inputs.tsx @@ -657,7 +657,7 @@ export function WorkflowInputs(props: WorkflowInputsProps) { Create an ingest pipeline @@ -673,7 +673,7 @@ export function WorkflowInputs(props: WorkflowInputsProps) { Skip ingestion pipeline