From 01e4cf2871c41e70465d10a78e12e7b03e06af97 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Thu, 18 Apr 2019 18:12:49 +0200 Subject: [PATCH] speed up search test (#4626) --- e2e/proxy.ts | 3 +- e2e/search/components/search-checkList.e2e.ts | 23 +++++--- .../components/search-date-range.e2e.ts | 13 ++-- .../components/search-number-range.e2e.ts | 30 ++++------ e2e/search/components/search-radio.e2e.ts | 59 +++++-------------- e2e/search/components/search-slider.e2e.ts | 39 ++++++------ .../components/search-sorting-picker.e2e.ts | 52 +++++++--------- e2e/search/components/search-text.e2e.ts | 12 ++-- e2e/search/search-component.e2e.ts | 10 +--- e2e/search/search-filters.e2e.ts | 40 +++++-------- e2e/search/search-multiselect.e2e.ts | 3 - 11 files changed, 109 insertions(+), 175 deletions(-) diff --git a/e2e/proxy.ts b/e2e/proxy.ts index 09d1864eb0..4cec020e5f 100644 --- a/e2e/proxy.ts +++ b/e2e/proxy.ts @@ -21,7 +21,8 @@ import { browser } from 'protractor'; export async function setConfigField(field: string, value: string) { - return browser.executeScript( + await browser.executeScript( "window.adf.setConfigField(`" + field + "`, `" + value + "`);" ); + } diff --git a/e2e/search/components/search-checkList.e2e.ts b/e2e/search/components/search-checkList.e2e.ts index 54f7181a63..ad822f26e3 100644 --- a/e2e/search/components/search-checkList.e2e.ts +++ b/e2e/search/components/search-checkList.e2e.ts @@ -19,6 +19,7 @@ import { LoginPage } from '@alfresco/adf-testing'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; +import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; import { AcsUserModel } from '../../models/ACS/acsUserModel'; @@ -38,6 +39,7 @@ describe('Search Checklist Component', () => { const searchFiltersPage = new SearchFiltersPage(); const searchDialog = new SearchDialog(); const searchResults = new SearchResultsPage(); + const navigationBarPage = new NavigationBarPage(); const acsUser = new AcsUserModel(); const uploadActions = new UploadActions(); @@ -143,6 +145,8 @@ describe('Search Checklist Component', () => { }); it('[C277143] Should be able to click show more/less button with pageSize set as default', async () => { + navigationBarPage.clickContentServicesButton(); + for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) { jsonFile.categories[1].component.settings.options.push({ 'name': 'Folder', @@ -173,11 +177,11 @@ describe('Search Checklist Component', () => { searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed(); searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsNotDisplayed(); - - browser.refresh(); }); it('[C277144] Should be able to click show more/less button with pageSize set with a custom value', async () => { + navigationBarPage.clickContentServicesButton(); + jsonFile.categories[1].component.settings.pageSize = 10; for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) { @@ -196,6 +200,7 @@ describe('Search Checklist Component', () => { searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed(); + navigationBarPage.clickContentServicesButton(); jsonFile.categories[1].component.settings.pageSize = 11; await setConfigField('search', JSON.stringify(jsonFile)); @@ -207,7 +212,7 @@ describe('Search Checklist Component', () => { searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed(); - browser.refresh(); + navigationBarPage.clickContentServicesButton(); jsonFile.categories[1].component.settings.pageSize = 9; @@ -219,11 +224,11 @@ describe('Search Checklist Component', () => { expect(searchFiltersPage.checkListFiltersPage().getCheckListOptionsNumberOnPage()).toBe(9); searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsDisplayed(); - - browser.refresh(); }); it('[C277145] Should be able to click show more/less button with pageSize set to zero', async () => { + navigationBarPage.clickContentServicesButton(); + jsonFile.categories[1].component.settings.pageSize = 0; for (let numberOfOptions = 0; numberOfOptions < 8; numberOfOptions++) { @@ -250,7 +255,7 @@ describe('Search Checklist Component', () => { searchFiltersPage.checkListFiltersPage().checkShowMoreButtonIsNotDisplayed(); searchFiltersPage.checkListFiltersPage().checkShowLessButtonIsDisplayed(); - browser.refresh(); + navigationBarPage.clickContentServicesButton(); delete jsonFile.categories[1].component.settings.pageSize; @@ -290,6 +295,8 @@ describe('Search Checklist Component', () => { }); it('[C277018] Should be able to change the operator', async () => { + navigationBarPage.clickContentServicesButton(); + jsonFile.categories[1].component.settings.operator = 'AND'; await setConfigField('search', JSON.stringify(jsonFile)); @@ -307,11 +314,11 @@ describe('Search Checklist Component', () => { searchResults.checkContentIsNotDisplayed(nodeNames.folder); searchResults.checkContentIsNotDisplayed(nodeNames.document); - - browser.refresh(); }); it('[C277019] Should be able to add new properties with different types', async () => { + navigationBarPage.clickContentServicesButton(); + jsonFile.categories[1].component.settings.options.push({ 'name': filterType.custom, 'value': "TYPE:'cm:auditable'" diff --git a/e2e/search/components/search-date-range.e2e.ts b/e2e/search/components/search-date-range.e2e.ts index 0bcabdc1ef..a9d8da8cd8 100644 --- a/e2e/search/components/search-date-range.e2e.ts +++ b/e2e/search/components/search-date-range.e2e.ts @@ -21,7 +21,6 @@ import { DataTableComponentPage } from '@alfresco/adf-testing'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { DatePickerPage } from '../../pages/adf/material/datePickerPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import { SearchConfiguration } from '../search.config'; @@ -30,6 +29,7 @@ import TestConfig = require('../../test.config'); import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { browser } from 'protractor'; import { DateUtil } from '../../util/dateUtil'; +import { setConfigField } from '../../proxy'; describe('Search Date Range Filter', () => { @@ -40,7 +40,6 @@ describe('Search Date Range Filter', () => { const searchResults = new SearchResultsPage(); const datePicker = new DatePickerPage(); const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const dataTable = new DataTableComponentPage(); beforeAll(async (done) => { @@ -197,14 +196,12 @@ describe('Search Date Range Filter', () => { jsonFile = searchConfiguration.getConfiguration(); }); - it('[C277117] Should be able to change date format', () => { + it('[C277117] Should be able to change date format', async () => { + navigationBar.clickContentServicesButton(); + jsonFile.categories[4].component.settings.dateFormat = 'MM-DD-YY'; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*'); searchFilters.checkCreatedRangeFilterIsDisplayed() diff --git a/e2e/search/components/search-number-range.e2e.ts b/e2e/search/components/search-number-range.e2e.ts index db621b8f69..7f785a8877 100644 --- a/e2e/search/components/search-number-range.e2e.ts +++ b/e2e/search/components/search-number-range.e2e.ts @@ -20,7 +20,6 @@ import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; import { DataTableComponentPage } from '@alfresco/adf-testing'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import TestConfig = require('../../test.config'); @@ -33,6 +32,7 @@ import { browser } from 'protractor'; import resources = require('../../util/resources'); import { SearchConfiguration } from '../search.config'; import { DateUtil } from '../../util/dateUtil'; +import { setConfigField } from '../../proxy'; describe('Search Number Range Filter', () => { @@ -42,7 +42,6 @@ describe('Search Number Range Filter', () => { const sizeRangeFilter = searchFilters.sizeRangeFilterPage(); const searchResults = new SearchResultsPage(); const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const dataTable = new DataTableComponentPage(); const acsUser = new AcsUserModel(); @@ -398,13 +397,12 @@ describe('Search Number Range Filter', () => { jsonFile = searchConfiguration.getConfiguration(); }); - it('[C276928] Should be able to change the field property for number range', () => { + it('[C276928] Should be able to change the field property for number range', async() => { + navigationBar.clickContentServicesButton(); + jsonFile.categories[3].component.settings.field = 'cm:created'; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -441,13 +439,12 @@ describe('Search Number Range Filter', () => { }); - it('[C277139] Should be able to set To field to be exclusive', () => { + it('[C277139] Should be able to set To field to be exclusive', async() => { + navigationBar.clickContentServicesButton(); + jsonFile.categories[3].component.settings.format = '[{FROM} TO {TO}>'; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -478,13 +475,12 @@ describe('Search Number Range Filter', () => { searchResults.checkContentIsDisplayed(file2BytesModel.name); }); - it('[C277140] Should be able to set From field to be exclusive', () => { + it('[C277140] Should be able to set From field to be exclusive', async() => { + navigationBar.clickContentServicesButton(); + jsonFile.categories[3].component.settings.format = '<{FROM} TO {TO}]'; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() diff --git a/e2e/search/components/search-radio.e2e.ts b/e2e/search/components/search-radio.e2e.ts index 871c33c19c..31a6f1dd72 100644 --- a/e2e/search/components/search-radio.e2e.ts +++ b/e2e/search/components/search-radio.e2e.ts @@ -18,7 +18,6 @@ import { LoginPage } from '@alfresco/adf-testing'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; @@ -32,12 +31,12 @@ import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { UploadActions } from '../../actions/ACS/upload.actions'; import { browser } from 'protractor'; import { StringUtil } from '@alfresco/adf-testing'; +import { setConfigField } from '../../proxy'; describe('Search Radio Component', () => { const loginPage = new LoginPage(); const searchFiltersPage = new SearchFiltersPage(); - const configEditorPage = new ConfigEditorPage(); const navigationBarPage = new NavigationBarPage(); const searchDialog = new SearchDialog(); const searchResults = new SearchResultsPage(); @@ -141,8 +140,8 @@ describe('Search Radio Component', () => { jsonFile = searchConfiguration.getConfiguration(); }); - it('[C277147] Should be able to customise the pageSize value', () => { - navigationBarPage.clickConfigEditorButton(); + it('[C277147] Should be able to customise the pageSize value', async() => { + navigationBarPage.clickContentServicesButton(); jsonFile.categories[5].component.settings.pageSize = 10; @@ -153,42 +152,28 @@ describe('Search Radio Component', () => { }); } - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10); - browser.refresh(); - - navigationBarPage.clickConfigEditorButton(); + navigationBarPage.clickContentServicesButton(); jsonFile.categories[5].component.settings.pageSize = 11; - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); expect(searchFiltersPage.typeFiltersPage().getRadioButtonsNumberOnPage()).toBe(10); - browser.refresh(); - - navigationBarPage.clickConfigEditorButton(); - + navigationBarPage.clickContentServicesButton(); jsonFile.categories[5].component.settings.pageSize = 9; - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); @@ -201,8 +186,8 @@ describe('Search Radio Component', () => { browser.refresh(); }); - it('[C277148] Should be able to click show more/less button', () => { - navigationBarPage.clickConfigEditorButton(); + it('[C277148] Should be able to click show more/less button', async() => { + navigationBarPage.clickContentServicesButton(); jsonFile.categories[5].component.settings.pageSize = 0; @@ -213,10 +198,7 @@ describe('Search Radio Component', () => { }); } - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); @@ -240,16 +222,10 @@ describe('Search Radio Component', () => { searchFiltersPage.typeFiltersPage().checkShowMoreButtonIsDisplayed(); searchFiltersPage.typeFiltersPage().checkShowLessButtonIsNotDisplayed(); - browser.refresh(); - - navigationBarPage.clickConfigEditorButton(); - + navigationBarPage.clickContentServicesButton(); delete jsonFile.categories[5].component.settings.pageSize; - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); @@ -291,18 +267,15 @@ describe('Search Radio Component', () => { done(); }); - it('[C277033] Should be able to add a new option', () => { - navigationBarPage.clickConfigEditorButton(); + it('[C277033] Should be able to add a new option', async() => { + navigationBarPage.clickContentServicesButton(); jsonFile.categories[5].component.settings.options.push({ 'name': filterType.custom, 'value': "TYPE:'cm:content'" }); - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterTextAndPressEnter(randomName); searchFiltersPage.clickTypeFilterHeader(); diff --git a/e2e/search/components/search-slider.e2e.ts b/e2e/search/components/search-slider.e2e.ts index 8a992351fc..eec37cc475 100644 --- a/e2e/search/components/search-slider.e2e.ts +++ b/e2e/search/components/search-slider.e2e.ts @@ -20,7 +20,6 @@ import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; import { DataTableComponentPage } from '@alfresco/adf-testing'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import TestConfig = require('../../test.config'); @@ -32,6 +31,7 @@ import { FileModel } from '../../models/ACS/fileModel'; import { browser } from 'protractor'; import resources = require('../../util/resources'); import { SearchConfiguration } from '../search.config'; +import { setConfigField } from '../../proxy'; describe('Search Number Range Filter', () => { @@ -41,7 +41,6 @@ describe('Search Number Range Filter', () => { const sizeSliderFilter = searchFilters.sizeSliderFilterPage(); const searchResults = new SearchResultsPage(); const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const dataTable = new DataTableComponentPage(); const acsUser = new AcsUserModel(); @@ -164,13 +163,12 @@ describe('Search Number Range Filter', () => { jsonFile = searchConfiguration.getConfiguration(); }); - it('[C276983] Should be able to disable thumb label in Search Size Slider', () => { + it('[C276983] Should be able to disable thumb label in Search Size Slider', async() => { + navigationBar.clickContentServicesButton(); + jsonFile.categories[2].component.settings.thumbLabel = false; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -183,14 +181,13 @@ describe('Search Number Range Filter', () => { sizeSliderFilter.checkSliderWithThumbLabelIsNotDisplayed(); }); - it('[C276985] Should be able to set min value for Search Size Slider', () => { + it('[C276985] Should be able to set min value for Search Size Slider', async() => { + navigationBar.clickContentServicesButton(); + const minSize = 3; jsonFile.categories[2].component.settings.min = minSize; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -205,14 +202,13 @@ describe('Search Number Range Filter', () => { expect(sizeSliderFilter.getMinValue()).toEqual(`${minSize}`); }); - it('[C276986] Should be able to set max value for Search Size Slider', () => { + it('[C276986] Should be able to set max value for Search Size Slider', async() => { + navigationBar.clickContentServicesButton(); + const maxSize = 50; jsonFile.categories[2].component.settings.max = maxSize; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -227,14 +223,13 @@ describe('Search Number Range Filter', () => { expect(sizeSliderFilter.getMaxValue()).toEqual(`${maxSize}`); }); - it('[C276987] Should be able to set steps for Search Size Slider', () => { + it('[C276987] Should be able to set steps for Search Size Slider', async() => { + navigationBar.clickContentServicesButton(); + const step = 10; jsonFile.categories[2].component.settings.step = step; - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)).clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() diff --git a/e2e/search/components/search-sorting-picker.e2e.ts b/e2e/search/components/search-sorting-picker.e2e.ts index 0daf3601f9..3306b0b419 100644 --- a/e2e/search/components/search-sorting-picker.e2e.ts +++ b/e2e/search/components/search-sorting-picker.e2e.ts @@ -19,7 +19,6 @@ import { LoginPage } from '@alfresco/adf-testing'; import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; import { ContentServicesPage } from '../../pages/adf/contentServicesPage'; import { NodeActions } from '../../actions/ACS/node.actions'; @@ -33,6 +32,7 @@ import { browser } from 'protractor'; import resources = require('../../util/resources'); import { SearchConfiguration } from '../search.config'; import { SearchSortingPickerPage } from '../../pages/adf/content-services/search/components/search-sortingPicker.page'; +import { setConfigField } from '../../proxy'; describe('Search Sorting Picker', () => { @@ -41,7 +41,6 @@ describe('Search Sorting Picker', () => { const searchFilters = new SearchFiltersPage(); const searchResults = new SearchResultsPage(); const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const searchSortingPicker = new SearchSortingPickerPage(); const contentServices = new ContentServicesPage(); const nodeActions = new NodeActions(); @@ -112,12 +111,10 @@ describe('Search Sorting Picker', () => { searchSortingPicker.checkOrderArrowIsDisplayed(); }); - it('[C277271] Should be able to add a custom search sorter in the "sort by" option', () => { + it('[C277271] Should be able to add a custom search sorter in the "sort by" option', async() => { + navigationBar.clickContentServicesButton(); const searchConfiguration = new SearchConfiguration(); jsonFile = searchConfiguration.getConfiguration(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); jsonFile.sorting.options.push({ 'key': 'Modifier', 'label': 'Modifier', @@ -125,8 +122,7 @@ describe('Search Sorting Picker', () => { 'field': 'cm:modifier', 'ascending': true }); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -138,15 +134,12 @@ describe('Search Sorting Picker', () => { .checkOptionIsDisplayed('Modifier'); }); - it('[C277272] Should be able to exclude a standard search sorter from the sorting option', () => { + it('[C277272] Should be able to exclude a standard search sorter from the sorting option', async() => { + navigationBar.clickContentServicesButton(); const searchConfiguration = new SearchConfiguration(); jsonFile = searchConfiguration.getConfiguration(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); const removedOption = jsonFile.sorting.options.splice(0, 1); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -158,12 +151,11 @@ describe('Search Sorting Picker', () => { .checkOptionIsNotDisplayed(removedOption[0].label); }); - it('[C277273] Should be able to set a default order for a search sorting option', () => { + it('[C277273] Should be able to set a default order for a search sorting option', async() => { + navigationBar.clickContentServicesButton(); + const searchConfiguration = new SearchConfiguration(); jsonFile = searchConfiguration.getConfiguration(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); jsonFile.sorting.options[0].ascending = false; jsonFile.sorting.defaults[0] = { 'key': 'Size', @@ -172,8 +164,8 @@ describe('Search Sorting Picker', () => { 'field': 'content.size', 'ascending': true }; - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -226,12 +218,11 @@ describe('Search Sorting Picker', () => { }); }); - it('[C277288] Should be able to sort the search results by "Modified Date" ASC', () => { + it('[C277288] Should be able to sort the search results by "Modified Date" ASC', async() => { + navigationBar.clickContentServicesButton(); + const searchConfiguration = new SearchConfiguration(); jsonFile = searchConfiguration.getConfiguration(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); jsonFile.sorting.options.push({ 'key': 'Modified Date', 'label': 'Modified Date', @@ -239,8 +230,7 @@ describe('Search Sorting Picker', () => { 'field': 'cm:modified', 'ascending': true }); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() @@ -262,12 +252,11 @@ describe('Search Sorting Picker', () => { }); }); - it('[C277301] Should be able to change default sorting option for the search results', () => { + it('[C277301] Should be able to change default sorting option for the search results', async() => { + navigationBar.clickContentServicesButton(); + const searchConfiguration = new SearchConfiguration(); jsonFile = searchConfiguration.getConfiguration(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); jsonFile.sorting.options.push({ 'key': 'createdByUser', 'label': 'Author', @@ -276,8 +265,7 @@ describe('Search Sorting Picker', () => { 'ascending': true }); - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.checkSearchIconIsVisible() .clickOnSearchIcon() diff --git a/e2e/search/components/search-text.e2e.ts b/e2e/search/components/search-text.e2e.ts index 4be3776a00..1179dd3bd4 100644 --- a/e2e/search/components/search-text.e2e.ts +++ b/e2e/search/components/search-text.e2e.ts @@ -28,14 +28,13 @@ import { LoginPage } from '@alfresco/adf-testing'; import { SearchDialog } from '../../pages/adf/dialog/searchDialog'; import { SearchResultsPage } from '../../pages/adf/searchResultsPage'; import { SearchFiltersPage } from '../../pages/adf/searchFiltersPage'; -import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; import { SearchConfiguration } from '../search.config'; +import { setConfigField } from '../../proxy'; describe('Search component - Text widget', () => { - const configEditorPage = new ConfigEditorPage(); const navigationBarPage = new NavigationBarPage(); const searchFiltersPage = new SearchFiltersPage(); @@ -92,7 +91,7 @@ describe('Search component - Text widget', () => { jsonFile = searchConfiguration.getConfiguration(); }); - it('[C289330] Should be able to change the Field setting', () => { + it('[C289330] Should be able to change the Field setting', async() => { browser.get(TestConfig.adf.url + '/search;q=*'); searchResultPage.tableIsLoaded(); @@ -109,11 +108,8 @@ describe('Search component - Text widget', () => { jsonFile.categories[0].component.settings.field = 'cm:description'; - navigationBarPage.clickConfigEditorButton(); - configEditorPage.clickSearchConfiguration(); - configEditorPage.clickClearButton(); - configEditorPage.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditorPage.clickSaveButton(); + navigationBarPage.clickContentServicesButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon().enterTextAndPressEnter('*'); searchResultPage.tableIsLoaded(); diff --git a/e2e/search/search-component.e2e.ts b/e2e/search/search-component.e2e.ts index dfd514809e..1f0fed29c8 100644 --- a/e2e/search/search-component.e2e.ts +++ b/e2e/search/search-component.e2e.ts @@ -34,8 +34,8 @@ import { StringUtil } from '@alfresco/adf-testing'; import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { UploadActions } from '../actions/ACS/upload.actions'; import { NavigationBarPage } from '../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../pages/adf/configEditorPage'; import { SearchConfiguration } from './search.config'; +import { setConfigField } from '../proxy'; describe('Search component - Search Bar', () => { @@ -305,17 +305,13 @@ describe('Search component - Search Bar', () => { describe('Highlight', () => { const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const searchConfiguration = new SearchConfiguration().getConfiguration(); beforeAll(async () => { + navigationBar.clickContentServicesButton(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - configEditor.enterBigConfigurationText(JSON.stringify(searchConfiguration)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(searchConfiguration)); searchDialog .checkSearchIconIsVisible() diff --git a/e2e/search/search-filters.e2e.ts b/e2e/search/search-filters.e2e.ts index 2a62c3291a..6b64b48d32 100644 --- a/e2e/search/search-filters.e2e.ts +++ b/e2e/search/search-filters.e2e.ts @@ -17,12 +17,11 @@ import { SearchDialog } from '../pages/adf/dialog/searchDialog'; import { SearchFiltersPage } from '../pages/adf/searchFiltersPage'; -import { NavigationBarPage } from '../pages/adf/navigationBarPage'; -import { ConfigEditorPage } from '../pages/adf/configEditorPage'; import { SearchResultsPage } from '../pages/adf/searchResultsPage'; import { AcsUserModel } from '../models/ACS/acsUserModel'; import { FileModel } from '../models/ACS/fileModel'; +import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import TestConfig = require('../test.config'); import { StringUtil, DocumentListPage, PaginationPage, LoginPage } from '@alfresco/adf-testing'; @@ -32,6 +31,7 @@ import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { UploadActions } from '../actions/ACS/upload.actions'; import { browser } from 'protractor'; import { SearchConfiguration } from './search.config'; +import { setConfigField } from '../proxy'; describe('Search Filters', () => { @@ -41,9 +41,8 @@ describe('Search Filters', () => { const uploadActions = new UploadActions(); const paginationPage = new PaginationPage(); const contentList = new DocumentListPage(); - const navigationBar = new NavigationBarPage(); - const configEditor = new ConfigEditorPage(); const searchResults = new SearchResultsPage(); + const navigationBarPage = new NavigationBarPage(); const acsUser = new AcsUserModel(); @@ -173,11 +172,9 @@ describe('Search Filters', () => { searchFiltersPage.fileTypeCheckListFiltersPage().clickCheckListOption('PNG Image'); const bucketNumberForFilter = searchFiltersPage.fileTypeCheckListFiltersPage().getBucketNumberOfFilterType(filter.type); - const resultFileNames = contentList.getAllRowsColumnValues('Display name'); expect(bucketNumberForFilter).not.toEqual('0'); - expect(paginationPage.getTotalNumberOfFiles()).toEqual(bucketNumberForFilter); resultFileNames.then((fileNames) => { @@ -187,13 +184,11 @@ describe('Search Filters', () => { }); }); - it('[C291802] Should be able to filter facet fields with "Contains"', () => { - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); + it('[C291802] Should be able to filter facet fields with "Contains"', async() => { + navigationBarPage.clickContentServicesButton(); + jsonFile['filterWithContains'] = true; - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon() .enterTextAndPressEnter('*'); @@ -213,15 +208,10 @@ describe('Search Filters', () => { .checkSizeFacetQueryGroupIsDisplayed(); }); - it('[C291981] Should group search facets under the default label, by default', () => { - browser.refresh(); + it('[C291981] Should group search facets under the default label, by default', async() => { + navigationBarPage.clickContentServicesButton(); - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); - jsonFile['filterWithContains'] = true; - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon() .enterTextAndPressEnter('*'); @@ -270,14 +260,12 @@ describe('Search Filters', () => { }); - it('[C299124] Should be able to parse escaped empty spaced labels inside facetFields', () => { - navigationBar.clickConfigEditorButton(); - configEditor.clickSearchConfiguration(); - configEditor.clickClearButton(); + it('[C299124] Should be able to parse escaped empty spaced labels inside facetFields', async() => { + navigationBarPage.clickContentServicesButton(); + jsonFile.facetFields.fields[0].label = 'My File Types'; jsonFile.facetFields.fields[1].label = 'My File Sizes'; - configEditor.enterBigConfigurationText(JSON.stringify(jsonFile)); - configEditor.clickSaveButton(); + await setConfigField('search', JSON.stringify(jsonFile)); searchDialog.clickOnSearchIcon() .enterTextAndPressEnter('*'); diff --git a/e2e/search/search-multiselect.e2e.ts b/e2e/search/search-multiselect.e2e.ts index 29bbc24abe..f895a70f64 100644 --- a/e2e/search/search-multiselect.e2e.ts +++ b/e2e/search/search-multiselect.e2e.ts @@ -74,11 +74,8 @@ describe('Search Component - Multi-Select Facet', () => { }); jpgFile = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, '-my-'); - jpgFileSite = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, site.entry.guid); - txtFile = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, '-my-'); - txtFileSite = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, site.entry.guid); await browser.driver.sleep(15000);