Skip to content

Commit

Permalink
Resolver/test panel presence (#73889)
Browse files Browse the repository at this point in the history
* Test for panel presence
  • Loading branch information
bkimmel authored Jul 31, 2020
1 parent 708a30a commit b0d51c8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,20 @@ export class Simulator {
return this.findInDOM('[data-test-subj="resolver:graph"]');
}

/**
* The outer panel container.
*/
public panelElement(): ReactWrapper {
return this.findInDOM('[data-test-subj="resolver:panel"]');
}

/**
* The panel content element (which may include tables, lists, other data depending on the view).
*/
public panelContentElement(): ReactWrapper {
return this.findInDOM('[data-test-subj^="resolver:panel:"]');
}

/**
* Like `this.wrapper.find` but only returns DOM nodes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ describe('Resolver, when analyzing a tree that has 1 ancestor and 2 children', (
expect(simulator.processNodeElements().length).toBe(3);
});

it(`should have the default "process list" panel present`, async () => {
expect(simulator.panelElement().length).toBe(1);
expect(simulator.panelContentElement().length).toBe(1);
const testSubjectName = simulator
.panelContentElement()
.getDOMNode()
.getAttribute('data-test-subj');
expect(testSubjectName).toMatch(/process-list/g);
});

describe("when the second child node's first button has been clicked", () => {
beforeEach(() => {
// Click the first button under the second child element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ PanelContent.displayName = 'PanelContent';

export const Panel = memo(function Event({ className }: { className?: string }) {
return (
<EuiPanel className={className}>
<EuiPanel className={className} data-test-subj="resolver:panel">
<PanelContent />
</EuiPanel>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ export const ProcessListWithCounts = memo(function ProcessListWithCounts({
<StyledBreadcrumbs breadcrumbs={crumbs} />
{showWarning && <StyledLimitWarning numberDisplayed={numberOfProcesses} />}
<EuiSpacer size="l" />
<EuiInMemoryTable<ProcessTableView> items={processTableView} columns={columns} sorting />
<EuiInMemoryTable<ProcessTableView>
data-test-subj="resolver:panel:process-list"
items={processTableView}
columns={columns}
sorting
/>
</>
);
});
Expand Down

0 comments on commit b0d51c8

Please sign in to comment.