[ADF-4900] Card View and Metadata Components refactoring (#5592)

* [ADF-4900] Card View and Metadata Components refactoring

* CSS linting

* Unit test excluded

* Rebase branch

* Fix unit tests

* Fix linting

* Fix e2e tests

* Fix 2e2 tests

* Fix process-services e2e tests

* More fixes

* Fix more e2e tests

* Fix unit test

* Improve flaky unit test

* Fix process services e2e tests

* Update Process Header Cloud Page

* Fix linting

* Fix timing issue

* Lintintg

* Fix selectors

* Fix e2e tests

* Fix timing issue

* Fix C260328

* Fix spellcheck

* save screenshot

* performance issue

* Fix unit tests and e2e tests

* fix e2e

* refactoring

* fix lint

* fix e2e

* Fix C309698

* fix other e2e

* fix lint

* increase timeout

Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
This commit is contained in:
davidcanonieto
2020-04-27 00:09:52 +01:00
committed by GitHub
parent ebfeb053ce
commit 8f68899ce0
65 changed files with 1211 additions and 1214 deletions

View File

@@ -50,20 +50,22 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(fixture.debugElement.children.length).toBe(0);
});
it('should display status as running when process is not complete', () => {
it('should display status as running when process is not complete', async () => {
component.processInstance.ended = null;
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Running');
expect(valueEl.value).toBe('Running');
});
it('should display status as completed when process is complete', () => {
it('should display status as completed when process is complete', async () => {
component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Completed');
expect(valueEl.value).toBe('Completed');
});
it('should display due date', () => {
@@ -82,20 +84,22 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT');
});
it('should display process category', () => {
it('should display process category', async () => {
component.processInstance.processDefinitionCategory = 'Accounts';
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('Accounts');
expect(valueEl.value).toBe('Accounts');
});
it('should display placeholder if no process category', () => {
it('should display placeholder if no process category', async () => {
component.processInstance.processDefinitionCategory = null;
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT');
expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT');
});
it('should display created date', () => {
@@ -106,52 +110,58 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(valueEl.innerText).toBe('Nov 3, 2016');
});
it('should display started by', () => {
it('should display started by', async () => {
component.processInstance.startedBy = {firstName: 'Admin', lastName: 'User'};
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]');
expect(valueEl.innerText).toBe('Admin User');
expect(valueEl.value).toBe('Admin User');
});
it('should display process instance id', () => {
it('should display process instance id', async () => {
component.processInstance.id = '123';
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]');
expect(valueEl.innerText).toBe('123');
expect(valueEl.value).toBe('123');
});
it('should display description', () => {
it('should display description', async () => {
component.processInstance.processDefinitionDescription = 'Test process';
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('Test process');
expect(valueEl.value).toBe('Test process');
});
it('should display placeholder if no description', () => {
it('should display placeholder if no description', async () => {
component.processInstance.processDefinitionDescription = null;
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT');
expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT');
});
it('should display businessKey value', () => {
it('should display businessKey value', async () => {
component.processInstance.businessKey = 'fakeBusinessKey';
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('fakeBusinessKey');
expect(valueEl.value).toBe('fakeBusinessKey');
});
it('should display default key if no businessKey', () => {
it('should display default key if no businessKey', async () => {
component.processInstance.businessKey = null;
component.ngOnChanges();
fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT');
expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT');
});
describe('Config Filtering', () => {

View File

@@ -83,7 +83,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
expect(formNameEl.nativeElement.value).toBe('Wilbur Adams');
});
}));
@@ -94,7 +94,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
expect(valueEl.nativeElement.value).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
});
}));
@@ -106,7 +106,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
expect(formNameEl.nativeElement.innerText).toBe('27');
expect(formNameEl.nativeElement.value).toBe('27');
});
}));
@@ -287,7 +287,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('test form');
expect(valueEl.nativeElement.value).toBe('test form');
});
}));
@@ -301,8 +301,8 @@ describe('TaskHeaderComponent', () => {
const clickableForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
expect(clickableForm).toBeNull();
const readOnlyForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-scroll'));
expect(readOnlyForm.nativeElement.innerText).toBe('test form');
const readOnlyForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] input'));
expect(readOnlyForm.nativeElement.value).toBe('test form');
});
}));
@@ -335,7 +335,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
expect(valueEl.nativeElement.value).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
});
}));