mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3329] Refactor isCompleteFormButtonDisabled method (#5765)
* Refactor isCompleteFormButtonDisabled method - Change the isCompleteFormButtonDisabled() method structure as per the Code Style E2E 03-01 - Replace the isCompleteFormButtonDisabled() with isCompleteFormButtonEnabled() in the tests - Add lists with the default tasks and process filters name in order to use a variable instead of a string (ADW eg. in the breadcrumb checks) * Add visibility wait in isCompleteFormButtonEnabled method * Refactor isProcessListDisplayed method - Change the isProcessListDisplayed() method structure as per the Code Style E2E 03-01 - Replace the checkProcessListIsDisplayed() with isProcessListDisplayed() in the tests * Fix isCompleteFormButtonEnabled and isCancelButtonEnabled methods * Fix isCompleteFormButtonEnabled method * Create separate method to check for Complete button visibility * fix tslint
This commit is contained in:
@@ -72,22 +72,22 @@ describe('Amount Widget', () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.amount_input_id);
|
||||
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount');
|
||||
await expect(await widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount');
|
||||
await expect(await widget.amountWidget().getAmountFieldCurrency(app.FIELD.amount_input_id)).toBe('$');
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 4);
|
||||
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be less than 5');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id);
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 101);
|
||||
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe('Can\'t be greater than 100');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id);
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 6);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
@@ -72,6 +72,6 @@ describe('Attach Folder widget', () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.upload_button_id);
|
||||
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
@@ -69,9 +69,9 @@ describe('Checkbox Widget', () => {
|
||||
it('[C268554] Should be able to set general settings for Checkbox widget ', async () => {
|
||||
await taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, '2');
|
||||
await expect(await widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_input_id);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C272812] Should be able to set visibility settings for Checkbox widget', async () => {
|
||||
|
@@ -68,13 +68,13 @@ describe('Date and time widget', () => {
|
||||
|
||||
it('[C268818] Should be able to set general settings for Date Time widget', async () => {
|
||||
await expect(await widget.dateTimeWidget().getDateTimeLabel(app.FIELD.date_time_input)).toContain('Date');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.dateTimeWidget().openDatepicker(app.FIELD.date_time_input);
|
||||
await widget.dateTimeWidget().selectDay('10');
|
||||
await widget.dateTimeWidget().selectHour('8');
|
||||
await widget.dateTimeWidget().selectMinute('30');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
|
||||
await expect(await widget.dateTimeWidget().getPlaceholder(app.FIELD.date_time_between_input)).toBe('Choose anything...');
|
||||
});
|
||||
|
@@ -80,10 +80,10 @@ describe('Date widget', () => {
|
||||
|
||||
it('[C268814] Should be able to set general settings for Date widget', async () => {
|
||||
await expect(await dateWidget.getDateLabel(app.FIELD.date_input)).toContain('Date');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await dateWidget.setDateInput(app.FIELD.date_input, '20-10-2018');
|
||||
await taskPage.formFields().saveForm();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C277234] Should be able to set advanced settings for Date widget ', async () => {
|
||||
|
@@ -66,19 +66,19 @@ describe('Dropdown widget', () => {
|
||||
});
|
||||
|
||||
it('[C269051] Should be possible to set general and options properties for Dropdown widget ', async () => {
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.dropdown().selectOption('Happy');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Happy');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
|
||||
await widget.dropdown().selectOption('Choose one');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Choose one');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.dropdown().selectOption('Sad');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Sad');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C269052] Should be possible to set visibility properties for Dropdown widget', async () => {
|
||||
|
@@ -72,6 +72,6 @@ describe('Header widget', async () => {
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.header_id);
|
||||
|
||||
await expect(await widget.headerWidget().getFieldLabel(app.FIELD.header_id)).toBe('Header');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
@@ -68,28 +68,28 @@ describe('Multi-line Widget', () => {
|
||||
it('[C268182] Should be able to set general properties for Multi-line Text Widget', async () => {
|
||||
const label = await widget.multilineTextWidget().getFieldLabel(app.FIELD.multiSimple);
|
||||
await expect(label).toBe('multiSimple*');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
const placeHolder = await widget.multilineTextWidget().getFieldPlaceHolder(app.FIELD.multiSimple);
|
||||
await expect(placeHolder).toBe('Type something...');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268184] Should be able to set advanced properties for Multi-line Text Widget', async () => {
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'A');
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter at least 4 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'AAAAAAAAAAA');
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter no more than 10 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'AAAA');
|
||||
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, '3');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiRegexp)).toContain('Enter a different value');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, 'TE');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268232] Should be able to set visibility properties for Multi-line Text Widget', async () => {
|
||||
|
@@ -67,12 +67,12 @@ describe('Number widget', () => {
|
||||
});
|
||||
|
||||
it('[C269111] Should be able to set general properties for Number Widget', async () => {
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.numberWidget().getNumberFieldLabel(app.FIELD.number_general)).toContain('Number General');
|
||||
await expect(await widget.numberWidget().getPlaceholder(app.FIELD.number_general)).toContain('Type a number');
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_general, 2);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C274702] Should be able to set advanced and visibility properties for Number Widget', async () => {
|
||||
@@ -84,15 +84,15 @@ describe('Number widget', () => {
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 2);
|
||||
await expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe('Can\'t be less than 3');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.numberWidget().clearFieldValue(app.FIELD.number_visible);
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 101);
|
||||
await expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe('Can\'t be greater than 100');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.numberWidget().clearFieldValue(app.FIELD.number_visible);
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 4);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
@@ -74,11 +74,11 @@ describe('Radio Buttons Widget', () => {
|
||||
|
||||
it('[C274704] Should be able to set visibility properties for Radio Button widget', async () => {
|
||||
await taskPage.formFields().checkWidgetIsHidden(app.FIELD.radio_buttons_id);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await expect(await widget.radioWidget().getRadioWidgetLabel(app.FIELD.radio_buttons_id)).toContain('Radio posts');
|
||||
await widget.radioWidget().selectOption(app.FIELD.radio_buttons_id, 1);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
@@ -69,20 +69,20 @@ describe('Text widget', () => {
|
||||
it('[C268157] Should be able to set general properties for Text widget', async () => {
|
||||
const label = await widget.textWidget().getFieldLabel(app.FIELD.simpleText);
|
||||
await expect(label).toBe('textSimple*');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
const placeHolder = await widget.textWidget().getFieldPlaceHolder(app.FIELD.simpleText);
|
||||
await expect(placeHolder).toBe('Type something...');
|
||||
await widget.textWidget().setValue(app.FIELD.simpleText, 'TEST');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268170] Min-max length properties', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.textMinMax, 'A');
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter at least 4 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.textWidget().setValue(app.FIELD.textMinMax, 'AAAAAAAAAAA');
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter no more than 10 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
});
|
||||
|
||||
it('[C268171] Input mask reversed checkbox properties', async () => {
|
||||
@@ -98,10 +98,10 @@ describe('Text widget', () => {
|
||||
it('[C268177] Should be able to set Regex Pattern property for Text widget', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.simpleText, 'TEST');
|
||||
await widget.textWidget().setValue(app.FIELD.textRegexp, 'T');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textRegexp)).toContain('Enter a different value');
|
||||
await widget.textWidget().setValue(app.FIELD.textRegexp, 'TE');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C274712] Should be able to set visibility properties for Text widget ', async () => {
|
||||
|
Reference in New Issue
Block a user