All files / runtime/_services form-page-object.ts

100% Statements 33/33
100% Branches 7/7
100% Functions 7/7
100% Lines 33/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 341x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 1x 1x 5x 5x 2x 2x 5x 5x 2x 2x 5x 5x 1x 1x 5x 5x 1x 1x 5x  
import type { Locator, Page } from '@playwright/test';
import { DyE2E_TestId_Util } from '../../contracts/_collections/utils/test-id.util';
import { DyE2E_FieldPageObject } from './field-page-object';
 
/**
 * Page-object a teljes Forms v2 form-hoz. Field-eket névvel scope-ol.
 */
export class DyE2E_FormPageObject {
  constructor(
    private readonly page: Page,
    private readonly formKey: string,
  ) {}
 
  field(fieldKey: string, explicitTestId?: string): DyE2E_FieldPageObject {
    return new DyE2E_FieldPageObject(this.page, this.formKey, fieldKey, explicitTestId);
  }
 
  get submitButton(): Locator {
    return this.page.getByTestId(DyE2E_TestId_Util.formSubmit(this.formKey));
  }
 
  get cancelButton(): Locator {
    return this.page.getByTestId(DyE2E_TestId_Util.formCancel(this.formKey));
  }
 
  async submit(): Promise<void> {
    await this.submitButton.click();
  }
 
  async cancel(): Promise<void> {
    await this.cancelButton.click();
  }
}