|
| 1 | +import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database'; |
| 2 | +import { BrowserPage } from '../../../pageObjects'; |
| 3 | +import { |
| 4 | + commonUrl, |
| 5 | + ossStandaloneBigConfig |
| 6 | +} from '../../../helpers/conf'; |
| 7 | +import { KeyTypesTexts, rte } from '../../../helpers/constants'; |
| 8 | +import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database'; |
| 9 | +import { Common } from '../../../helpers/common'; |
| 10 | + |
| 11 | +const browserPage = new BrowserPage(); |
| 12 | +const common = new Common(); |
| 13 | + |
| 14 | +fixture `Key name filters history` |
| 15 | + .meta({ type: 'critical_path', rte: rte.standalone }) |
| 16 | + .page(commonUrl) |
| 17 | + .beforeEach(async() => { |
| 18 | + await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneBigConfig, ossStandaloneBigConfig.databaseName); |
| 19 | + }) |
| 20 | + .afterEach(async() => { |
| 21 | + // Delete database |
| 22 | + await deleteStandaloneDatabaseApi(ossStandaloneBigConfig); |
| 23 | + }); |
| 24 | +test('Recent filters history', async t => { |
| 25 | + const keysForSearch = ['device', 'mobile']; |
| 26 | + |
| 27 | + await browserPage.selectFilterGroupType(KeyTypesTexts.String); |
| 28 | + // Verify that user can not see filters per only key type in the history of results |
| 29 | + await t.expect(browserPage.showFilterHistoryBtn.exists).notOk('Filter history button displayed for key type search'); |
| 30 | + // Search by valid key |
| 31 | + await browserPage.searchByKeyName(`${keysForSearch[0]}*`); |
| 32 | + await browserPage.clearFilter(); |
| 33 | + |
| 34 | + // Verify that user can see the history query is automatically run once selected |
| 35 | + await t.click(browserPage.showFilterHistoryBtn); |
| 36 | + await t.click(browserPage.filterHistoryOption.nth(0)); |
| 37 | + for (let i = 0; i < 5; i++) { |
| 38 | + // Verify that keys are filtered |
| 39 | + await t.expect(browserPage.keyNameInTheList.nth(i).textContent).contains(keysForSearch[0], 'Keys not filtered by key name') |
| 40 | + .expect(browserPage.filteringLabel.nth(i).textContent).contains(KeyTypesTexts.String, 'Keys not filtered by key type'); |
| 41 | + } |
| 42 | + |
| 43 | + // Verify that user do not see duplicate history requests |
| 44 | + await browserPage.clearFilter(); |
| 45 | + await browserPage.selectFilterGroupType(KeyTypesTexts.String); |
| 46 | + await browserPage.searchByKeyName(`${keysForSearch[0]}*`); |
| 47 | + await t.click(browserPage.showFilterHistoryBtn); |
| 48 | + await t.expect(browserPage.filterHistoryItemText.withText(keysForSearch[0]).count).eql(1, 'Filter history requests can be duplicated in list'); |
| 49 | + |
| 50 | + // Refresh the page |
| 51 | + await common.reloadPage(); |
| 52 | + // Verify that user can see the list of filters even when reloading page |
| 53 | + await t.click(browserPage.showFilterHistoryBtn); |
| 54 | + await t.expect(browserPage.filterHistoryItemText.withText(keysForSearch[0]).exists).ok('Filter history requests not saved after reloading page'); |
| 55 | + |
| 56 | + // Open Tree view to check also there |
| 57 | + await t.click(browserPage.treeViewButton); |
| 58 | + // Search by 2nd key name |
| 59 | + await browserPage.searchByKeyName(`${keysForSearch[1]}*`); |
| 60 | + await t.click(browserPage.showFilterHistoryBtn); |
| 61 | + // Verify that user can remove saved filter from list by clicking on "X" |
| 62 | + await t.hover(browserPage.filterHistoryItemText.withText(keysForSearch[1])); |
| 63 | + await t.click(browserPage.filterHistoryOption.withText(keysForSearch[1]).find(browserPage.cssRemoveSuggestionItem)); |
| 64 | + await t.expect(browserPage.filterHistoryItemText.withText(keysForSearch[1]).exists).notOk('Filter history request not deleted'); |
| 65 | + |
| 66 | + // Verify that user can clear the history of requests |
| 67 | + await t.click(browserPage.clearFilterHistoryBtn); |
| 68 | + await t.expect(browserPage.showFilterHistoryBtn.exists).notOk('Filter history button displayed for key type search'); |
| 69 | +}); |
0 commit comments