mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2116] search results available actions (#895)
* add item.id to File Libraries * add method to wait for node to be indexed * create separate methods in queries API to wait for sites or wait for nodes * improvements, renaming * renaming * fix * add tests for actions on search results * add wait and use new method * fix * another fix * use correct method * more fixes * create method for clickView button * fixes * no message
This commit is contained in:
committed by
Denys Vuika
parent
0471b783a4
commit
d2e0f688e8
@@ -191,10 +191,14 @@ export class DataTable extends Component {
|
||||
|
||||
// Navigation/selection methods
|
||||
async doubleClickOnRowByName(name: string) {
|
||||
const item = this.getRowFirstCell(name);
|
||||
await Utils.waitUntilElementClickable(item);
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().click().click().perform();
|
||||
try {
|
||||
const item = this.getRowFirstCell(name);
|
||||
await Utils.waitUntilElementClickable(item);
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().click().click().perform();
|
||||
} catch (error) {
|
||||
console.log('--- catch: doubleClickOnRowByName', error);
|
||||
}
|
||||
}
|
||||
|
||||
async selectItem(name: string) {
|
||||
@@ -225,7 +229,7 @@ export class DataTable extends Component {
|
||||
const count = await this.countSelectedRows();
|
||||
if (count !== 0) {
|
||||
await browser.refresh();
|
||||
await this.waitForHeader();
|
||||
await this.wait();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('------ clearSelection catch : ', error);
|
||||
@@ -238,7 +242,7 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async rightClickOnMultipleSelection() {
|
||||
await this.waitForHeader();
|
||||
await this.wait();
|
||||
const itemFromSelection = this.getSelectedRows().get(0);
|
||||
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, protractor, ExpectedConditions as EC, promise } from 'protractor';
|
||||
import { ElementFinder, by, browser, protractor, ExpectedConditions as EC } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
@@ -23,9 +23,10 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, browser, by, until, protractor } from 'protractor';
|
||||
import { ElementFinder, browser, by, until, protractor, ExpectedConditions as EC } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
export class SearchInput extends Component {
|
||||
private static selectors = {
|
||||
@@ -35,27 +36,36 @@ export class SearchInput extends Component {
|
||||
searchControl: '.app-search-control',
|
||||
searchInput: 'app-control-input',
|
||||
searchOptionsArea: 'search-options',
|
||||
optionCheckbox: '.mat-checkbox'
|
||||
optionCheckbox: '.mat-checkbox',
|
||||
clearButton: '.app-clear-icon'
|
||||
};
|
||||
|
||||
searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton));
|
||||
searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer));
|
||||
searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl));
|
||||
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'));
|
||||
clearSearchButton: ElementFinder = this.searchContainer.$(SearchInput.selectors.clearButton);
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(SearchInput.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
async waitForSearchControl() {
|
||||
return await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
|
||||
}
|
||||
|
||||
async isSearchContainerDisplayed() {
|
||||
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
|
||||
}
|
||||
|
||||
async clickSearchButton() {
|
||||
await Utils.waitUntilElementClickable(this.searchButton);
|
||||
await this.searchButton.click();
|
||||
await this.waitForSearchControl();
|
||||
}
|
||||
|
||||
async isOptionsAreaDisplayed() {
|
||||
@@ -117,6 +127,16 @@ export class SearchInput extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async isClearSearchButtonPresent() {
|
||||
return await browser.isElementPresent(this.clearSearchButton);
|
||||
}
|
||||
|
||||
async clickClearSearchButton() {
|
||||
if (await this.isClearSearchButtonPresent()) {
|
||||
return await this.clearSearchButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
async checkOnlyFiles() {
|
||||
await this.clearOptions();
|
||||
await this.clickFilesOption();
|
||||
@@ -139,8 +159,14 @@ export class SearchInput extends Component {
|
||||
}
|
||||
|
||||
async searchFor(text: string) {
|
||||
await browser.wait(EC.elementToBeClickable(this.searchBar), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for searchBar to be clickable');
|
||||
await this.searchBar.clear();
|
||||
await this.searchBar.sendKeys(text);
|
||||
await this.searchBar.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
async searchForTextAndCloseSearchOptions(text: string) {
|
||||
await this.searchFor(text);
|
||||
await Utils.pressEscape();
|
||||
}
|
||||
}
|
||||
|
@@ -36,15 +36,34 @@ export class Sidenav extends Component {
|
||||
label: '.item--label',
|
||||
expansion_panel: ".mat-expansion-panel-header",
|
||||
expansion_panel_content: ".mat-expansion-panel-body",
|
||||
active: 'item--active',
|
||||
activeLink: '.item--active',
|
||||
newButton: '[data-automation-id="create-button"]'
|
||||
active: 'mat-accent',
|
||||
activeLink: '.mat-accent',
|
||||
activeChild: 'item--active',
|
||||
newButton: '[data-automation-id="create-button"]',
|
||||
|
||||
personalFiles: `[id='app.navbar.personalFiles']`,
|
||||
fileLibraries: `[id='app.navbar.libraries.menu']`,
|
||||
myLibraries: `[id='app.navbar.libraries.files']`,
|
||||
favoriteLibraries: `[id='app.navbar.libraries.favorite']`,
|
||||
shared: `[id='app.navbar.shared']`,
|
||||
recentFiles: `[id='app.navbar.recentFiles']`,
|
||||
favorites: `[id='app.navbar.favorites']`,
|
||||
trash: `[id='app.navbar.trashcan']`
|
||||
};
|
||||
|
||||
links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link));
|
||||
activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeLink));
|
||||
newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton));
|
||||
|
||||
personalFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.personalFiles));
|
||||
fileLibraries: ElementFinder = this.component.element(by.css(Sidenav.selectors.fileLibraries));
|
||||
myLibraries: ElementFinder = this.component.element(by.css(Sidenav.selectors.myLibraries));
|
||||
favoriteLibraries: ElementFinder = this.component.element(by.css(Sidenav.selectors.favoriteLibraries));
|
||||
shared: ElementFinder = this.component.element(by.css(Sidenav.selectors.shared));
|
||||
recentFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.recentFiles));
|
||||
favorites: ElementFinder = this.component.element(by.css(Sidenav.selectors.favorites));
|
||||
trash: ElementFinder = this.component.element(by.css(Sidenav.selectors.trash));
|
||||
|
||||
menu: Menu = new Menu();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
@@ -92,7 +111,7 @@ export class Sidenav extends Component {
|
||||
|
||||
async childIsActive(name: string) {
|
||||
const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class');
|
||||
return childClass.includes(Sidenav.selectors.active);
|
||||
return childClass.includes(Sidenav.selectors.activeChild);
|
||||
}
|
||||
|
||||
getLink(name: string) {
|
||||
@@ -100,7 +119,17 @@ export class Sidenav extends Component {
|
||||
}
|
||||
|
||||
getLinkLabel(name: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.label, name));
|
||||
switch (name) {
|
||||
case 'Personal Files': return this.personalFiles;
|
||||
case 'File Libraries': return this.fileLibraries;
|
||||
case 'My Libraries': return this.myLibraries;
|
||||
case 'Favorite Libraries': return this.favoriteLibraries;
|
||||
case 'Shared': return this.shared;
|
||||
case 'Recent Files': return this.recentFiles;
|
||||
case 'Favorites': return this.favorites;
|
||||
case 'Trash': return this.trash;
|
||||
default: return this.personalFiles;
|
||||
}
|
||||
}
|
||||
|
||||
getActiveLink() {
|
||||
@@ -111,14 +140,14 @@ export class Sidenav extends Component {
|
||||
return await this.getLink(name).getAttribute('title');
|
||||
}
|
||||
|
||||
async navigateToLink(name: string) {
|
||||
async clickLink(name: string) {
|
||||
try{
|
||||
const link = this.getLinkLabel(name);
|
||||
await Utils.waitUntilElementClickable(link);
|
||||
return await link.click();
|
||||
|
||||
} catch (e){
|
||||
console.log('---- sidebar navigation catch navigateToLink: ', e);
|
||||
console.log('---- sidebar navigation catch clickLink: ', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,9 +23,10 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, protractor, browser } from 'protractor';
|
||||
import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
export class Toolbar extends Component {
|
||||
private static selectors = {
|
||||
@@ -95,7 +96,7 @@ export class Toolbar extends Component {
|
||||
}
|
||||
|
||||
async closeMoreMenu() {
|
||||
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||
await Utils.pressEscape();
|
||||
}
|
||||
|
||||
async getButtonTooltip(button: ElementFinder) {
|
||||
@@ -150,6 +151,10 @@ export class Toolbar extends Component {
|
||||
}
|
||||
|
||||
|
||||
async clickView() {
|
||||
return await this.viewButton.click();
|
||||
}
|
||||
|
||||
async clickEdit() {
|
||||
return await this.editButton.click();
|
||||
}
|
||||
|
Reference in New Issue
Block a user