diff --git a/lib/testing/src/lib/core/dialog/edit-json-dialog.ts b/lib/testing/src/lib/core/dialog/edit-json-dialog.ts new file mode 100644 index 0000000000..9a2c072fed --- /dev/null +++ b/lib/testing/src/lib/core/dialog/edit-json-dialog.ts @@ -0,0 +1,45 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { by, element, ElementFinder } from 'protractor'; +import { BrowserActions } from '../../core/utils/browser-actions'; +import { BrowserVisibility } from '../../core/utils/browser-visibility'; + +export class EditJsonDialog { + + dialog: ElementFinder = element(by.css(`.adf-edit-json-dialog`)); + closeButton: ElementFinder = element(by.cssContainingText(`button span`, 'Close')); + dialogContent: ElementFinder = this.dialog.element(by.css(`mat-dialog-content textarea`)); + + async checkDialogIsDisplayed(): Promise { + await BrowserVisibility.waitUntilElementIsVisible(this.dialog); + } + + async checkDialogIsNotDisplayed(): Promise { + await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog); + } + + async clickCloseButton(): Promise { + await BrowserActions.click(this.closeButton); + } + + async getDialogContent(): Promise { + await BrowserVisibility.waitUntilElementIsVisible(this.dialogContent); + return this.dialogContent.getAttribute('value'); + } + +} diff --git a/lib/testing/src/lib/core/dialog/public-api.ts b/lib/testing/src/lib/core/dialog/public-api.ts new file mode 100644 index 0000000000..d1cfaaad50 --- /dev/null +++ b/lib/testing/src/lib/core/dialog/public-api.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './edit-json-dialog'; diff --git a/lib/testing/src/lib/core/pages/form/formFields.ts b/lib/testing/src/lib/core/pages/form/formFields.ts index 119ca17628..fc31ad53df 100644 --- a/lib/testing/src/lib/core/pages/form/formFields.ts +++ b/lib/testing/src/lib/core/pages/form/formFields.ts @@ -38,8 +38,8 @@ export class FormFields { await BrowserActions.clearSendKeys(fieldElement, value); } - async clickField(locator, field): Promise { - const fieldElement = element(locator(field)); + async clickField(locator, field, fieldtext?): Promise { + const fieldElement = fieldtext ? element(locator(field, fieldtext)) : element(locator(field)); await BrowserActions.click(fieldElement); } diff --git a/lib/testing/src/lib/core/pages/viewerPage.ts b/lib/testing/src/lib/core/pages/viewerPage.ts index 2df678d2fb..1a92a14403 100644 --- a/lib/testing/src/lib/core/pages/viewerPage.ts +++ b/lib/testing/src/lib/core/pages/viewerPage.ts @@ -233,6 +233,7 @@ export class ViewerPage { } async checkFileNameIsDisplayed(file): Promise { + await BrowserVisibility.waitUntilElementIsVisible(this.fileName); await expect(await BrowserActions.getText(this.fileName)).toEqual(file); } diff --git a/lib/testing/src/lib/core/public-api.ts b/lib/testing/src/lib/core/public-api.ts index 33bfe4594a..c4ebe673dc 100644 --- a/lib/testing/src/lib/core/public-api.ts +++ b/lib/testing/src/lib/core/public-api.ts @@ -18,5 +18,5 @@ export * from './actions/public-api'; export * from './pages/public-api'; export * from './models/public-api'; - +export * from './dialog/public-api'; export * from './utils/public-api';