mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4650] Fix and refactor amount, date and date-time widgets (#4957)
* [ADF-4650] Fix and refactor amount, date and date-time widgets * fix e2e tests * Fix people cloud test * Fix e2e date test * fix lint
This commit is contained in:
committed by
Eugenio Romano
parent
624ca9f0ae
commit
479416861f
@@ -97,30 +97,24 @@ describe('People Groups Cloud Component', () => {
|
||||
|
||||
afterAll(async (done) => {
|
||||
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
await identityService.deleteIdentityUser(users[i]);
|
||||
}
|
||||
for (let i = 0; i < groups.length; i++) {
|
||||
await groupIdentityService.deleteIdentityGroup(groups[i]);
|
||||
}
|
||||
users.forEach(async (user) => {
|
||||
await identityService.deleteIdentityUser(user);
|
||||
});
|
||||
|
||||
await identityService.deleteIdentityUser(testUser.idIdentityService);
|
||||
await identityService.deleteIdentityUser(apsUser.idIdentityService);
|
||||
await identityService.deleteIdentityUser(activitiUser.idIdentityService);
|
||||
groups.forEach(async (group) => {
|
||||
await groupIdentityService.deleteIdentityGroup(group);
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
await browser.refresh();
|
||||
navigationBarPage.navigateToPeopleGroupCloudPage();
|
||||
peopleGroupCloudComponentPage.checkGroupsCloudComponentTitleIsDisplayed();
|
||||
peopleGroupCloudComponentPage.checkPeopleCloudComponentTitleIsDisplayed();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await browser.refresh();
|
||||
});
|
||||
|
||||
describe('[C297674] Should be able to add filtering to People Cloud Component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -303,7 +297,6 @@ describe('People Groups Cloud Component', () => {
|
||||
`{"firstName":"${activitiUser.firstName}","lastName":"${activitiUser.lastName}",{"firstName":"${noRoleUser.firstName}","lastName":"${noRoleUser.lastName}"]`);
|
||||
browser.sleep(200);
|
||||
expect(peopleCloudComponent.getAssigneeFieldContent()).toBe('');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -86,7 +86,7 @@ describe('Form Component', () => {
|
||||
|
||||
widget.dateWidget().checkLabelIsVisible(fields.dateWidgetId);
|
||||
widget.dateWidget().setDateInput(fields.dateWidgetId, message.test);
|
||||
widget.dateWidget().clickOutsideWidget(fields.dateWidgetId);
|
||||
formPage.saveForm();
|
||||
formPage.checkErrorMessageForWidgetIsDisplayed(message.warningDate);
|
||||
formPage.checkErrorLogMessage(message.errorLogDate);
|
||||
|
||||
|
@@ -91,16 +91,14 @@ describe('Date and time widget', () => {
|
||||
widget.dateTimeWidget().openDatepicker(app.FIELD.date_time_between_input);
|
||||
widget.dateTimeWidget().closeDataTimeWidget();
|
||||
widget.dateTimeWidget().setDateTimeInput(app.FIELD.date_time_between_input, '20-03-17 07:30 PM');
|
||||
widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input);
|
||||
taskPage.formFields().saveForm();
|
||||
expect(widget.dateTimeWidget().getErrorMessage(app.FIELD.date_time_between_input)).toContain('Can\'t be less than');
|
||||
|
||||
widget.dateTimeWidget().openDatepicker(app.FIELD.date_time_between_input);
|
||||
widget.dateTimeWidget().closeDataTimeWidget();
|
||||
|
||||
widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input);
|
||||
widget.dateTimeWidget().removeFromDatetimeWidget(app.FIELD.date_time_between_input);
|
||||
widget.dateTimeWidget().closeDataTimeWidget();
|
||||
widget.dateTimeWidget().setDateTimeInput(app.FIELD.date_time_between_input, '20-03-19 07:30 PM');
|
||||
widget.dateTimeWidget().clickOutsideWidget(app.FIELD.date_time_between_input);
|
||||
taskPage.formFields().saveForm();
|
||||
expect(widget.dateTimeWidget().getErrorMessage(app.FIELD.date_time_between_input)).toContain('Can\'t be greater than');
|
||||
});
|
||||
});
|
||||
|
@@ -78,17 +78,17 @@ describe('Date widget', () => {
|
||||
expect(widget.dateWidget().getDateLabel(app.FIELD.date_input)).toContain('Date');
|
||||
expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
||||
widget.dateWidget().setDateInput(app.FIELD.date_input, '20-10-2018');
|
||||
widget.dateWidget().clickOutsideWidget(app.FIELD.date_input);
|
||||
taskPage.formFields().saveForm();
|
||||
expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
||||
});
|
||||
|
||||
it('[C277234] Should be able to set advanced settings for Date widget ', () => {
|
||||
widget.dateWidget().setDateInput(app.FIELD.date_between_input, '20-10-2017');
|
||||
widget.dateWidget().clickOutsideWidget(app.FIELD.date_between_input);
|
||||
taskPage.formFields().saveForm();
|
||||
expect(widget.dateWidget().getErrorMessage(app.FIELD.date_between_input)).toBe('Can\'t be less than 1-10-2018');
|
||||
widget.dateWidget().clearDateInput(app.FIELD.date_between_input);
|
||||
widget.dateWidget().setDateInput(app.FIELD.date_between_input, '20-10-2019');
|
||||
widget.dateWidget().clickOutsideWidget(app.FIELD.date_between_input);
|
||||
taskPage.formFields().saveForm();
|
||||
expect(widget.dateWidget().getErrorMessage(app.FIELD.date_between_input)).toBe('Can\'t be greater than 31-10-2018');
|
||||
});
|
||||
});
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<div class="adf-amount-widget__container adf-amount-widget {{field.className}}" [class.adf-invalid]="!field.isValid" [class.adf-readonly]="field.readOnly">
|
||||
<mat-form-field class="adf-amount-widget__input">
|
||||
<label class="adf-label" [attr.for]="field.id">{{field.name | translate }}<span *ngIf="isRequired()">*</span></label>
|
||||
<span matPrefix class="adf-amount-widget__prefix-spacing"> {{currency }}</span>
|
||||
<span matPrefix class="adf-amount-widget__prefix-spacing">{{ currency }}</span>
|
||||
<input matInput
|
||||
class="adf-amount-widget"
|
||||
class="adf-input"
|
||||
type="text"
|
||||
[id]="field.id"
|
||||
[required]="isRequired()"
|
||||
|
@@ -3,38 +3,17 @@
|
||||
.adf {
|
||||
&-amount-widget {
|
||||
width: 100%;
|
||||
vertical-align: baseline !important;
|
||||
|
||||
.mat-input-placeholder {
|
||||
margin-top: 5px;
|
||||
display: none;
|
||||
.mat-input-element {
|
||||
margin-left: 13px;
|
||||
margin-right: 13px;
|
||||
}
|
||||
|
||||
.mat-form-field-flex {
|
||||
position: relative;
|
||||
padding-top: 18.5px;
|
||||
}
|
||||
|
||||
.mat-form-field-infix {
|
||||
position: static;
|
||||
padding-top: 19px;
|
||||
}
|
||||
|
||||
.adf-label {
|
||||
position: absolute;
|
||||
top: 18.5px;
|
||||
left:0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-amount-widget__container {
|
||||
max-width: 100%;
|
||||
|
||||
.mat-form-field-label-wrapper {
|
||||
top: 34px !important;
|
||||
left: 13px;
|
||||
}
|
||||
&-amount-widget__container .mat-form-field-label-wrapper {
|
||||
top: 17px;
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
&-amount-widget__input .mat-focused {
|
||||
@@ -42,8 +21,8 @@
|
||||
}
|
||||
|
||||
&-amount-widget__prefix-spacing {
|
||||
padding-right: 5px;
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,27 +1,11 @@
|
||||
@import '../form';
|
||||
|
||||
.adf {
|
||||
|
||||
&-date-time-widget {
|
||||
|
||||
.mat-form-field-suffix {
|
||||
text-align: right;
|
||||
position: absolute;
|
||||
margin-top: 30px;
|
||||
width: 100%;
|
||||
top: 26px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* query for Microsoft IE 11*/
|
||||
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
|
||||
&-date-widget {
|
||||
.mat-form-field-suffix {
|
||||
position: relative;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,44 +1,9 @@
|
||||
@import '../form';
|
||||
|
||||
.adf {
|
||||
|
||||
&-date-widget {
|
||||
.mat-form-field-suffix {
|
||||
text-align: right;
|
||||
position: absolute;
|
||||
margin-top: 30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&-date-widget-button {
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
|
||||
&-date-input {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
&-grid-date-widget {
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-date-widget-button__cell {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
top: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
/* query for Microsoft IE 11*/
|
||||
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
|
||||
&-date-widget {
|
||||
.mat-form-field-suffix {
|
||||
position: relative;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,10 +17,12 @@
|
||||
|
||||
import { element, by } from 'protractor';
|
||||
import { BrowserVisibility } from '../../utils/browser-visibility';
|
||||
import { BrowserActions } from '../../utils/public-api';
|
||||
|
||||
export class FormPage {
|
||||
|
||||
errorLog = element(by.css('div[class*="console"]'));
|
||||
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
|
||||
|
||||
checkErrorMessageForWidgetIsDisplayed(errorMessage) {
|
||||
return BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('.adf-error-text', errorMessage)));
|
||||
@@ -40,4 +42,9 @@ export class FormPage {
|
||||
return BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="console"] p', errorMessage)));
|
||||
}
|
||||
|
||||
saveForm() {
|
||||
BrowserActions.click(this.saveButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user