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

feat: add e2e tests for multi-sort filter on experiments list #9968

Closed
wants to merge 8 commits into from
8 changes: 4 additions & 4 deletions webui/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webui/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"jsdom": "^16.7.0",
"morgan": "^1.10.0",
"npm-force-resolutions": "0.0.10",
"playwright-page-model-base": "npm:@hpe.com/playwright-page-model-base@^0.2.5",
"playwright-page-model-base": "npm:@hpe.com/playwright-page-model-base@^0.2.8",
"prettier": "^3.2.5",
"request": "^2.88.2",
"resize-observer-polyfill": "^1.5.1",
Expand Down
58 changes: 56 additions & 2 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test.describe('Experiment List', () => {
});
});

test('Column Picker Show All and Hide All', async () => {
test.skip('Column Picker Show All and Hide All', async () => {
const columnPicker = projectDetailsPage.f_experimentList.tableActionBar.columnPickerMenu;
const grid = projectDetailsPage.f_experimentList.dataGrid;
let previousTabs = grid.headRow.columnDefs.size;
Expand Down Expand Up @@ -194,7 +194,7 @@ test.describe('Experiment List', () => {
});
});

test('Table Filter', async () => {
test.skip('Table Filter', async () => {
const tableFilter = projectDetailsPage.f_experimentList.tableActionBar.tableFilter;
const totalExperiments = await getCount();

Expand Down Expand Up @@ -286,6 +286,60 @@ test.describe('Experiment List', () => {
);
});

test('Multi-sort menu', async () => {
const checkTableOrder = async (firstKey: keyof ExperimentBase, secondKey: keyof ExperimentBase) => {
const experimentList: ExperimentBase[] = JSON.parse(await detExecSync('experiment ls'));

return [
{ [firstKey]: experimentList[0][firstKey], [secondKey]: experimentList[0][secondKey] },
{
[firstKey]: experimentList[experimentList.length - 1][firstKey],
[secondKey]: experimentList[experimentList.length - 1][secondKey],
},
];
};
const multiSortMenu = projectDetailsPage.f_experimentList.tableActionBar.multiSortMenu;

const sortingScenario = async (
thiagodallacqua-hpe marked this conversation as resolved.
Show resolved Hide resolved
firstSortBy: string,
firstSortOrder: string,
secondSortBy: string,
secondSortOrder: string,
scenario: () => Promise<void>,
) => {
await test.step(`Sort by ${firstSortBy} and ${secondSortBy}`, async () => {
await multiSortMenu.open();
await multiSortMenu.multiSort.reset.pwLocator.click();
await multiSortMenu.close();
await multiSortMenu.open();

const firstRow = multiSortMenu.multiSort.rows.nth(0);
await firstRow.column.selectMenuOption(firstSortBy);
await firstRow.order.selectMenuOption(firstSortOrder);

await multiSortMenu.multiSort.add.pwLocator.click();

const secondRow = multiSortMenu.multiSort.rows.nth(1);
await secondRow.column.selectMenuOption(secondSortBy);
await secondRow.order.selectMenuOption(secondSortOrder);

await multiSortMenu.close();
await scenario();
await waitTableStable();
});
};

await sortingScenario('ID', '9 → 0', 'Start time', 'Oldest → Newest', async () => {
const [higher, lower] = await checkTableOrder('id', 'startTime');
await expect(higher.id).toBeGreaterThan(lower.id as number);
});

await sortingScenario('Trial count', '0 → 9', 'Searcher', 'A → Z', async () => {
const [first, last] = await checkTableOrder('numTrials', 'searcherType');
await expect(first.numTrials).toBeLessThanOrEqual(last.numTrials as number);
});
});

test('Datagrid Functionality Validations', async ({ authedPage }) => {
const row = projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(0);
await test.step('Select Row', async () => {
Expand Down
Loading