@@ -2,7 +2,6 @@ import {Page} from "playwright";
22import { expect } from "@playwright/test" ;
33import { Path , PathElement } from "../src/utility/path" ;
44import { pathToString } from "../src/utility/pathUtils" ;
5- import { selectAll } from "./utils" ;
65
76
87export async function checkPropertyExistence ( page : Page , propertyPath : Path , shouldBeVisible : boolean ) {
@@ -40,21 +39,24 @@ export async function editNumberOrIntProperty(page: Page, propertyPath: Path, va
4039 const pathAsString = pathToString ( propertyPath ) ;
4140 const spinButton = page . getByTestId ( `property-data-${ pathAsString } ` ) . getByRole ( 'spinbutton' )
4241 await spinButton . click ( ) ;
43- await selectAll ( page ) ;
44- await spinButton . press ( 'Backspace' ) ;
45-
46- // Simulate real typing
47- for ( const char of value . toString ( ) ) {
48- await page . keyboard . press ( char ) ;
49- }
50-
51- await spinButton . press ( 'Enter' ) ;
42+ await spinButton . evaluate ( ( input , newValue ) => {
43+ const nativeValueSetter = Object . getOwnPropertyDescriptor (
44+ window . HTMLInputElement . prototype ,
45+ 'value'
46+ ) ?. set ;
47+ nativeValueSetter ?. call ( input , String ( newValue ) ) ;
48+ input . dispatchEvent ( new Event ( 'input' , { bubbles : true } ) ) ;
49+ input . setAttribute ( 'aria-valuenow' , String ( newValue ) ) ;
50+ } , value ) ;
51+ await spinButton . blur ( ) ;
5252}
5353
5454export async function checkNumberOrIntProperty ( page : Page , propertyPath : Path , value : number ) {
5555 const pathAsString = pathToString ( propertyPath ) ;
5656 const textField = page . getByTestId ( `property-data-${ pathAsString } ` ) . getByRole ( 'spinbutton' )
57- await expect ( textField ) . toHaveValue ( value . toString ( ) ) ;
57+ await expect
58+ . poll ( async ( ) => await textField . getAttribute ( 'aria-valuenow' ) )
59+ . toBe ( value . toString ( ) ) ;
5860}
5961
6062export async function removeOptionalPropertyValue ( page : Page , propertyPath : Path ) {
@@ -77,9 +79,11 @@ export async function addArrayItem(page: Page, propertyPath: Path) {
7779
7880export async function checkPropertySchemaViolation ( page : Page , propertyPath : Path , shouldBeVisible : boolean ) {
7981 const pathAsString = pathToString ( propertyPath ) ;
80- const validationErrorIcon = page . getByTestId ( `property-metadata-${ pathAsString } ` ) . getByTestId ( "validation-error-icon" ) ;
82+ const propertyMetadata = page . getByTestId ( `property-metadata-${ pathAsString } ` ) ;
83+ const validationErrorIcon = propertyMetadata . getByTestId ( "validation-error-icon" ) ;
8184 if ( shouldBeVisible ) {
82- await expect ( validationErrorIcon ) . toBeVisible ( ) ;
85+ await expect ( propertyMetadata ) . toBeVisible ( ) ;
86+ await expect ( validationErrorIcon ) . toBeVisible ( { timeout : 8000 } ) ;
8387 } else {
8488 await expect ( validationErrorIcon ) . not . toBeVisible ( ) ;
8589 }
@@ -101,4 +105,4 @@ export async function expandOrCollapseProperty(page: Page, propertyPathElement:
101105 // do check if the name starts with the propertyName, but ignore the other part of the name, as it can differ always depending on the children count
102106 const expansionButton = page . getByRole ( 'cell' , { name : new RegExp ( `^${ propertyPathElement } :` ) } ) . getByRole ( 'button' ) ;
103107 await expansionButton . click ( ) ;
104- }
108+ }
0 commit comments