amend implicit returns

This commit is contained in:
pionnegru
2019-10-16 13:11:24 +03:00
parent af67703371
commit 2c5fe7d3f4
9 changed files with 45 additions and 25 deletions

View File

@@ -125,16 +125,13 @@ export class DataTable extends Component {
return await this.getSortedColumnHeader().getText();
}
async getSortingOrder() {
async getSortingOrder(): Promise<string> {
const str = await this.getSortedColumnHeader().getAttribute('class');
if (str.includes('asc')) {
return 'asc';
}
else {
if (str.includes('desc')) {
return 'desc';
}
}
return 'desc';
}
async sortByColumn(columnName: string) {
@@ -328,32 +325,40 @@ export class DataTable extends Component {
return await this.emptyFolderDragAndDrop.isDisplayed();
}
async getEmptyDragAndDropText() {
async getEmptyDragAndDropText(): Promise<string> {
const isEmpty = await this.isEmptyWithDragAndDrop();
if (isEmpty) {
return await this.emptyFolderDragAndDrop.getText();
}
return '';
}
async getEmptyStateTitle() {
async getEmptyStateTitle(): Promise<string> {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListTitle.getText();
}
return '';
}
async getEmptyStateSubtitle() {
async getEmptyStateSubtitle(): Promise<string> {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListSubtitle.getText();
}
return '';
}
async getEmptyStateText() {
async getEmptyStateText(): Promise<string> {
const isEmpty = await this.isEmptyList();
if (isEmpty) {
return await this.emptyListText.getText();
}
return '';
}
async getEmptySearchResultsText() {

View File

@@ -92,10 +92,12 @@ export class InfoDrawer extends Component {
return await this.getTabByTitle(title).isPresent();
}
async isTabDisplayed(title: string) {
async isTabDisplayed(title: string): Promise<boolean> {
if (await browser.isElementPresent(this.getTabByTitle(title))) {
return await this.getTabByTitle(title).isDisplayed();
}
return false;
}
async getTabTitle(index: number) {

View File

@@ -76,7 +76,7 @@ export class LoginComponent extends Component {
return await this.passwordVisibility.click();
}
async getPasswordVisibility() {
async getPasswordVisibility(): Promise<boolean> {
const text = await this.passwordVisibility.getText();
if (text.endsWith('visibility_off')) {
return false;
@@ -86,9 +86,11 @@ export class LoginComponent extends Component {
return true;
}
}
return false;
}
async isPasswordDisplayed() {
async isPasswordDisplayed(): Promise<boolean> {
const type = await this.passwordInput.getAttribute('type');
if (type === 'text') {
return true;
@@ -98,6 +100,8 @@ export class LoginComponent extends Component {
return false;
}
}
return false;
}
async isUsernameEnabled() {

View File

@@ -167,7 +167,7 @@ export class Menu extends Component {
}
}
async hasSubMenu(menuItem: string) {
async hasSubMenu(menuItem: string): Promise<boolean> {
try {
const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
@@ -175,6 +175,7 @@ export class Menu extends Component {
return elemClass.includes('mat-menu-item-submenu-trigger');
} catch (error) {
console.log('---- has submenu error: ', error);
return false;
}
}
@@ -200,13 +201,14 @@ export class Menu extends Component {
return await this.submenus.count();
}
async isMenuItemDisabled(title: string) {
async isMenuItemDisabled(title: string): Promise<string | null> {
try {
const item = this.getItemByLabel(title);
const disabled = await item.getAttribute('disabled');
return disabled;
} catch (error) {
console.log('----- isMenuItemDisabled catch: ', error);
return null;
}
}

View File

@@ -100,10 +100,12 @@ export class Viewer extends Component {
return await browser.isElementPresent(this.viewerExtensionContent);
}
async getComponentIdOfView() {
async getComponentIdOfView(): Promise<string|null> {
if (await this.isCustomContentPresent()) {
return await this.viewerExtensionContent.getAttribute('data-automation-id');
}
return null;
}
async isPdfViewerContentDisplayed() {