Skip to content

Commit

Permalink
Add tests to check for feature importance when pagination is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Feb 10, 2023
1 parent 08af272 commit c3f9233
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ export default function ({ getService }: FtrProviderContext) {
await ml.dataFrameAnalyticsResults.assertFeatureImportancePopoverContent();
});

it('should display the feature importance decision path after changing page', async () => {
await ml.dataFrameAnalyticsResults.selectResultsTablePage(3);
await ml.dataFrameAnalyticsResults.assertResultsTableNotEmpty();
await ml.dataFrameAnalyticsResults.openFeatureImportancePopover();
await ml.dataFrameAnalyticsResults.assertFeatureImportancePopoverContent();
});

it('should display the histogram charts', async () => {
await ml.testExecution.logTestStep(
'displays the histogram charts when option is enabled'
Expand Down
15 changes: 15 additions & 0 deletions x-pack/test/functional/services/ml/common_data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,20 @@ export function MachineLearningCommonDataGridProvider({ getService }: FtrProvide
await browser.pressKeys(browser.keys.ESCAPE);
});
},

async assertActivePage(tableSubj: string, expectedPage: number) {
const table = await testSubjects.find(tableSubj);
const pagination = await table.findByClassName('euiPagination__list');
const activePage = await pagination.findByCssSelector(
'.euiPaginationButton[aria-current] .euiButtonEmpty__text'
);
const text = await activePage.getVisibleText();
expect(text).to.eql(expectedPage);
},

async selectPage(tableSubj: string, page: number) {
await testSubjects.click(`${tableSubj} > pagination-button-${page - 1}`);
await this.assertActivePage(tableSubj, page);
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export function MachineLearningDataFrameAnalyticsResultsProvider(
await testSubjects.existOrFail('mlExplorationDataGrid loaded', { timeout: 5000 });
},

async selectResultsTablePage(page: number) {
await commonDataGrid.selectPage('mlExplorationDataGrid loaded', page);
},

async assertResultsTableTrainingFiltersExist() {
await testSubjects.existOrFail('mlDFAnalyticsExplorationQueryBarFilterButtons', {
timeout: 5000,
Expand Down

0 comments on commit c3f9233

Please sign in to comment.