mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1940] add tests for search input (#776)
This commit is contained in:
committed by
Denys Vuika
parent
68fc762dd2
commit
ae382f8b39
@@ -23,7 +23,7 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
|
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
|
||||||
import { Component } from '../component';
|
import { Component } from '../component';
|
||||||
|
|
||||||
export class Breadcrumb extends Component {
|
export class Breadcrumb extends Component {
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||||
import { Component } from '../component';
|
import { Component } from '../component';
|
||||||
import moment = require('moment');
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export class DateTimePicker extends Component {
|
export class DateTimePicker extends Component {
|
||||||
private static selectors = {
|
private static selectors = {
|
||||||
|
@@ -26,48 +26,30 @@
|
|||||||
import { ElementFinder, by, browser } from 'protractor';
|
import { ElementFinder, by, browser } from 'protractor';
|
||||||
import { Component } from '../component';
|
import { Component } from '../component';
|
||||||
import { UserInfo } from './user-info';
|
import { UserInfo } from './user-info';
|
||||||
import { protractor } from 'protractor';
|
|
||||||
import { Utils } from '../../utilities/utils';
|
|
||||||
import { Menu } from '../menu/menu';
|
import { Menu } from '../menu/menu';
|
||||||
import { Toolbar } from './../toolbar/toolbar';
|
import { Toolbar } from './../toolbar/toolbar';
|
||||||
|
import { SearchInput } from '../search/search-input';
|
||||||
|
|
||||||
export class Header extends Component {
|
export class Header extends Component {
|
||||||
private locators = {
|
private locators = {
|
||||||
root: 'app-header',
|
root: 'app-header',
|
||||||
logoLink: by.css('.app-menu__title'),
|
logoLink: by.css('.app-menu__title'),
|
||||||
userInfo: by.css('aca-current-user'),
|
userInfo: by.css('aca-current-user'),
|
||||||
searchButton: by.css('.app-search-button'),
|
|
||||||
searchBar: by.css('#app-control-input'),
|
|
||||||
moreActions: by.id('app.header.more')
|
moreActions: by.id('app.header.more')
|
||||||
};
|
};
|
||||||
|
|
||||||
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
|
logoLink: ElementFinder = this.component.element(this.locators.logoLink);
|
||||||
userInfo: UserInfo = new UserInfo(this.component);
|
userInfo: UserInfo = new UserInfo(this.component);
|
||||||
searchButton: ElementFinder = this.component.element(this.locators.searchButton);
|
|
||||||
searchBar: ElementFinder = browser.element(this.locators.searchBar);
|
|
||||||
moreActions: ElementFinder = browser.element(this.locators.moreActions);
|
moreActions: ElementFinder = browser.element(this.locators.moreActions);
|
||||||
|
|
||||||
menu: Menu = new Menu();
|
menu: Menu = new Menu();
|
||||||
toolbar: Toolbar = new Toolbar();
|
toolbar: Toolbar = new Toolbar();
|
||||||
|
searchInput: SearchInput = new SearchInput();
|
||||||
|
|
||||||
constructor(ancestor?: ElementFinder) {
|
constructor(ancestor?: ElementFinder) {
|
||||||
super('adf-layout-header', ancestor);
|
super('adf-layout-header', ancestor);
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchForText(text: string) {
|
|
||||||
await this.searchBar.clear();
|
|
||||||
await this.searchBar.sendKeys(text);
|
|
||||||
await this.searchBar.sendKeys(protractor.Key.ENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitForSearchButton() {
|
|
||||||
await Utils.waitUntilElementClickable(this.searchButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
async waitForSearchBar() {
|
|
||||||
await Utils.waitUntilElementClickable(this.searchBar);
|
|
||||||
}
|
|
||||||
|
|
||||||
async openMoreMenu() {
|
async openMoreMenu() {
|
||||||
await this.moreActions.click();
|
await this.moreActions.click();
|
||||||
await this.menu.waitForMenuToOpen();
|
await this.menu.waitForMenuToOpen();
|
||||||
|
115
e2e/components/search/search-input.ts
Executable file
115
e2e/components/search/search-input.ts
Executable file
@@ -0,0 +1,115 @@
|
|||||||
|
/*!
|
||||||
|
* @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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ElementFinder, browser, by, until, protractor } from 'protractor';
|
||||||
|
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||||
|
import { Component } from '../component';
|
||||||
|
|
||||||
|
export class SearchInput extends Component {
|
||||||
|
private static selectors = {
|
||||||
|
root: 'aca-search-input',
|
||||||
|
searchContainer: '.app-search-container',
|
||||||
|
searchButton: '.app-search-button',
|
||||||
|
searchControl: '.app-search-control',
|
||||||
|
searchInput: 'app-control-input',
|
||||||
|
searchOptionsArea: 'search-options',
|
||||||
|
optionCheckbox: '.mat-checkbox'
|
||||||
|
};
|
||||||
|
|
||||||
|
searchButton: ElementFinder = browser.element(by.css(SearchInput.selectors.searchButton));
|
||||||
|
searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer));
|
||||||
|
searchBar: ElementFinder = browser.element(by.id(SearchInput.selectors.searchInput));
|
||||||
|
searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea));
|
||||||
|
searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files'));
|
||||||
|
searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders'));
|
||||||
|
searchLibrariesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Libraries'));
|
||||||
|
|
||||||
|
constructor(ancestor?: ElementFinder) {
|
||||||
|
super(SearchInput.selectors.root, ancestor);
|
||||||
|
}
|
||||||
|
|
||||||
|
async isSearchContainerDisplayed() {
|
||||||
|
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickSearchContainer() {
|
||||||
|
return await this.searchContainer.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isOptionsAreaDisplayed() {
|
||||||
|
await browser.wait(until.elementLocated(by.css(SearchInput.selectors.searchControl)), BROWSER_WAIT_TIMEOUT);
|
||||||
|
return await browser.isElementPresent(this.searchOptionsArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickFilesOption() {
|
||||||
|
return await this.searchFilesOption.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickFoldersOption() {
|
||||||
|
return await this.searchFoldersOption.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickLibrariesOption() {
|
||||||
|
return await this.searchLibrariesOption.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFilesOptionEnabled() {
|
||||||
|
const optClass = await this.searchFilesOption.getAttribute('class');
|
||||||
|
return !optClass.includes('mat-checkbox-disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFoldersOptionEnabled() {
|
||||||
|
const optClass = await this.searchFoldersOption.getAttribute('class');
|
||||||
|
return !optClass.includes('mat-checkbox-disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isLibrariesOptionEnabled() {
|
||||||
|
const optClass = await this.searchLibrariesOption.getAttribute('class');
|
||||||
|
return !optClass.includes('mat-checkbox-disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFilesOptionChecked() {
|
||||||
|
const optClass = await this.searchFilesOption.getAttribute('class');
|
||||||
|
return optClass.includes('mat-checkbox-checked');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFoldersOptionChecked() {
|
||||||
|
const optClass = await this.searchFoldersOption.getAttribute('class');
|
||||||
|
return optClass.includes('mat-checkbox-checked');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isLibrariesOptionChecked() {
|
||||||
|
const optClass = await this.searchLibrariesOption.getAttribute('class');
|
||||||
|
return optClass.includes('mat-checkbox-checked');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async searchForText(text: string) {
|
||||||
|
await this.searchBar.clear();
|
||||||
|
await this.searchBar.sendKeys(text);
|
||||||
|
await this.searchBar.sendKeys(protractor.Key.ENTER);
|
||||||
|
}
|
||||||
|
}
|
@@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
import { SIDEBAR_LABELS, PAGE_TITLES } from '../../configs';
|
import { SIDEBAR_LABELS, PAGE_TITLES } from '../../configs';
|
||||||
import { LoginPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
@@ -37,7 +36,7 @@ describe('Page titles', () => {
|
|||||||
const adminApi = new RepoClient();
|
const adminApi = new RepoClient();
|
||||||
const { nodes: nodesApi } = adminApi;
|
const { nodes: nodesApi } = adminApi;
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
const file = `file-${Utils.random()}.txt`; let fileId;
|
||||||
const header = page.header;
|
const { searchInput } = page.header;
|
||||||
|
|
||||||
xit('');
|
xit('');
|
||||||
|
|
||||||
@@ -124,11 +123,8 @@ describe('Page titles', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Search Results page - [C280413]', async () => {
|
it('Search Results page - [C280413]', async () => {
|
||||||
await header.waitForSearchButton();
|
await searchInput.clickSearchContainer();
|
||||||
await header.searchButton.click();
|
await searchInput.searchForText(file);
|
||||||
await page.dataTable.waitForHeader();
|
|
||||||
await header.waitForSearchBar();
|
|
||||||
await header.searchForText(file);
|
|
||||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
|
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
88
e2e/suites/search/search-input.test.ts
Normal file
88
e2e/suites/search/search-input.test.ts
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/*!
|
||||||
|
* @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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { BrowsingPage, LoginPage } from '../../pages/pages';
|
||||||
|
// import { Utils } from '../../utilities/utils';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
|
describe('Search input', () => {
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const page = new BrowsingPage();
|
||||||
|
const { searchInput } = page.header;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
await loginPage.loginWithAdmin();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async (done) => {
|
||||||
|
// await Utils.pressEscape();
|
||||||
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Search input is displayed in the app header - [C289847]', async () => {
|
||||||
|
expect(await searchInput.isSearchContainerDisplayed()).toBe(true, 'search controls not displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Search options are displayed when clicking in the search input - [C289848]', async () => {
|
||||||
|
await searchInput.clickSearchContainer();
|
||||||
|
expect(await searchInput.isOptionsAreaDisplayed()).toBe(true, '1. Search options not displayed');
|
||||||
|
expect(await searchInput.isFilesOptionEnabled()).toBe(true, '2. Files option not enabled');
|
||||||
|
expect(await searchInput.isFoldersOptionEnabled()).toBe(true, '3. Folders option not enabled');
|
||||||
|
expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, '4. Libraries option not enabled');
|
||||||
|
expect(await searchInput.isFilesOptionChecked()).toBe(false, '5. Files option is checked');
|
||||||
|
expect(await searchInput.isFoldersOptionChecked()).toBe(false, '6. Folders option is checked');
|
||||||
|
expect(await searchInput.isLibrariesOptionChecked()).toBe(false, '7. Libraries option is checked');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Search options are correctly enabled / disabled - [C289849]', async () => {
|
||||||
|
await searchInput.clickSearchContainer();
|
||||||
|
|
||||||
|
await searchInput.clickFilesOption();
|
||||||
|
expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled');
|
||||||
|
expect(await searchInput.isLibrariesOptionEnabled()).toBe(false, 'Libraries option not disabled');
|
||||||
|
|
||||||
|
await searchInput.clickFilesOption();
|
||||||
|
expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled');
|
||||||
|
expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, 'Folders option not enabled');
|
||||||
|
|
||||||
|
await searchInput.clickFoldersOption();
|
||||||
|
expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled');
|
||||||
|
expect(await searchInput.isLibrariesOptionEnabled()).toBe(false, 'Libraries option not disabled');
|
||||||
|
|
||||||
|
await searchInput.clickFoldersOption();
|
||||||
|
expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled');
|
||||||
|
expect(await searchInput.isLibrariesOptionEnabled()).toBe(true, 'Libraries option not enabled');
|
||||||
|
|
||||||
|
await searchInput.clickLibrariesOption();
|
||||||
|
expect(await searchInput.isFilesOptionEnabled()).toBe(false, 'Files option not disabled');
|
||||||
|
expect(await searchInput.isFoldersOptionEnabled()).toBe(false, 'Folders option not disabled');
|
||||||
|
|
||||||
|
await searchInput.clickLibrariesOption();
|
||||||
|
expect(await searchInput.isFilesOptionEnabled()).toBe(true, 'Files option not enabled');
|
||||||
|
expect(await searchInput.isFoldersOptionEnabled()).toBe(true, 'Folders option not enabled');
|
||||||
|
});
|
||||||
|
});
|
@@ -35,7 +35,7 @@ export class Utils {
|
|||||||
static string513 = 'great indirect brain tune other expectation fun silver drain tumble rhythm harmful wander picture distribute opera complication copyright \
|
static string513 = 'great indirect brain tune other expectation fun silver drain tumble rhythm harmful wander picture distribute opera complication copyright \
|
||||||
explosion snack ride pool machinery pair frog joint wrestle video referee drive window cage falsify happen tablet horror thank conception \
|
explosion snack ride pool machinery pair frog joint wrestle video referee drive window cage falsify happen tablet horror thank conception \
|
||||||
extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \
|
extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \
|
||||||
lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative dead';
|
lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live';
|
||||||
|
|
||||||
// generate a random value
|
// generate a random value
|
||||||
static random() {
|
static random() {
|
||||||
|
@@ -44,6 +44,7 @@ exports.config = {
|
|||||||
'./e2e/suites/application/*.test.ts',
|
'./e2e/suites/application/*.test.ts',
|
||||||
'./e2e/suites/navigation/*.test.ts',
|
'./e2e/suites/navigation/*.test.ts',
|
||||||
'./e2e/suites/pagination/*.test.ts',
|
'./e2e/suites/pagination/*.test.ts',
|
||||||
|
'./e2e/suites/search/*.test.ts',
|
||||||
'./e2e/suites/actions/*.test.ts',
|
'./e2e/suites/actions/*.test.ts',
|
||||||
'./e2e/suites/viewer/*.test.ts',
|
'./e2e/suites/viewer/*.test.ts',
|
||||||
'./e2e/suites/info-drawer/*.test.ts',
|
'./e2e/suites/info-drawer/*.test.ts',
|
||||||
|
Reference in New Issue
Block a user