e2e/src/apps/apps.po.ts
E2E Page Object for apps page.
Methods |
getEmpty |
getEmpty()
|
Defined in e2e/src/apps/apps.po.ts:36
|
Get the empty box
Returns :
Promise<ElementFinder>
|
getFilters |
getFilters()
|
Defined in e2e/src/apps/apps.po.ts:111
|
Get Filters box
Returns :
any
|
getFilterSubmit |
getFilterSubmit()
|
Defined in e2e/src/apps/apps.po.ts:151
|
Get filter button submit
Returns :
any
|
getHeaderText |
getHeaderText()
|
Defined in e2e/src/apps/apps.po.ts:24
|
Retrieves text of the title for the page.
Returns :
any
|
getSecondHeaderText |
getSecondHeaderText()
|
Defined in e2e/src/apps/apps.po.ts:28
|
Returns :
any
|
getSort |
getSort(sort: string, order: string)
|
Defined in e2e/src/apps/apps.po.ts:94
|
Get the sort header
Returns :
any
|
getTable |
getTable()
|
Defined in e2e/src/apps/apps.po.ts:46
|
Get the table results
Returns :
any
|
getTableRowCount |
getTableRowCount()
|
Defined in e2e/src/apps/apps.po.ts:60
|
Returns :
Promise<number>
|
getTableRows |
getTableRows()
|
Defined in e2e/src/apps/apps.po.ts:54
|
Get all the rows of the table
Returns :
any | []
|
navigateTo |
navigateTo()
|
Defined in e2e/src/apps/apps.po.ts:16
|
Navigates to the home page.
Returns :
any
|
navigateToRegisterApp |
navigateToRegisterApp()
|
Defined in e2e/src/apps/apps.po.ts:118
|
Navigate to the register app (dropdown action)
Returns :
void
|
setFilters |
setFilters(q: string, type: number)
|
Defined in e2e/src/apps/apps.po.ts:130
|
Set filters
Returns :
void
|
setSort | ||||||||
setSort(column: string)
|
||||||||
Defined in e2e/src/apps/apps.po.ts:102
|
||||||||
Set the sort
Parameters :
Returns :
void
|
setUnregister | ||||||||
setUnregister(index: number)
|
||||||||
Defined in e2e/src/apps/apps.po.ts:69
|
||||||||
Unregister one application
Parameters :
Returns :
void
|
setUnregisters |
setUnregisters()
|
Defined in e2e/src/apps/apps.po.ts:79
|
Unregister all the applications of the table
Returns :
any
|
import { browser, by, element, protractor, ElementFinder } from 'protractor';
import { ElementHelper } from '../utils/element-helpers';
/**
* E2E Page Object for apps page.
*
* @author Glenn Renfro
* @author Damien Vitrac
*/
export class AppsPage {
/**
* Navigates to the home page.
* @returns {wdpromise.Promise<any>}
*/
navigateTo() {
return browser.get('/');
}
/**
* Retrieves text of the title for the page.
* @returns {any}
*/
async getHeaderText() {
return element(await ElementHelper.getElementOrWait(by.css('app-page-head-title h1'))).getText();
}
async getSecondHeaderText() {
return element.all(await ElementHelper.getElementOrWait(by.css('app-page-head-title h1'))).get(1).getText();
}
/**
* Get the empty box
* @returns {ElementFinder}
*/
async getEmpty(): Promise<ElementFinder> {
const e = await ElementHelper.getElementOrWait(by.css('#empty'));
console.log('eeeee', e);
return element(e);
}
/**
* Get the table results
* @returns {ElementFinder}
*/
getTable() {
return element(by.css('#table'));
}
/**
* Get all the rows of the table
* @returns {ElementArrayFinder}
*/
getTableRows(): any | ElementFinder[] {
const e = ElementHelper.getElementOrWait(by.css('#table tbody tr'));
return e;
return element.all(by.css('#table tbody tr'));
}
async getTableRowCount(): Promise<number> {
const e = await ElementHelper.getElementOrWait(by.css('#table tbody tr'));
return element.all(e).count();
}
/**
* Unregister one application
* @param {number} index
*/
setUnregister(index: number) {
element(by.name(`app-remove${index}`)).click();
browser.sleep(100);
element(by.name(`app-unregister`)).click();
browser.sleep(100);
}
/**
* Unregister all the applications of the table
*/
async setUnregisters() {
await ElementHelper.waitForSpinners();
await ElementHelper.clickElement(by.css(`app-master-checkbox input`), false, undefined);
await ElementHelper.clickElement(by.css(`#dropdown-actions button`), false, undefined);
await ElementHelper.clickElement(by.css(`#unregister-apps`), false, undefined);
await ElementHelper.clickElement(by.name(`app-unregister`), false, undefined);
await ElementHelper.waitForSpinners();
}
/**
* Get the sort header
* @param sort
* @param order
* @returns {ElementFinder}
*/
getSort(sort: string, order: string) {
return element(by.css(`#sort-${sort} a .${order}`));
}
/**
* Set the sort
* @param column
*/
setSort(column: string) {
element(by.css(`#sort-${column} a`)).click();
browser.sleep(100);
}
/**
* Get Filters box
* @returns {ElementFinder}
*/
getFilters() {
return element(by.css('#filters'));
}
/**
* Navigate to the register app (dropdown action)
*/
navigateToRegisterApp() {
element(by.css('.heading .dropdown button')).click();
browser.sleep(100);
element.all(by.css('.heading .dropdown ul li a')).first().click();
browser.sleep(100);
}
/**
* Set filters
* @param {string} q
* @param {string} type
*/
setFilters(q: string, type: number) {
const field = element(by.css('#q'));
field.clear().then(() => {
browser.sleep(200);
field.sendKeys('a');
field.sendKeys(protractor.Key.BACK_SPACE);
if (q) {
field.sendKeys(q);
}
browser.sleep(100);
this.getFilters().element(by.css('.filter-dropdown-toggle')).click();
browser.sleep(100);
this.getFilters().all(by.css('.filter-dropdown .dropdown-menu a')).get(type).click();
browser.sleep(100);
});
}
/**
* Get filter button submit
* @returns {ElementFinder}
*/
getFilterSubmit() {
return element(by.css(`#submit`));
}
}