mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Disable control flow e2e ADF (#4954)
* update project script possible different JS-API * first commit no controll flow * second commit no controll flow * third commit no controll flow * 4 commit no controll flow * 5 commit no controll flow * 6 commit no controll flow * 7 commit no controll flow * 8 commit no controll flow * 9 commit no controll flow * 10 commit no controll flow * 11 commit no controll flow * 12 commit no controll flow * 13 commit no controll flow * 14 commit no controll flow * 15 commit no controll flow * 16 commit no controll flow * 17 commit no controll flow * 18 commit no controll flow * 19 commit no controll flow * 20 commit no controll flow * remove wdpromise, protractor promise and deferred promises * - fixed some incorrect “expect” calls - fixed some matchers - removed “return this;” when not needed - added a few more await-s * forgot a file * fix some failing tests * replaced driver calls with browser calls and enabled back waitForAngular * fix rightClick methods and hopefully some tests * fix settings-component * some more fixes for core and content tests * try to fix some more issues * linting * revert some changes, allowing download on headless chrome won’t work with multiple browser instances * fixes for Search tests * try to remove some wait calls * fix build * increase allScriptsTimeout and try another protractor and web driver version * improve navigation methods * some fixes for notification history and login sso * forgot a space * fix packages and enable some screenshots * navigation bar fixes * fix some test * some fixes for notification history and navigation bar use correct visibility method in attachFileWidget test * fix searching and another fix for navigation * try solve sso login * some more fixes * refactor async forEach into for..of * try fix for search tests * resolve rebabse problems * remove install * fix lint * fix core e2e * fix core e2e * fix core e2e * fix ps tests * fix some tests * fix core e2e * fix core e2e * fix core * fix some issues PS * fix core * fix core * fix some ps test * fix rebase issues * remove save * fix url regressed after rebase * fix url regressed after rebase * fix ps and core * fix lint * more parallel e2e ps * fix some ps cloud test * some cloud fix * fix lint * fix some test * remove files to be ignored * out-tsc * improve one cs test * fix candidate base app * fix ps test * remove click function * clean methods alrady present in browser action * try ugly wait * move wait * remove duplicate call * remove underscore * fix after review * fix imports * minor cosmetic fixes * fix comments test
This commit is contained in:
@@ -15,182 +15,163 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { by, element } from 'protractor';
|
||||
import { by, element, ElementFinder } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||
import { ElementFinder } from 'protractor/built/element';
|
||||
|
||||
export class CardViewComponentPage {
|
||||
|
||||
addButton = element(by.className('adf-card-view__key-value-pairs__add-btn'));
|
||||
keyValueRow = 'card-view__key-value-pairs__row';
|
||||
addButton: ElementFinder = element(by.className('adf-card-view__key-value-pairs__add-btn'));
|
||||
selectValue = 'mat-option';
|
||||
textField = element(by.css(`input[data-automation-id='card-textitem-editinput-name']`));
|
||||
intField = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`));
|
||||
floatField = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`));
|
||||
valueInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Value']`));
|
||||
nameInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Name']`));
|
||||
consoleLog = element(by.className('adf-console'));
|
||||
deleteButton = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first();
|
||||
select = element(by.css('mat-select[data-automation-class="select-box"]'));
|
||||
checkbox = element(by.css(`mat-checkbox[data-automation-id='card-boolean-boolean']`));
|
||||
resetButton = element(by.css(`#adf-reset-card-log`));
|
||||
listContent = element(by.css('.mat-select-panel'));
|
||||
editableSwitch = element(by.id('adf-toggle-editable'));
|
||||
textField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-name']`));
|
||||
intField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`));
|
||||
floatField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`));
|
||||
valueInputField: ElementFinder = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Value']`));
|
||||
nameInputField: ElementFinder = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Name']`));
|
||||
consoleLog: ElementFinder = element(by.className('adf-console'));
|
||||
deleteButton: ElementFinder = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first();
|
||||
select: ElementFinder = element(by.css('mat-select[data-automation-class="select-box"]'));
|
||||
checkbox: ElementFinder = element(by.css(`mat-checkbox[data-automation-id='card-boolean-boolean']`));
|
||||
resetButton: ElementFinder = element(by.css(`#adf-reset-card-log`));
|
||||
listContent: ElementFinder = element(by.css('.mat-select-panel'));
|
||||
editableSwitch: ElementFinder = element(by.id('adf-toggle-editable'));
|
||||
|
||||
clickOnAddButton() {
|
||||
BrowserActions.click(this.addButton);
|
||||
return this;
|
||||
async clickOnAddButton(): Promise<void> {
|
||||
await BrowserActions.click(this.addButton);
|
||||
}
|
||||
|
||||
clickOnResetButton() {
|
||||
BrowserActions.click(this.resetButton);
|
||||
return this;
|
||||
async clickOnResetButton(): Promise<void> {
|
||||
await BrowserActions.click(this.resetButton);
|
||||
}
|
||||
|
||||
clickOnTextField() {
|
||||
const toggleText = element(by.css(`div[data-automation-id='card-textitem-edit-toggle-name']`));
|
||||
BrowserActions.click(toggleText);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
return this;
|
||||
async clickOnTextField(): Promise<void> {
|
||||
const toggleText: ElementFinder = element(by.css(`div[data-automation-id='card-textitem-edit-toggle-name']`));
|
||||
await BrowserActions.click(toggleText);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
}
|
||||
|
||||
clickOnTextClearIcon() {
|
||||
const clearIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-name"]`));
|
||||
BrowserActions.click(clearIcon);
|
||||
async clickOnTextClearIcon(): Promise<void> {
|
||||
const clearIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-name"]`));
|
||||
await BrowserActions.click(clearIcon);
|
||||
}
|
||||
|
||||
clickOnTextSaveIcon() {
|
||||
const saveIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-update-name"]`));
|
||||
BrowserActions.click(saveIcon);
|
||||
async clickOnTextSaveIcon(): Promise<void> {
|
||||
const saveIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-update-name"]`));
|
||||
await BrowserActions.click(saveIcon);
|
||||
}
|
||||
|
||||
getTextFieldText() {
|
||||
const textField = element(by.css(`span[data-automation-id="card-textitem-value-name"]`));
|
||||
getTextFieldText(): Promise<string> {
|
||||
const textField: ElementFinder = element(by.css(`span[data-automation-id="card-textitem-value-name"]`));
|
||||
return BrowserActions.getText(textField);
|
||||
}
|
||||
|
||||
enterTextField(text) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
BrowserActions.clearSendKeys(this.textField, text);
|
||||
return this;
|
||||
async enterTextField(text: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
|
||||
await BrowserActions.clearSendKeys(this.textField, text);
|
||||
}
|
||||
|
||||
clickOnIntField() {
|
||||
const toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]'));
|
||||
BrowserActions.click(toggleText);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.intField);
|
||||
return this;
|
||||
async clickOnIntField(): Promise<void> {
|
||||
const toggleText: ElementFinder = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]'));
|
||||
await BrowserActions.click(toggleText);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.intField);
|
||||
}
|
||||
|
||||
clickOnIntClearIcon() {
|
||||
const clearIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]'));
|
||||
BrowserActions.click(clearIcon);
|
||||
async clickOnIntClearIcon(): Promise<void> {
|
||||
const clearIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]'));
|
||||
await BrowserActions.click(clearIcon);
|
||||
}
|
||||
|
||||
clickOnIntSaveIcon() {
|
||||
const saveIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]'));
|
||||
BrowserActions.click(saveIcon);
|
||||
async clickOnIntSaveIcon(): Promise<void> {
|
||||
const saveIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]'));
|
||||
await BrowserActions.click(saveIcon);
|
||||
}
|
||||
|
||||
enterIntField(text) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.intField);
|
||||
BrowserActions.clearSendKeys(this.intField, text);
|
||||
return this;
|
||||
async enterIntField(text): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.intField);
|
||||
await BrowserActions.clearSendKeys(this.intField, text);
|
||||
}
|
||||
|
||||
getIntFieldText() {
|
||||
const textField = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
|
||||
getIntFieldText(): Promise<string> {
|
||||
const textField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
|
||||
return BrowserActions.getText(textField);
|
||||
}
|
||||
|
||||
getErrorInt() {
|
||||
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
|
||||
getErrorInt(): Promise<string> {
|
||||
const errorElement: ElementFinder = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
|
||||
return BrowserActions.getText(errorElement);
|
||||
}
|
||||
|
||||
clickOnFloatField() {
|
||||
const toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]'));
|
||||
BrowserActions.click(toggleText);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.floatField);
|
||||
return this;
|
||||
async clickOnFloatField(): Promise<void> {
|
||||
const toggleText: ElementFinder = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]'));
|
||||
await BrowserActions.click(toggleText);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.floatField);
|
||||
}
|
||||
|
||||
clickOnFloatClearIcon() {
|
||||
const clearIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-float"]`));
|
||||
BrowserActions.click(clearIcon);
|
||||
async clickOnFloatClearIcon(): Promise<void> {
|
||||
const clearIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-float"]`));
|
||||
await BrowserActions.click(clearIcon);
|
||||
}
|
||||
|
||||
clickOnFloatSaveIcon() {
|
||||
const saveIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-update-float"]`));
|
||||
BrowserActions.click(saveIcon);
|
||||
async clickOnFloatSaveIcon(): Promise<void> {
|
||||
const saveIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-update-float"]`));
|
||||
await BrowserActions.click(saveIcon);
|
||||
}
|
||||
|
||||
enterFloatField(text) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.floatField);
|
||||
BrowserActions.clearSendKeys(this.floatField, text);
|
||||
return this;
|
||||
async enterFloatField(text): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.floatField, text);
|
||||
}
|
||||
|
||||
getFloatFieldText() {
|
||||
const textField = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
|
||||
getFloatFieldText(): Promise<string> {
|
||||
const textField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
|
||||
return BrowserActions.getText(textField);
|
||||
}
|
||||
|
||||
getErrorFloat() {
|
||||
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
|
||||
getErrorFloat(): Promise<string> {
|
||||
const errorElement: ElementFinder = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
|
||||
return BrowserActions.getText(errorElement);
|
||||
}
|
||||
|
||||
setName(name) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.nameInputField);
|
||||
this.nameInputField.sendKeys(name);
|
||||
return this;
|
||||
async setName(name: string): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.nameInputField, name);
|
||||
}
|
||||
|
||||
setValue(value) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.valueInputField);
|
||||
this.valueInputField.sendKeys(value);
|
||||
return this;
|
||||
async setValue(value): Promise<void> {
|
||||
await BrowserActions.clearSendKeys(this.valueInputField, value);
|
||||
}
|
||||
|
||||
waitForOutput() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.consoleLog);
|
||||
return this;
|
||||
async waitForOutput(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.consoleLog);
|
||||
}
|
||||
|
||||
getOutputText(index) {
|
||||
getOutputText(index: number): Promise<string> {
|
||||
return BrowserActions.getText(this.consoleLog.all(by.css('p')).get(index));
|
||||
}
|
||||
|
||||
deletePairsValues() {
|
||||
BrowserActions.click(this.deleteButton);
|
||||
return this;
|
||||
async deletePairsValues(): Promise<void> {
|
||||
await BrowserActions.click(this.deleteButton);
|
||||
}
|
||||
|
||||
clickSelectBox() {
|
||||
BrowserActions.click(this.select);
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.listContent);
|
||||
async clickSelectBox(): Promise<void> {
|
||||
await BrowserActions.click(this.select);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.listContent);
|
||||
}
|
||||
|
||||
checkboxClick() {
|
||||
BrowserActions.click(this.checkbox);
|
||||
async checkboxClick(): Promise<void> {
|
||||
await BrowserActions.click(this.checkbox);
|
||||
}
|
||||
|
||||
selectValueFromComboBox(index) {
|
||||
async selectValueFromComboBox(index): Promise<void> {
|
||||
const value: ElementFinder = element.all(by.className(this.selectValue)).get(index);
|
||||
BrowserActions.click(value);
|
||||
return this;
|
||||
await BrowserActions.click(value);
|
||||
}
|
||||
|
||||
disableEdit() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
|
||||
async disableEdit(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
|
||||
|
||||
this.editableSwitch.getAttribute('class').then((check) => {
|
||||
if (check.indexOf('mat-checked') > -1) {
|
||||
this.editableSwitch.click();
|
||||
expect(this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
|
||||
}
|
||||
});
|
||||
const check = await this.editableSwitch.getAttribute('class');
|
||||
if (check.indexOf('mat-checked') > -1) {
|
||||
await BrowserActions.click(this.editableSwitch);
|
||||
await expect(await this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user