Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { AggregationMapping, FieldMapping } from '@admin-client/reporting-shared';
import { AggregationMappingFormE2EComponent } from '../../components/aggregation-mapping/aggregation-mapping-form.e2e.component';
import { AggregationMappingE2EComponent } from '../../components/aggregation-mapping/aggregation-mapping.e2e.component';
import { enterWith, haveText, haveValue } from '../../support/cypress.util';
export class E2EAggregationMappingHelper {
private component: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
private formComponent: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
public enterName(text: string): void {
enterWith(this.formComponent.getNameInput(), text);
}
public enterFormEngine(text: string): void {
enterWith(this.formComponent.getFormEngineInput(), text);
}
public enterFormId(text: string): void {
enterWith(this.formComponent.getFormIdInput(), text);
}
public enterSourcePath(text: string, index: number): void {
enterWith(this.formComponent.getSourceMappingFieldInput(index), text);
}
public enterTargetPath(text: string, index: number): void {
enterWith(this.formComponent.getTargetMappingFieldInput(index), text);
}
public enterFieldMapping(fieldMapping: FieldMapping, index: number): void {
this.enterSourcePath(fieldMapping.sourcePath, index);
this.enterTargetPath(fieldMapping.targetPath, index);
}
public enterForm(aggregationMapping: AggregationMapping): void {
this.enterName(aggregationMapping.name);
this.enterFormEngine(aggregationMapping.formIdentifier.formEngineName);
this.enterFormId(aggregationMapping.formIdentifier.formId);
aggregationMapping.mappings.forEach((fieldMapping, index) => {
this.enterFieldMapping(fieldMapping, index);
});
}
public verifyFieldMapping(fieldMapping: FieldMapping, index: number): void {
haveValue(this.formComponent.getSourceMappingFieldInput(index), fieldMapping.sourcePath);
haveValue(this.formComponent.getTargetMappingFieldInput(index), fieldMapping.targetPath);
}
public verifyForm(aggregationMapping: AggregationMapping): void {
haveValue(this.formComponent.getNameInput(), aggregationMapping.name);
haveValue(this.formComponent.getFormEngineInput(), aggregationMapping.formIdentifier.formEngineName);
haveValue(this.formComponent.getFormIdInput(), aggregationMapping.formIdentifier.formId);
aggregationMapping.mappings.forEach((fieldMapping, index) => {
this.verifyFieldMapping(fieldMapping, index);
});
}
public verifyAggregationMappingInList(aggregationMapping: AggregationMapping): void {
haveText(this.component.getListItemName(), aggregationMapping.name);
haveText(this.component.getListItemFormEngineName(), aggregationMapping.formIdentifier.formEngineName);
haveText(this.component.getListItemFormId(), aggregationMapping.formIdentifier.formId);
}
}