-
Notifications
You must be signed in to change notification settings - Fork 468
Fix UI tests: update Cypress config and test assertions #2612
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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
110 changes: 57 additions & 53 deletions
110
...shboard-e2e/src/describer/interpret/individualFeatureImportance/describeDataPointChart.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,53 +1,57 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { ScatterChart } from "../../../util/ScatterChart"; | ||
| import { IInterpretData } from "../IInterpretData"; | ||
|
|
||
| import { describeSubBarChart } from "./describeSubBarChart"; | ||
| import { describeSubLineChart } from "./describeSubLineChart"; | ||
|
|
||
| export function describeDataPointChart(dataShape: IInterpretData): void { | ||
| describe("Individual datapoints chart", () => { | ||
| const props = { | ||
| chart: undefined as unknown as ScatterChart, | ||
| dataShape | ||
| }; | ||
| beforeEach(() => { | ||
| props.chart = new ScatterChart("#IndividualFeatureImportanceChart"); | ||
| }); | ||
| it("should render right number of points", () => { | ||
| expect(props.chart.Elements.length).equals(dataShape.datapoint); | ||
| }); | ||
|
|
||
| describe("Scatter chart clickable", () => { | ||
| it("should select none by default", () => { | ||
| cy.get( | ||
| '#IndividualFeatureContainer div[class^="legendAndText"] div[class^="clickTarget"]' | ||
| ).should("not.exist"); | ||
| }); | ||
| it("should show message on sub chart", () => { | ||
| const message = | ||
| !dataShape.noLocalImportance && !dataShape.noFeatureImportance | ||
| ? "Select a datapoint in the table above to view its local feature importances" | ||
| : "Provide local feature importances to see how each feature impacts individual predictions."; | ||
| cy.get("#subPlotContainer").should("contain.text", message); | ||
| }); | ||
| it("should select the first point", () => { | ||
| props.chart.clickNthPoint(0); | ||
| cy.get( | ||
| '#IndividualFeatureContainer div[class^="legendAndText"] div[class^="clickTarget"]' | ||
| ).should("contain.text", "Row"); | ||
| cy.get("#noPointSelectedInfo").should("not.exist"); | ||
| props.chart.clickNthPoint(0); | ||
| }); | ||
| }); | ||
|
|
||
| if (!dataShape.noLocalImportance && !dataShape.noFeatureImportance) { | ||
| describeSubBarChart(dataShape); | ||
| } | ||
| if (!dataShape.noPredict) { | ||
| describeSubLineChart(dataShape); | ||
| } | ||
| }); | ||
| } | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { ScatterChart } from "../../../util/ScatterChart"; | ||
| import { IInterpretData } from "../IInterpretData"; | ||
|
|
||
| import { describeSubBarChart } from "./describeSubBarChart"; | ||
| import { describeSubLineChart } from "./describeSubLineChart"; | ||
|
|
||
| export function describeDataPointChart(dataShape: IInterpretData): void { | ||
| describe("Individual datapoints chart", () => { | ||
| const props = { | ||
| chart: undefined as unknown as ScatterChart, | ||
| dataShape | ||
| }; | ||
| beforeEach(() => { | ||
| props.chart = new ScatterChart("#IndividualFeatureImportanceChart"); | ||
| }); | ||
| it("should render right number of points", () => { | ||
| // Wait for the chart to be fully rendered by checking for the scatter plot points | ||
| // Using the same selector pattern as ScatterChart.Elements getter | ||
| cy.get("#IndividualFeatureImportanceChart .trace.scatter .points path", { | ||
| timeout: 10000 | ||
| }).should("have.length", dataShape.datapoint); | ||
| }); | ||
|
|
||
| describe("Scatter chart clickable", () => { | ||
| it("should select none by default", () => { | ||
| cy.get( | ||
| '#IndividualFeatureContainer div[class^="legendAndText"] div[class^="clickTarget"]' | ||
| ).should("not.exist"); | ||
| }); | ||
| it("should show message on sub chart", () => { | ||
| const message = | ||
| !dataShape.noLocalImportance && !dataShape.noFeatureImportance | ||
| ? "Select a datapoint in the table above to view its local feature importances" | ||
| : "Provide local feature importances to see how each feature impacts individual predictions."; | ||
| cy.get("#subPlotContainer").should("contain.text", message); | ||
| }); | ||
| it("should select the first point", () => { | ||
| props.chart.clickNthPoint(0); | ||
| cy.get( | ||
| '#IndividualFeatureContainer div[class^="legendAndText"] div[class^="clickTarget"]' | ||
| ).should("contain.text", "Row"); | ||
| cy.get("#noPointSelectedInfo").should("not.exist"); | ||
| props.chart.clickNthPoint(0); | ||
| }); | ||
| }); | ||
|
|
||
| if (!dataShape.noLocalImportance && !dataShape.noFeatureImportance) { | ||
| describeSubBarChart(dataShape); | ||
| } | ||
| if (!dataShape.noPredict) { | ||
| describeSubLineChart(dataShape); | ||
| } | ||
| }); | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.