-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: test for executions table Signed-off-by: James <[email protected]> * fix: execution node table with filter state Signed-off-by: James <[email protected]> * fix: reduce code duplication in tests, fix loading in table Signed-off-by: James <[email protected]> * fix: add tests for execution tab content Signed-off-by: James <[email protected]> * fix: remove filter unknown nodes Signed-off-by: James <[email protected]> * fix: added filteredNodeExecutions to make filter work Signed-off-by: James <[email protected]> * fix: tests feedback Signed-off-by: Olga Nad <[email protected]> * fix: execution node views Signed-off-by: Olga Nad <[email protected]> Signed-off-by: James <[email protected]> Signed-off-by: Olga Nad <[email protected]> Co-authored-by: Olga Nad <[email protected]>
- Loading branch information
1 parent
8c97c55
commit 5ab40b1
Showing
7 changed files
with
362 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...zapp/console/src/components/Executions/ExecutionDetails/test/ExecutionTabContent.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { NodeExecutionDetailsContextProvider } from 'components/Executions/contextProvider/NodeExecutionDetails'; | ||
import { NodeExecutionsByIdContext } from 'components/Executions/contexts'; | ||
import { basicPythonWorkflow } from 'mocks/data/fixtures/basicPythonWorkflow'; | ||
import { mockWorkflowId } from 'mocks/data/fixtures/types'; | ||
import { insertFixture } from 'mocks/data/insertFixture'; | ||
import { mockServer } from 'mocks/server'; | ||
import * as React from 'react'; | ||
import { QueryClient, QueryClientProvider } from 'react-query'; | ||
import { createTestQueryClient } from 'test/utils'; | ||
import { ExecutionTabContent } from '../ExecutionTabContent'; | ||
import { tabs } from '../constants'; | ||
|
||
jest.mock('components/Workflow/workflowQueries'); | ||
const { fetchWorkflow } = require('components/Workflow/workflowQueries'); | ||
|
||
jest.mock('components/common/DetailsPanel', () => ({ | ||
DetailsPanel: jest.fn(({ children }) => <div data-testid="details-panel">{children}</div>), | ||
})); | ||
|
||
jest.mock('components/Executions/Tables/NodeExecutionsTable', () => ({ | ||
NodeExecutionsTable: jest.fn(({ children }) => ( | ||
<div data-testid="node-executions-table">{children}</div> | ||
)), | ||
})); | ||
jest.mock('components/Executions/ExecutionDetails/Timeline/ExecutionTimeline', () => ({ | ||
ExecutionTimeline: jest.fn(({ children }) => ( | ||
<div data-testid="execution-timeline">{children}</div> | ||
)), | ||
})); | ||
jest.mock('components/Executions/ExecutionDetails/Timeline/ExecutionTimelineFooter', () => ({ | ||
ExecutionTimelineFooter: jest.fn(({ children }) => ( | ||
<div data-testid="execution-timeline-footer">{children}</div> | ||
)), | ||
})); | ||
jest.mock('components/WorkflowGraph/WorkflowGraph', () => ({ | ||
WorkflowGraph: jest.fn(({ children }) => <div data-testid="workflow-graph">{children}</div>), | ||
})); | ||
|
||
describe('Executions > ExecutionDetails > ExecutionTabContent', () => { | ||
let queryClient: QueryClient; | ||
let fixture: ReturnType<typeof basicPythonWorkflow.generate>; | ||
|
||
beforeEach(() => { | ||
queryClient = createTestQueryClient(); | ||
fixture = basicPythonWorkflow.generate(); | ||
insertFixture(mockServer, fixture); | ||
fetchWorkflow.mockImplementation(() => Promise.resolve(fixture.workflows.top)); | ||
}); | ||
|
||
const renderTabContent = ({ tabType, nodeExecutionsById }) => { | ||
return render( | ||
<QueryClientProvider client={queryClient}> | ||
<NodeExecutionDetailsContextProvider workflowId={mockWorkflowId}> | ||
<NodeExecutionsByIdContext.Provider value={nodeExecutionsById}> | ||
<ExecutionTabContent tabType={tabType} filteredNodeExecutions={[]} /> | ||
</NodeExecutionsByIdContext.Provider> | ||
</NodeExecutionDetailsContextProvider> | ||
</QueryClientProvider>, | ||
); | ||
}; | ||
|
||
it('renders NodeExecutionsTable when the Nodes tab is selected', async () => { | ||
const { queryByTestId } = renderTabContent({ | ||
tabType: tabs.nodes.id, | ||
nodeExecutionsById: {}, | ||
}); | ||
|
||
await waitFor(() => queryByTestId('node-executions-table')); | ||
expect(queryByTestId('node-executions-table')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders WorkflowGraph when the Graph tab is selected', async () => { | ||
const { queryByTestId } = renderTabContent({ | ||
tabType: tabs.graph.id, | ||
nodeExecutionsById: {}, | ||
}); | ||
|
||
await waitFor(() => queryByTestId('workflow-graph')); | ||
expect(queryByTestId('workflow-graph')).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders ExecutionTimeline when the Timeline tab is selected', async () => { | ||
const { queryByTestId } = renderTabContent({ | ||
tabType: tabs.timeline.id, | ||
nodeExecutionsById: {}, | ||
}); | ||
|
||
await waitFor(() => queryByTestId('execution-timeline')); | ||
expect(queryByTestId('execution-timeline')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.