[ACA-4492] - Start restyling of search sorting (#2190)

* Started adding search sorting refactoring

* [ACA-4492] - attempt to fix e2e with new sorting menu

* [ACA-4436] - fixed linting

* [ACA-4436] - fixed linting

* fixed lint

* [ACA-4492] - fixed e2e with new sorting

* [ACA-4492] - fixed e2e with new sorting
This commit is contained in:
Vito
2021-07-12 10:27:30 +01:00
committed by GitHub
parent bc40d6f08b
commit 7d66579423
9 changed files with 265 additions and 74 deletions

View File

@@ -89,109 +89,93 @@ describe('Search sorting', () => {
it('[C277722] Sorting options are displayed', async () => {
expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed');
expect(await page.sortingPicker.isSortByOptionDisplayed()).toBe(true, 'Sort options not displayed');
expect(await page.sortingPicker.getSortOrder()).toBe('DESC', 'Incorrect default sort order');
expect(await page.sortingPicker.getSelectedSortByOption()).toBe('Relevance', 'Incorrect selected sort option');
await page.sortingPicker.clickSortByDropdown();
const expectedOptions = ['Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type'];
expect(await page.sortingPicker.getSortByOptionsList()).toEqual(expectedOptions, 'Incorrect sort options list');
const optionListed = await page.sortingPicker.getSortByOptionsList();
expect(optionListed).toEqual(expectedOptions, 'Incorrect sort options list');
});
it('[C277728] Sort by Name', async () => {
await page.sortingPicker.sortBy('Filename');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Filename', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Filename');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Filename', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
});
it('[C277740] Sort by Type', async () => {
await page.sortingPicker.sortBy('Type');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Type', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortBy('Type');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Type', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
});
it('[C277738] Sort by Size', async () => {
await page.sortingPicker.sortBy('Size');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Size', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortBy('Size');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Size', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
});
it('[C277734] Sort by Created date', async () => {
await page.sortingPicker.sortBy('Created date');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Created date', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Created date');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Created date', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
});
it('[C277736] Sort by Modified date', async () => {
await page.sortingPicker.sortBy('Modified date');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Modified date', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Modified date');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Modified date', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
});
it('[C277727] Sort by Relevance', async () => {
await page.sortingPicker.sortBy('Relevance');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Relevance', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Relevance');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Relevance', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
});
it('[C277732] Sort by Modifier', async () => {
await page.sortingPicker.sortBy('Modifier');
await page.sortingPicker.setSortOrderASC();
await page.sortingPicker.sortBy('Modifier', 'asc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Modifier');
await page.sortingPicker.setSortOrderDESC();
await page.sortingPicker.sortBy('Modifier', 'desc');
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);