mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[NO-ISSUE] Fix e2e test (#4621)
* fix sso, change timeout, parallel * cange travis * move name apps in resources file * resources fix * resources fix * add sleep before search group * add possibility to extend duration of snack-bar message from configuration * fix unit test * fix unit test * remove timeout * change timeout * decrease message time * add lint main branch travis * reduce timeout * add new check application presence * change permission script fix search selector * fix travis conf * check app environment and upload the app if abbsent * fix cloud test * remove duplicate * restore ps test * restore resources file * fix e2e test * process with variables missing * test new conf travis * fix lint * fix spellcheck * remove duplicate module * fix ps module * fix travis conf * change check activiti env * add concept of processes in resources
This commit is contained in:
@@ -38,7 +38,8 @@ export enum AppConfigValues {
|
||||
LOGIN_ROUTE = 'loginRoute',
|
||||
DISABLECSRF = 'disableCSRF',
|
||||
AUTH_WITH_CREDENTIALS = 'auth.withCredentials',
|
||||
APPLICATION = 'application'
|
||||
APPLICATION = 'application',
|
||||
NOTIFY_DURATION = 'notificationDefaultDuration'
|
||||
}
|
||||
|
||||
export enum Status {
|
||||
|
||||
@@ -21,6 +21,11 @@ import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ClipboardModule } from './clipboard.module';
|
||||
import { ClipboardService } from './clipboard.service';
|
||||
import { TranslationService } from '../services/translation.service';
|
||||
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { MatSnackBarModule } from '@angular/material';
|
||||
import { TranslationMock } from '@alfresco/adf-core';
|
||||
|
||||
describe('ClipboardService', () => {
|
||||
let clipboardService: ClipboardService;
|
||||
@@ -30,20 +35,15 @@ describe('ClipboardService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ClipboardModule
|
||||
ClipboardModule,
|
||||
HttpClientModule,
|
||||
MatSnackBarModule
|
||||
],
|
||||
providers: [
|
||||
LogService,
|
||||
NotificationService,
|
||||
{
|
||||
provide: AppConfigService,
|
||||
useValue: new AppConfigService(null)
|
||||
|
||||
},
|
||||
{
|
||||
provide: NotificationService,
|
||||
useValue: new NotificationService(null, null)
|
||||
}
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
NotificationService
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,6 +25,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NotificationService } from './notification.service';
|
||||
import { TranslationMock } from '../mock/translation.service.mock';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
@@ -76,7 +77,8 @@ describe('NotificationService', () => {
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
OverlayModule,
|
||||
MatSnackBarModule
|
||||
MatSnackBarModule,
|
||||
HttpClientModule
|
||||
],
|
||||
declarations: [ProvidesNotificationServiceComponent],
|
||||
providers: [
|
||||
|
||||
@@ -18,16 +18,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatSnackBar, MatSnackBarRef, MatSnackBarConfig } from '@angular/material';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NotificationService {
|
||||
|
||||
static DEFAULT_DURATION_MESSAGE: number = 5000;
|
||||
DEFAULT_DURATION_MESSAGE: number = 5000;
|
||||
|
||||
constructor(private snackBar: MatSnackBar,
|
||||
private translationService: TranslationService) {
|
||||
private translationService: TranslationService,
|
||||
private appConfigService: AppConfigService) {
|
||||
this.DEFAULT_DURATION_MESSAGE = this.appConfigService.get<number>(AppConfigValues.NOTIFY_DURATION) || this.DEFAULT_DURATION_MESSAGE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +40,10 @@ export class NotificationService {
|
||||
* @param config Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
* @returns Information/control object for the SnackBar
|
||||
*/
|
||||
openSnackMessage(message: string, config: number | MatSnackBarConfig = NotificationService.DEFAULT_DURATION_MESSAGE): MatSnackBarRef<any> {
|
||||
openSnackMessage(message: string, config?: number | MatSnackBarConfig): MatSnackBarRef<any> {
|
||||
if (!config) {
|
||||
config = this.DEFAULT_DURATION_MESSAGE;
|
||||
}
|
||||
|
||||
const translatedMessage = this.translationService.instant(message);
|
||||
|
||||
@@ -56,7 +63,10 @@ export class NotificationService {
|
||||
* @param config Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
* @returns Information/control object for the SnackBar
|
||||
*/
|
||||
openSnackMessageAction(message: string, action: string, config: number | MatSnackBarConfig = NotificationService.DEFAULT_DURATION_MESSAGE): MatSnackBarRef<any> {
|
||||
openSnackMessageAction(message: string, action: string, config?: number | MatSnackBarConfig): MatSnackBarRef<any> {
|
||||
if (!config) {
|
||||
config = this.DEFAULT_DURATION_MESSAGE;
|
||||
}
|
||||
|
||||
const translatedMessage = this.translationService.instant(message);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { FormCloudComponent } from './components/form-cloud.component';
|
||||
import { UploadCloudWidgetComponent } from './components/upload-cloud.widget';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { TaskFormCloudComponent } from './components/task-form-cloud.component';
|
||||
import { TaskModule } from '../task/task.module';
|
||||
import { TaskCloudModule } from '../task/task-cloud.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -37,7 +37,7 @@ import { TaskModule } from '../task/task.module';
|
||||
ReactiveFormsModule,
|
||||
FormBaseModule,
|
||||
CoreModule,
|
||||
TaskModule
|
||||
TaskCloudModule
|
||||
],
|
||||
declarations: [FormCloudComponent, UploadCloudWidgetComponent, TaskFormCloudComponent],
|
||||
entryComponents: [
|
||||
|
||||
@@ -20,19 +20,22 @@ import { TaskListCloudModule } from './task-list/task-list-cloud.module';
|
||||
import { TaskFiltersCloudModule } from './task-filters/task-filters-cloud.module';
|
||||
import { StartTaskCloudModule } from './start-task/start-task-cloud.module';
|
||||
import { TaskHeaderCloudModule } from './task-header/task-header-cloud.module';
|
||||
import { TaskDirectiveModule } from './directives/task-directive.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
TaskListCloudModule,
|
||||
TaskFiltersCloudModule,
|
||||
StartTaskCloudModule,
|
||||
TaskHeaderCloudModule
|
||||
TaskHeaderCloudModule,
|
||||
TaskDirectiveModule
|
||||
],
|
||||
exports: [
|
||||
TaskListCloudModule,
|
||||
TaskFiltersCloudModule,
|
||||
StartTaskCloudModule,
|
||||
TaskHeaderCloudModule
|
||||
TaskHeaderCloudModule,
|
||||
TaskDirectiveModule
|
||||
]
|
||||
})
|
||||
export class TaskCloudModule { }
|
||||
|
||||
@@ -31,7 +31,17 @@ export class ProcessDefinitionsService {
|
||||
|
||||
const queryParams = {};
|
||||
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, {});
|
||||
return data;
|
||||
try {
|
||||
const data = await this.api.performBpmOperation(path, method, queryParams, {});
|
||||
return data;
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`${appName} not present`);
|
||||
} else if (error.status === 403) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`Access to the requested resource has been denied ${appName}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ export class EditProcessFilterCloudComponentPage {
|
||||
checkCustomiseFilterHeaderIsExpanded() {
|
||||
const expansionPanelExtended = element.all(by.css('mat-expansion-panel-header[class*="mat-expanded"]')).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(expansionPanelExtended);
|
||||
const content = element(by.css('div[class*="mat-expansion-panel-content "][style*="visible"]'));
|
||||
const content = element.all(by.css('div[class*="mat-expansion-panel-content "][style*="visible"]')).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(content);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { by, element, protractor } from 'protractor';
|
||||
import { browser, by, element, protractor } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/browser-visibility';
|
||||
|
||||
export class GroupCloudComponentPage {
|
||||
@@ -24,6 +24,7 @@ export class GroupCloudComponentPage {
|
||||
|
||||
searchGroups(name) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
|
||||
browser.sleep(1000);
|
||||
this.groupCloudSearch.clear().then(() => {
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
this.groupCloudSearch.sendKeys(name[i]);
|
||||
@@ -53,6 +54,7 @@ export class GroupCloudComponentPage {
|
||||
selectGroupFromList(name) {
|
||||
const groupRow = element.all(by.cssContainingText('mat-option span', name)).first();
|
||||
BrowserVisibility.waitUntilElementIsVisible(groupRow);
|
||||
browser.sleep(1000);
|
||||
groupRow.click();
|
||||
BrowserVisibility.waitUntilElementIsNotVisible(groupRow);
|
||||
return this;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { by, element, protractor } from 'protractor';
|
||||
import { browser, by, element, protractor } from 'protractor';
|
||||
import { BrowserVisibility } from '../../core/browser-visibility';
|
||||
|
||||
export class PeopleCloudComponentPage {
|
||||
@@ -34,6 +34,7 @@ export class PeopleCloudComponentPage {
|
||||
searchAssignee(name) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSearch);
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.peopleCloudSearch);
|
||||
browser.sleep(1000);
|
||||
this.peopleCloudSearch.clear().then(() => {
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
this.peopleCloudSearch.sendKeys(name[i]);
|
||||
@@ -57,6 +58,7 @@ export class PeopleCloudComponentPage {
|
||||
selectAssigneeFromList(name) {
|
||||
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
|
||||
BrowserVisibility.waitUntilElementIsVisible(assigneeRow);
|
||||
browser.sleep(1000);
|
||||
assigneeRow.click();
|
||||
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
|
||||
return this;
|
||||
@@ -86,6 +88,7 @@ export class PeopleCloudComponentPage {
|
||||
|
||||
getAssigneeFieldContent() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
|
||||
browser.sleep(1000);
|
||||
return this.assigneeField.getAttribute('value');
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ export class ProcessHeaderCloudPage {
|
||||
nameField = element.all(by.css('span[data-automation-id*="name"] span')).first();
|
||||
statusField = element(by.css('span[data-automation-id*="status"] span'));
|
||||
initiatorField = element(by.css('span[data-automation-id*="initiator"] span'));
|
||||
startDateField = element(by.css('span[data-automation-id*="startDate"] span'));
|
||||
lastModifiedField = element(by.css('span[data-automation-id*="lastModified"] span'));
|
||||
startDateField = element.all(by.css('span[data-automation-id*="startDate"] span')).first();
|
||||
lastModifiedField = element.all(by.css('span[data-automation-id*="lastModified"] span')).first();
|
||||
parentIdField = element(by.css('span[data-automation-id*="parentId"] span'));
|
||||
businessKeyField = element.all(by.css('span[data-automation-id*="businessKey"] span')).first();
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ export class StartProcessCloudPage {
|
||||
}
|
||||
|
||||
checkStartProcessButtonIsEnabled() {
|
||||
BrowserVisibility.waitUntilElementIsClickable(this.startProcessButton);
|
||||
expect(this.startProcessButton.isEnabled()).toBe(true);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ export class StartTasksCloudPage {
|
||||
startButton = element(by.css('button[id="button-start"]'));
|
||||
startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)'));
|
||||
cancelButton = element(by.css('button[id="button-cancel"]'));
|
||||
form = element(by.css('adf-cloud-start-task form'));
|
||||
form = element.all(by.css('adf-cloud-start-task form')).first();
|
||||
|
||||
checkFormIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.form);
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ export class TaskHeaderCloudPage {
|
||||
assigneeField = element(by.css('span[data-automation-id*="assignee"] span'));
|
||||
statusField = element(by.css('span[data-automation-id*="status"] span'));
|
||||
priorityField = element(by.css('span[data-automation-id*="priority"] span'));
|
||||
dueDateField = element(by.css('span[data-automation-id*="dueDate"] span'));
|
||||
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
|
||||
categoryField = element(by.css('span[data-automation-id*="category"] span'));
|
||||
createdField = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
|
||||
parentNameField = element(by.css('span[data-automation-id*="parentName"] span'));
|
||||
|
||||
Reference in New Issue
Block a user