Skip to content
Snippets Groups Projects
Commit 60246384 authored by Martin's avatar Martin
Browse files

OZG-7473 adjust component/structure; rename db settings -> aggregationMapping

parent 092e812c
Branches
Tags
2 merge requests!107Ozg 7473 e2e,!104Administration: Neu hinzugefügte Felder für Statistik speichern
Showing
with 148 additions and 90 deletions
import { getTestElement } from '../../support/cypress-helper';
import { convertToDataTestId } from '../../support/tech-util';
export class AggregationMappingE2EComponent {
private readonly headerText: string = 'aggregation-mapping-header-text';
private readonly listItemName: string = 'list-item-name';
private readonly listItemFormEngineName: string = 'list-item-form-engine-name';
private readonly listItemFormId: string = 'list-item-form-id';
private readonly weitereFelderAuswertenButton = 'weitere-felder-auswerten-button';
public getHeaderText(): Cypress.Chainable<Element> {
return cy.getTestElement(this.headerText);
}
public getListItemName(): Cypress.Chainable<Element> {
return cy.getTestElementWithClass(this.listItemName);
public getWeitereFelderAuswertenButton(): Cypress.Chainable<Element> {
return cy.getTestElement(this.weitereFelderAuswertenButton);
}
public getListItem(name: string): AggregationMappingListItemE2EComponent {
return new AggregationMappingListItemE2EComponent(name);
}
}
export class AggregationMappingListItemE2EComponent {
private root: string;
private readonly listItemName: string = 'list-item-name';
private readonly listItemFormEngineName: string = 'list-item-form-engine-name';
private readonly listItemFormId: string = 'list-item-form-id';
constructor(root: string) {
this.root = convertToDataTestId(root);
}
public getListItemFormEngineName(): Cypress.Chainable<Element> {
return cy.getTestElementWithClass(this.listItemFormEngineName);
public getRoot(): Cypress.Chainable<Element> {
return getTestElement(this.root);
}
public getListItemFormId(): Cypress.Chainable<Element> {
return cy.getTestElementWithClass(this.listItemFormId);
public getName(): Cypress.Chainable<Element> {
return this.getRoot().findTestElementWithClass(this.listItemName);
}
public getWeitereFelderAuswertenButton(): Cypress.Chainable<Element> {
return cy.getTestElement(this.weitereFelderAuswertenButton);
public getFormEngineName(): Cypress.Chainable<Element> {
return this.getRoot().findTestElementWithClass(this.listItemFormEngineName);
}
public getFormId(): Cypress.Chainable<Element> {
return this.getRoot().findTestElementWithClass(this.listItemFormId);
}
}
import { AggregationMapping, FieldMapping } from '@admin-client/reporting-shared';
import { E2EAggregationMappingVerifier } from 'apps/admin-e2e/src/helper/aggregation-mapping/aggregation-mapping.verifier';
import { AggregationMappingFormE2EComponent } from '../../../components/aggregation-mapping/aggregation-mapping-form.e2e.component';
import { AggregationMappingE2EComponent } from '../../../components/aggregation-mapping/aggregation-mapping.e2e.component';
import { E2EAggregationMappingHelper } from '../../../helper/aggregation-mapping/aggregation-mapping.helper';
......@@ -7,10 +8,11 @@ import { exist, notExist } from '../../../support/cypress.util';
import { loginAsDaria } from '../../../support/user-util';
describe('Aggregation Mapping hinzufügen', () => {
const component: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
const formComponent: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
const page: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
const form: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
const helper: E2EAggregationMappingHelper = new E2EAggregationMappingHelper();
const verifier: E2EAggregationMappingVerifier = new E2EAggregationMappingVerifier();
const fieldMapping0: FieldMapping = {
sourcePath: '/path/to/source/a',
......@@ -40,43 +42,45 @@ describe('Aggregation Mapping hinzufügen', () => {
});
it('should show "Weitere Felder auswerten" button', () => {
exist(component.getWeitereFelderAuswertenButton());
helper.openStatistik();
exist(page.getWeitereFelderAuswertenButton());
});
it('should show form after button click', () => {
component.getWeitereFelderAuswertenButton().click();
page.getWeitereFelderAuswertenButton().click();
exist(formComponent.getRoot());
exist(form.getRoot());
});
it('should navigate to aggregation mapping on cancel', () => {
formComponent.getCancelButton().click();
form.getCancelButton().click();
exist(component.getWeitereFelderAuswertenButton());
exist(page.getWeitereFelderAuswertenButton());
});
it('should add data field in form', () => {
component.getWeitereFelderAuswertenButton().click();
formComponent.getAddFieldButton().click();
page.getWeitereFelderAuswertenButton().click();
form.getAddFieldButton().click();
exist(formComponent.getDataFieldInput(1));
exist(form.getDataFieldInput(1));
});
it('should fill out form with two data fields', () => {
helper.enterForm(aggregationMapping);
helper.fillFormular(aggregationMapping);
helper.verifyForm(aggregationMapping);
verifier.verifyForm(aggregationMapping);
});
it('should delete data fields', () => {
formComponent.getDataFieldDeleteButton(0).click();
form.getDataFieldDeleteButton(0).click();
notExist(formComponent.getDataFieldInput(1));
notExist(form.getDataFieldInput(1));
});
it('should show aggregation mapping in list after save', () => {
formComponent.getSaveButton().click();
form.getSaveButton().click();
helper.verifyAggregationMappingInList(aggregationMapping);
verifier.verifyAggregationMappingInList(aggregationMapping);
});
});
import { AggregationMapping, FieldMapping } from '@admin-client/reporting-shared';
import { AggregationMappingFormE2EComponent } from '../../components/aggregation-mapping/aggregation-mapping-form.e2e.component';
import { enterWith } from '../../support/cypress.util';
export class E2EAggregationMappingExecutor {
private formComponent: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
public fillFormular(aggregationMapping: AggregationMapping): void {
enterWith(this.formComponent.getNameInput(), aggregationMapping.name);
enterWith(this.formComponent.getFormEngineInput(), aggregationMapping.formIdentifier.formEngineName);
enterWith(this.formComponent.getFormIdInput(), aggregationMapping.formIdentifier.formId);
aggregationMapping.mappings.forEach((fieldMapping, index) => {
this.enterFieldMapping(fieldMapping, index);
});
}
private enterFieldMapping(fieldMapping: FieldMapping, index: number): void {
enterWith(this.formComponent.getSourceMappingFieldInput(index), fieldMapping.sourcePath);
enterWith(this.formComponent.getTargetMappingFieldInput(index), fieldMapping.targetPath);
}
}
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';
import { AggregationMapping } from '@admin-client/reporting-shared';
import { E2EAggregationMappingExecutor } from './aggregation-mapping.executor';
import { E2EAggregationMapperNavigator } from './aggregation-mapping.navigator';
export class E2EAggregationMappingHelper {
private component: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
private formComponent: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
private readonly navigator: E2EAggregationMapperNavigator = new E2EAggregationMapperNavigator();
private readonly executor: E2EAggregationMappingExecutor = new E2EAggregationMappingExecutor();
public enterName(text: string): void {
enterWith(this.formComponent.getNameInput(), text);
public openStatistik(): void {
this.navigator.openStatistik();
}
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);
public fillFormular(aggregationMapping: AggregationMapping): void {
this.executor.fillFormular(aggregationMapping);
}
}
import { AggregationMappingE2EComponent } from '../../components/aggregation-mapping/aggregation-mapping.e2e.component';
import { MainPage } from '../../page-objects/main.po';
import { exist } from '../../support/cypress.util';
import { E2EAppHelper } from '../app.helper';
export class E2EAggregationMapperNavigator {
private readonly appHelper: E2EAppHelper = new E2EAppHelper();
private readonly mainPage: MainPage = new MainPage();
private readonly aggregationMappingPage: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
public openStatistik(): void {
this.appHelper.navigateToDomain();
this.mainPage.getStatistikNavigationItem().click();
exist(this.aggregationMappingPage.getHeaderText());
}
}
import { AggregationMapping, FieldMapping } from '@admin-client/reporting-shared';
import { AggregationMappingFormE2EComponent } from '../../components/aggregation-mapping/aggregation-mapping-form.e2e.component';
import {
AggregationMappingE2EComponent,
AggregationMappingListItemE2EComponent,
} from '../../components/aggregation-mapping/aggregation-mapping.e2e.component';
import { haveText, haveValue } from '../../support/cypress.util';
export class E2EAggregationMappingVerifier {
private component: AggregationMappingE2EComponent = new AggregationMappingE2EComponent();
private formComponent: AggregationMappingFormE2EComponent = new AggregationMappingFormE2EComponent();
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 {
const listItem: AggregationMappingListItemE2EComponent = this.component.getListItem(aggregationMapping.name);
haveText(listItem.getName(), aggregationMapping.name);
haveText(listItem.getFormEngineName(), aggregationMapping.formIdentifier.formEngineName);
haveText(listItem.getFormId(), aggregationMapping.formIdentifier.formId);
}
}
import { MainPage } from '../page-objects/main.po';
export class E2EAppHelper {
private readonly mainPage: MainPage = new MainPage();
public navigateToDomain(): void {
this.mainPage.getHeader().getLogo().click();
}
}
......@@ -31,7 +31,7 @@ export class MainPage {
private readonly benutzerNavigationItem: string = 'link-path-benutzer';
private readonly organisationEinheitNavigationItem: string = 'link-path-organisationseinheiten';
private readonly postfachNavigationItem: string = 'link-path-postfach';
private readonly statistikNavigationItem: string = 'link-path-statistik';
private readonly statistikNavigationItem: string = 'link-path-aggregation-mapping';
public getBuildInfo(): BuildInfoE2EComponent {
return this.buildInfo;
......
......@@ -21,6 +21,7 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { HttpMethod } from '@alfa-client/tech-shared';
import { Interception, RouteHandler, RouteMatcher } from 'cypress/types/net-stubbing';
import { OrganisationsEinheitE2E } from './organisationseinheit';
......@@ -31,7 +32,7 @@ enum CypressTasks {
enum MongoCollections {
ORGANISATIONS_EINHEIT = 'organisationsEinheit',
SETTINGS = 'settings',
AGGREGATION_MAPPING = 'aggregationMapping',
}
const DOWNLOAD_FOLDER: string = 'cypress/downloads';
......@@ -48,7 +49,7 @@ export function intercept(method: string, url: string): Cypress.Chainable<null>
return cy.intercept(method, url);
}
export function interceptWithResponse(method, url: RouteMatcher, response: RouteHandler): Cypress.Chainable<null> {
export function interceptWithResponse(method: HttpMethod, url: RouteMatcher, response: RouteHandler): Cypress.Chainable<null> {
return cy.intercept(method, url, response);
}
......@@ -110,6 +111,5 @@ export function initOrganisationsEinheitenData(data: OrganisationsEinheitE2E[]):
}
export function dropCollections() {
cy.task(CypressTasks.DROP_COLLECTIONS, [MongoCollections.ORGANISATIONS_EINHEIT]);
cy.task(CypressTasks.DROP_COLLECTIONS, [MongoCollections.SETTINGS]);
cy.task(CypressTasks.DROP_COLLECTIONS, [MongoCollections.ORGANISATIONS_EINHEIT, MongoCollections.AGGREGATION_MAPPING]);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment