[ACA-990] add tests for Recent Files, Shared Files and location redirect (#105)

* add tests for Recent Files and Shared Files list views
add tests for location redirect

* small fix
This commit is contained in:
Adina Parpalita
2017-12-04 06:10:23 +02:00
committed by Cilibiu Bogdan
parent 39458aa97a
commit 43b020ca51
8 changed files with 403 additions and 51 deletions

View File

@@ -34,6 +34,7 @@ export class DataTable extends Component {
row: 'tr',
selectedRow: 'tr.is-selected',
cell: 'td',
locationLink: 'app-location-link',
emptyListContainer: 'td.adf-no-content-container',
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
@@ -45,6 +46,7 @@ export class DataTable extends Component {
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
cell = by.css(DataTable.selectors.cell);
locationLink = by.css(DataTable.selectors.locationLink);
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
@@ -142,6 +144,15 @@ export class DataTable extends Component {
});
}
getItemLocation(name: string) {
const rowLocator = by.cssContainingText(DataTable.selectors.row, name);
return this.body.element(rowLocator).element(this.locationLink);
}
clickItemLocation(name: string) {
return this.getItemLocation(name).click();
}
// empty state methods
isEmptyList(): promise.Promise<boolean> {
return this.emptyList.isPresent();

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, promise } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
@@ -34,4 +34,22 @@ export class ToolbarBreadcrumb extends Component {
getNthItem(nth: number): ElementFinder {
return this.items.get(nth - 1);
}
getItemsCount(): promise.Promise<number> {
return this.items.count();
}
getFirstItemName(): promise.Promise<string> {
return this.items.get(0).getAttribute('title');
}
getCurrentItem(): promise.Promise<ElementFinder> {
return this.getItemsCount()
.then(count => this.getNthItem(count));
}
getCurrentItemName(): promise.Promise<string> {
return this.getCurrentItem()
.then(node => node.getAttribute('title'));
}
}