diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts
index a96ba158a..79d23fda3 100755
--- a/e2e/components/data-table/data-table.ts
+++ b/e2e/components/data-table/data-table.ts
@@ -76,11 +76,11 @@ export class DataTable extends Component {
// Wait methods (waits for elements)
waitForHeader() {
- try {
- return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
- } catch (error) {
- console.log('----- wait for header catch : ', error);
- }
+ return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
+ }
+
+ waitForBody() {
+ return browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
}
async waitForEmptyState() {
diff --git a/e2e/components/search/search-input.ts b/e2e/components/search/search-input.ts
index dbead9704..5bf99c165 100755
--- a/e2e/components/search/search-input.ts
+++ b/e2e/components/search/search-input.ts
@@ -105,7 +105,40 @@ export class SearchInput extends Component {
return optClass.includes('mat-checkbox-checked');
}
- async searchForText(text: string) {
+ async clearOptions() {
+ if (await this.isFilesOptionChecked()) {
+ await this.clickFilesOption();
+ }
+ if (await this.isFoldersOptionChecked()) {
+ await this.clickFoldersOption();
+ }
+ if (await this.isLibrariesOptionChecked()) {
+ await this.clickLibrariesOption();
+ }
+ }
+
+ async checkOnlyFiles() {
+ await this.clearOptions();
+ await this.clickFilesOption();
+ }
+
+ async checkOnlyFolders() {
+ await this.clearOptions();
+ await this.clickFoldersOption();
+ }
+
+ async checkFilesAndFolders() {
+ await this.clearOptions();
+ await this.clickFilesOption();
+ await this.clickFoldersOption();
+ }
+
+ async checkLibraries() {
+ await this.clearOptions();
+ await this.clickLibrariesOption();
+ }
+
+ async searchFor(text: string) {
await this.searchBar.clear();
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
diff --git a/e2e/pages/pages.ts b/e2e/pages/pages.ts
index 6ed77b16d..cc8b38443 100755
--- a/e2e/pages/pages.ts
+++ b/e2e/pages/pages.ts
@@ -25,3 +25,4 @@
export * from './browsing-page';
export * from './login-page';
+export * from './search-results-page';
diff --git a/e2e/pages/search-results-page.ts b/e2e/pages/search-results-page.ts
new file mode 100755
index 000000000..76c0b3ee9
--- /dev/null
+++ b/e2e/pages/search-results-page.ts
@@ -0,0 +1,55 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2018 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { browser, ElementFinder, by, ExpectedConditions as EC } from 'protractor';
+import { BrowsingPage } from './browsing-page';
+import { BROWSER_WAIT_TIMEOUT } from '../configs';
+
+export class SearchResultsPage extends BrowsingPage {
+
+ private static selectors = {
+ root: 'aca-search-results',
+ filter: 'adf-search-filter',
+ expansionPanel: 'mat-expansion-panel',
+ size: '#expansion-panel-SEARCH.CATEGORIES.SIZE',
+ createdDate: '#expansion-panel-SEARCH.CATEGORIES.CREATED_DATE',
+ modifiedDate: '#expansion-panel-SEARCH.CATEGORIES.MODIFIED_DATE',
+ fileType: '#expansion-panel-SEARCH.FACET_FIELDS.FILE_TYPE',
+ creator: '#expansion-panel-SEARCH.CATEGORIES.CREATOR',
+ modifier: '#expansion-panel-SEARCH.CATEGORIES.MODIFIER',
+ location: '#expansion-panel-SEARCH.CATEGORIES.LOCATION',
+
+ resultsContent: 'adf-search-results__content',
+ resultsContentHeader: 'adf-search-results__content-header',
+ resultsInfoText: 'adf-search-results--info-text',
+ resultsFacets: 'adf-search-results__facets',
+
+ sortingPicker: 'adf-sorting-picker'
+ };
+
+ root: ElementFinder = browser.$(SearchResultsPage.selectors.root);
+
+
+}
diff --git a/e2e/suites/application/page-titles.test.ts b/e2e/suites/application/page-titles.test.ts
index fca711230..cdb636c34 100755
--- a/e2e/suites/application/page-titles.test.ts
+++ b/e2e/suites/application/page-titles.test.ts
@@ -40,7 +40,6 @@ describe('Page titles', () => {
xit('');
-
describe('on Login / Logout pages', () => {
it('on Login page - [C217155]', async () => {
await loginPage.load();
@@ -127,7 +126,7 @@ describe('Page titles', () => {
it('Search Results page - [C280413]', async () => {
await searchInput.clickSearchButton();
- await searchInput.searchForText(file);
+ await searchInput.searchFor(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
});
});
diff --git a/e2e/suites/search/search-results.test.ts b/e2e/suites/search/search-results.test.ts
new file mode 100644
index 000000000..bae09fb1b
--- /dev/null
+++ b/e2e/suites/search/search-results.test.ts
@@ -0,0 +1,119 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2018 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+import { LoginPage, SearchResultsPage } from '../../pages/pages';
+import { RepoClient } from '../../utilities/repo-client/repo-client';
+import { Utils } from '../../utilities/utils';
+
+describe('Search results', () => {
+ const username = `user-${Utils.random()}`;
+
+ const file = `test-file-${Utils.random()}.txt`; let fileId;
+ const folder = `test-folder-${Utils.random()}`; let folderId;
+ const site = `test-site-${Utils.random()}`;
+
+ const apis = {
+ admin: new RepoClient(),
+ user: new RepoClient(username, username)
+ };
+
+ const loginPage = new LoginPage();
+ const page = new SearchResultsPage();
+ const { searchInput } = page.header;
+ const dataTable = page.dataTable;
+
+ beforeAll(async (done) => {
+ await apis.admin.people.createUser({ username });
+
+ fileId = (await apis.user.nodes.createFile(file)).entry.id;
+ folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
+ await apis.user.sites.createSite(site);
+
+ await apis.user.search.waitForApi(username, { expect: 1 });
+ await apis.user.queries.waitForApi(site, { expect: 1 });
+
+ await loginPage.loginWith(username);
+ done();
+ });
+
+ afterAll(async (done) => {
+ await Promise.all([
+ apis.user.nodes.deleteNodeById(fileId),
+ apis.user.nodes.deleteNodeById(folderId),
+ apis.user.sites.deleteSite(site)
+ ]);
+ done();
+ });
+
+ beforeEach(async (done) => {
+ await page.refresh();
+ done();
+ });
+
+ it('Only files are returned when Files option is the only one checked - [C290005]', async () => {
+ await searchInput.clickSearchButton();
+ await searchInput.checkOnlyFiles();
+ await searchInput.searchFor('test');
+ await dataTable.waitForBody();
+
+ expect(await dataTable.getRowByName(file).isPresent()).toBe(true, `${file} not displayed`);
+ expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, `${folder} is displayed`);
+ expect(await dataTable.getRowByName(site).isPresent()).toBe(false, `${site} is displayed`);
+ });
+
+ it('Only folders are returned when Folders option is the only one checked - [C290006]', async () => {
+ await searchInput.clickSearchButton();
+ await searchInput.checkOnlyFolders();
+ await searchInput.searchFor('test');
+ await dataTable.waitForBody();
+
+ expect(await dataTable.getRowByName(file).isPresent()).toBe(false, `${file} is displayed`);
+ expect(await dataTable.getRowByName(folder).isPresent()).toBe(true, `${folder} not displayed`);
+ expect(await dataTable.getRowByName(site).isPresent()).toBe(false, `${site} is displayed`);
+ });
+
+ it('Files and folders are returned when both Files and Folders options are checked - [C290007]', async () => {
+ await searchInput.clickSearchButton();
+ await searchInput.checkFilesAndFolders();
+ await searchInput.searchFor('test');
+ await dataTable.waitForBody();
+
+ expect(await dataTable.getRowByName(file).isPresent()).toBe(true, `${file} not displayed`);
+ expect(await dataTable.getRowByName(folder).isPresent()).toBe(true, `${folder} not displayed`);
+ expect(await dataTable.getRowByName(site).isPresent()).toBe(false, `${site} is displayed`);
+ });
+
+ it('Only libraries are returned when Libraries option is checked - [C290008]', async () => {
+ await searchInput.clickSearchButton();
+ await searchInput.checkLibraries();
+ await searchInput.searchFor('test');
+ await dataTable.waitForBody();
+
+ expect(await dataTable.getRowByName(file).isPresent()).toBe(false, `${file} is displayed`);
+ expect(await dataTable.getRowByName(folder).isPresent()).toBe(false, `${folder} is displayed`);
+ expect(await dataTable.getRowByName(site).isPresent()).toBe(true, `${site} not displayed`);
+ });
+
+});