diff --git a/libs/e2e/src/lib/describer/modelAssessment/Constants.ts b/libs/e2e/src/lib/describer/modelAssessment/Constants.ts index 555265d38c..29fa148c49 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/Constants.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/Constants.ts @@ -30,6 +30,7 @@ export enum Locators { SortByDropdown = "#featureImportanceChartContainer div.ms-Dropdown-container", SortByDropdownOptions = "div[class^='dropdownItemsWrapper'] button:contains('CohortCreateE2E')", CreateNewCohortButton = "button:contains('New cohort')", + CohortEditPanel = "#cohortEditPanel", CohortNameInput = "#cohortEditPanel input:eq(0)", CohortDatasetValueInput = "#cohortEditPanel input[class^='ms-spinButton-input']", CohortFilterSelection = "#cohortEditPanel [type='radio']", @@ -89,6 +90,7 @@ export enum Locators { CausalAnalysisHeader = "#ModelAssessmentDashboard #causalAnalysisHeader", ErrorAnalysisHeader = "#ModelAssessmentDashboard #errorAnalysisHeader", MSSideBarCards = "#OverallMetricChart div[class^='statsBox']", + AxisConfigPanel = "#AxisConfigPanel", MSSideBarNumberOfBinsInput = "#AxisConfigPanel input[class^='ms-spinButton-input']", MSScrollable = "#OverallMetricChart div[class^='scrollableWrapper']", MSCohortDropdown = "#modelPerformanceCohortPicker", diff --git a/libs/e2e/src/lib/describer/modelAssessment/dataExplorer/describeCohortFunctionality.ts b/libs/e2e/src/lib/describer/modelAssessment/dataExplorer/describeCohortFunctionality.ts index ef3bccf433..b1f9c91f9c 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/dataExplorer/describeCohortFunctionality.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/dataExplorer/describeCohortFunctionality.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { generateId } from "../../../../util/generateId"; import { Locators } from "../Constants"; import { IModelAssessmentData } from "../IModelAssessmentData"; -const cohortName = "CohortCreateE2E"; export function describeCohortFunctionality( dataShape: IModelAssessmentData ): void { @@ -34,11 +34,12 @@ export function describeCohortFunctionality( }); it("Should update dataset selection with new cohort when a new cohort is created", () => { cy.get(Locators.CreateNewCohortButton).click(); - cy.get("#cohortEditPanel").should("exist"); + cy.get(Locators.CohortEditPanel).should("exist"); + const cohortName = `CohortCreateE2E-${generateId(4)}`; cy.get(Locators.CohortNameInput).clear().type(cohortName); cy.get(Locators.CohortFilterSelection).eq(1).check(); // select Dataset - cy.get(Locators.CohortDatasetValueInput).then(($input) => { - if ($input.length > 0) { + cy.get(Locators.CohortEditPanel).then(($panel) => { + if ($panel.find(Locators.CohortDatasetValueInput).length > 0) { cy.get(Locators.CohortDatasetValueInput) .clear() .type(dataShape.datasetExplorerData?.cohortDatasetNewValue || ""); @@ -46,7 +47,7 @@ export function describeCohortFunctionality( }); cy.get(Locators.CohortAddFilterButton).click(); cy.get(Locators.CohortSaveAndSwitchButton).eq(0).click({ force: true }); - cy.get(Locators.NewCohortSpan).should("exist"); + cy.get(`span:contains(${cohortName})`).should("exist"); cy.get(Locators.DECohortDropdown).click(); cy.get(Locators.DEDropdownOptions).should("exist"); diff --git a/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts b/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts index 5ad9e5a2ae..56eae4b941 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts @@ -72,7 +72,7 @@ const modelAssessmentDatasets = { xAxisNewValue: "Probability : <=50K", yAxisNewPanelValue: "Dataset", yAxisNewValue: "age", - yAxisNumberOfBins: "8" + yAxisNumberOfBins: "5" }, whatIfCounterfactualsData: { checkForClassField: true, @@ -143,7 +143,7 @@ const modelAssessmentDatasets = { xAxisNewValue: "Error", yAxisNewPanelValue: "Dataset", yAxisNewValue: "age", - yAxisNumberOfBins: "8" + yAxisNumberOfBins: "5" }, whatIfCounterfactualsData: { checkForClassField: false, @@ -209,7 +209,7 @@ const modelAssessmentDatasets = { xAxisNewValue: "Error", yAxisNewPanelValue: "Dataset", yAxisNewValue: "age", - yAxisNumberOfBins: "8" + yAxisNumberOfBins: "5" }, whatIfCounterfactualsData: { checkForClassField: false, @@ -302,7 +302,7 @@ const modelAssessmentDatasets = { xAxisNewValue: "Probability : Less than median", yAxisNewPanelValue: "Dataset", yAxisNewValue: "LotFrontage", - yAxisNumberOfBins: "8" + yAxisNumberOfBins: "5" }, whatIfCounterfactualsData: { checkForClassField: true, @@ -452,7 +452,7 @@ const modelAssessmentDatasets = { xAxisNewValue: "Probability : 0", yAxisNewPanelValue: "Dataset", yAxisNewValue: "alcohol", - yAxisNumberOfBins: "8" + yAxisNumberOfBins: "5" }, whatIfCounterfactualsData: { hasWhatIfCounterfactualsComponent: false diff --git a/libs/e2e/src/lib/describer/modelAssessment/modelStatistics/describeModelPerformanceSideBar.ts b/libs/e2e/src/lib/describer/modelAssessment/modelStatistics/describeModelPerformanceSideBar.ts index 7a0cfe6545..5a70ee8557 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/modelStatistics/describeModelPerformanceSideBar.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/modelStatistics/describeModelPerformanceSideBar.ts @@ -31,16 +31,21 @@ export function describeModelPerformanceSideBar( `${Locators.DECChoiceFieldGroup} label:contains(${dataShape.modelStatisticsData?.yAxisNewPanelValue})` ) .click(); - cy.get(Locators.MSSideBarNumberOfBinsInput) - .clear() - .type(dataShape.modelStatisticsData?.yAxisNumberOfBins || "8"); + cy.get(Locators.AxisConfigPanel).then(($panel) => { + if ($panel.find(Locators.MSSideBarNumberOfBinsInput).length > 0) { + cy.get(Locators.MSSideBarNumberOfBinsInput) + .clear() + .type(dataShape.modelStatisticsData?.yAxisNumberOfBins || "5"); + } + }); + cy.get(Locators.SelectButton).click(); cy.get(`${Locators.MSCRotatedVerticalBox}`).contains( dataShape.modelStatisticsData?.yAxisNewValue || "age" ); cy.get(Locators.MSSideBarCards).should( "have.length", - dataShape.modelStatisticsData?.yAxisNumberOfBins || "8" + dataShape.modelStatisticsData?.yAxisNumberOfBins || "5" ); // Side bar should be scrollable when data cards overflows cy.get(Locators.MSScrollable).should("exist");