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

OZG-7798 adjust data test ids

parent ef53460d
No related branches found
No related tags found
1 merge request!69Ozg 7798 statistik e2 e
Showing
with 29 additions and 39 deletions
import { enterWith } from '../../support/cypress.util';
export class StatistikFieldsFormE2EComponent {
private readonly formEngineInput: string = 'Formengine-text-input';
private readonly formIdInput: string = 'FormID-text-input';
private readonly formEngineInput: string = 'form-engine-name-text-input';
private readonly formIdInput: string = 'form-id-text-input';
private readonly formDataFieldInput: string = 'mapping-field-';
private readonly addDataFieldButton: string = 'add-mapping-button';
private readonly deleteDataFieldButton: string = 'remove-mapping-button-';
private readonly deleteDataFieldButtonPrefix: string = 'remove-mapping-';
private readonly saveButton: string = 'save-button';
private readonly cancelButton: string = 'cancel-button';
private readonly cancelButton: string = 'cancel-routing-button';
public getFormEngineInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.formEngineInput);
......@@ -43,7 +42,7 @@ export class StatistikFieldsFormE2EComponent {
}
public getDataFieldDeleteButton(index: number): Cypress.Chainable<Element> {
return cy.getTestElement(this.deleteDataFieldButton + index);
return cy.getTestElement(this.deleteDataFieldButtonPrefix + index + '-button');
}
public deleteDataField(index: number): void {
......
import { exist } from '../../support/cypress.util';
export class StatistikE2EComponent {
private readonly locatorHeaderText: string = 'statistik-header-text';
private readonly locatorWeitereFelderAuswertenButton = 'weitere-felder-auswerten-button';
private readonly locatorWeitereFelderAuswertenButton = 'weitere-felder-auswerten-routing-button';
public isHeaderTextVisible(): void {
exist(cy.getTestElement(this.locatorHeaderText));
public getHeaderText(): Cypress.Chainable<Element> {
return cy.getTestElement(this.locatorHeaderText);
}
public getWeitereFelderAuswertenButton(): Cypress.Chainable<Element> {
......
<ods-routing-button [linkPath]="linkPath" text="Abbrechen" variant="outline" dataTestId="cancel-button">
<ods-routing-button [linkPath]="linkPath" text="Abbrechen" variant="outline" dataTestId="cancel">
<ods-close-icon icon class="fill-primary" />
</ods-routing-button>
<ods-button-with-spinner
(clickEmitter)="submit()"
text="Speichern"
dataTestId="save-button"
[stateResource]="stateResource$ | async"
/>
<ods-button-with-spinner (clickEmitter)="submit()" text="Speichern" dataTestId="save" [stateResource]="stateResource$ | async" />
......@@ -28,7 +28,7 @@
<ods-routing-button
[linkPath]="ROUTES.STATISTIK_NEU"
text="Weitere Felder auswerten"
dataTestId="weitere-felder-auswerten-button"
dataTestId="weitere-felder-auswerten"
></ods-routing-button>
</div>
......
......@@ -23,12 +23,11 @@
*/
import { AggregationMappingListResource, AggregationMappingService } from '@admin-client/reporting-shared';
import { createStateResource, StateResource } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, mock, Mock } from '@alfa-client/test-utils';
import { mock, Mock } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RoutingButtonComponent } from '@ods/component';
import { singleCold } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { getDataTestIdAttributeOf } from '../../../../../tech-shared/test/data-test';
import { createAggregationMappingListResource } from '../../../../reporting-shared/test/aggregation-mapping';
import { StatistikContainerComponent } from './statistik-container.component';
......@@ -36,8 +35,6 @@ describe('StatistikContainerComponent', () => {
let component: StatistikContainerComponent;
let fixture: ComponentFixture<StatistikContainerComponent>;
const evaluateAdditionalFieldsTestId: string = getDataTestIdAttributeOf('weitere-felder-auswerten-button');
let aggregationMappingService: Mock<AggregationMappingService>;
beforeEach(async () => {
......@@ -68,16 +65,6 @@ describe('StatistikContainerComponent', () => {
expect(component).toBeTruthy();
});
describe('template', () => {
describe('weiter felder auswerten button', () => {
it('should exists', () => {
fixture.detectChanges();
existsAsHtmlElement(fixture, evaluateAdditionalFieldsTestId);
});
});
});
describe('on init', () => {
const stateResource: StateResource<AggregationMappingListResource> = createStateResource(
createAggregationMappingListResource(),
......
......@@ -8,17 +8,24 @@
label="Formengine"
placeholder="Tragen Sie hier die Formengine des Formulars ein."
data-test-id="form-engine-name"
dataTestId="form-engine-name"
></ods-text-editor>
<ods-text-editor
[formControlName]="StatistikFieldsFormService.FIELD_FORM_ID"
label="FormID"
placeholder="Tragen Sie hier die FormID des Formulars ein."
data-test-id="form-id"
dataTestId="form-id"
></ods-text-editor>
</div>
<statistik-fields-form-mapping />
</form>
<ods-button text="Datenfeld hinzufügen" dataTestId="add-mapping-button" (clickEmitter)="formService.addMapping()">
<ods-button
text="Datenfeld hinzufügen"
dataTestId="add-mapping"
data-test-id="add-mapping"
(clickEmitter)="formService.addMapping()"
>
<ods-plus-icon icon class="fill-whitetext" />
</ods-button>
......
......@@ -6,7 +6,7 @@ import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule } from '@angul
import { TextEditorComponent } from '@ods/component';
import { ButtonComponent, PlusIconComponent } from '@ods/system';
import { MockComponent } from 'ng-mocks';
import { getDataTestIdAttributeOf, getDataTestIdOf } from '../../../../../tech-shared/test/data-test';
import { getDataTestIdOf } from '../../../../../tech-shared/test/data-test';
import { AdminCancelButtonComponent } from '../../../../shared/src/lib/admin-cancel-button/admin-cancel-button.component';
import { AdminSaveButtonComponent } from '../../../../shared/src/lib/admin-save-button/admin-save-button.component';
import { AdminStatistikFieldsFormComponent } from './admin-statistik-fields-form.component';
......@@ -19,7 +19,7 @@ describe('AdminStatistikFieldsFormComponent', () => {
const formEngineNameInputTestId: string = getDataTestIdOf('form-engine-name');
const formIdInputTestId: string = getDataTestIdOf('form-id');
const addMappingButton: string = getDataTestIdAttributeOf('add-mapping-button');
const addMappingButton: string = getDataTestIdOf('add-mapping');
const formBuilder: FormBuilder = new FormBuilder();
......
......@@ -19,7 +19,7 @@
size="fit"
destructive="true"
(clickEmitter)="formService.removeMapping(i)"
[dataTestId]="'remove-mapping-button-' + i"
[dataTestId]="'remove-mapping-' + i"
[attr.data-test-id]="'remove-mapping-button-' + i"
>
<ods-delete-icon icon />
......
......@@ -8,7 +8,11 @@ import { ButtonVariants, buttonVariants } from '@ods/system';
standalone: true,
imports: [CommonModule, RouterLink],
host: { class: 'block' },
template: `<a [routerLink]="'/' + linkPath" [attr.data-test-id]="dataTestId" [ngClass]="buttonVariants({ size, variant })">
template: `<a
[routerLink]="'/' + linkPath"
[attr.data-test-id]="dataTestId + '-routing-button'"
[ngClass]="buttonVariants({ size, variant })"
>
<ng-content select="[icon]" />
@if (text) {
<p class="flex-grow">{{ text }}</p>
......
......@@ -95,7 +95,7 @@ export type ButtonVariants = VariantProps<typeof buttonVariants>;
[disabled]="isDisabled"
[attr.aria-disabled]="isDisabled"
[attr.aria-label]="text"
[attr.data-test-id]="dataTestId"
[attr.data-test-id]="dataTestId + '-button'"
(click)="clickEmitter.emit()"
>
<ng-content *ngIf="!isLoading" select="[icon]"></ng-content>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment