-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Execution View Test #612
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b115ad2
fix: test for executions table
james-union e93a333
fix: execution node table with filter state
james-union 3f6a0a1
fix: reduce code duplication in tests, fix loading in table
james-union 0b40fab
fix: add tests for execution tab content
james-union 2cdf784
fix: remove filter unknown nodes
james-union 37182b5
fix: added filteredNodeExecutions to make filter work
james-union 86fcf88
fix: tests feedback
olga-union c09a073
Merge branch 'devmain' of https://github.com/flyteorg/flyteconsole in…
olga-union 06cd89d
fix: execution node views
olga-union File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the WaitForQuery component already takes in a loading component, why do we need the extra check on line 148?