Skip to content
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

Update the way to get the length of elements obtained in e2e tests #1450

Merged
merged 3 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/e2e/src/lib/describer/modelAssessment/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export enum Locators {
WhatIfScatterChartYAxis = "#IndividualFeatureContainer div[class^='rotatedVerticalBox']",
WhatIfScatterChartFlyoutCancel = "#AxisConfigPanel button:contains('Cancel')",
WhatIfScatterChartFlyoutSelect = "#AxisConfigPanel button:contains('Select')",
WhatIfScatterChartSelectFeatureCaretButton = "#AxisConfigPanel i[data-icon-name='ChevronDown']",
WhatIfAxisPanel = "#AxisConfigPanel",
AxisFeatureDropdown = "#AxisConfigPanel div.ms-ComboBox-container",
AxisFeatureDropdownOption = "div.ms-ComboBox-optionsContainerWrapper button[role='option']",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ export function describeAggregateCausalAffects(
});

it("should render feature names on x-axis that are passed in from SDK", () => {
cy.get(Locators.CausalChartXAxisValues)
.its("length")
.should(
"be",
dataShape.causalAnalysisData?.featureListInCausalTable?.length
);
cy.get(Locators.CausalChartXAxisValues).should(
"have.length",
dataShape.causalAnalysisData?.featureListInCausalTable?.length
);
cy.get(`${Locators.CausalChartXAxisValues}`)
.last()
.invoke("text")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ export function describeSubBarChart(dataShape: IModelAssessmentData): void {
);
});
it("should have right number of x axis labels", () => {
cy.get(Locators.IFIXAxisValue)
.its("length")
.should("be", props.dataShape.featureNames?.length);
cy.get(Locators.IFIXAxisValue).should(
"have.length",
props.dataShape.featureNames?.length
);
});

it("should update x axis labels on changing top features by their importance number", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function describeSubLineChart(
selectRow("Index", "4");
});
it("should have more than one point", () => {
cy.get(Locators.ICENoOfPoints).its("length").should("be.gte", 1);
cy.get(Locators.ICENoOfPoints).then(($noOfPoints) => {
expect($noOfPoints).length.to.be.at.least(1);
});
});

it("should update x-axis value when 'Feature' dropdown is changed", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function describeAxisFlyouts(dataShape: IModelAssessmentData): void {
"have.length",
dataShape.featureNames?.length
);
cy.get(Locators.WhatIfScatterChartSelectFeatureCaretButton).click();
cy.get(Locators.WhatIfScatterChartFlyoutCancel).click();
});
it("should be able to select different feature", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export function describeSubBarChart(dataShape: IModelAssessmentData): void {
).should("contain.text", "Feature importance");
});
it("should have right number of x axis labels", () => {
cy.get("#WhatIfFeatureImportanceBar g.highcharts-xaxis-labels text")
.its("length")
.should("be", props.dataShape.featureNames?.length);
cy.get(
"#WhatIfFeatureImportanceBar g.highcharts-xaxis-labels text"
).should("have.length", props.dataShape.featureNames?.length);
});
});
}