fix(nightly): refactor freeze-path feature test (#5557)

This commit is contained in:
Cristhian Zanforlin Lousa 2025-01-06 15:59:29 -03:00 committed by GitHub
commit 2ed0b10679
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 6 deletions

View file

@ -0,0 +1,25 @@
import { Page } from "playwright/test";
export const evaluateReactStateChanges = async (
page: Page,
selector: string,
value: string,
) => {
await page.evaluate(
({ selector, value }) => {
const inputElement = document.querySelector(selector) as HTMLInputElement;
if (inputElement) {
const prototype = Object.getPrototypeOf(inputElement);
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
prototype,
"value",
)?.set;
if (nativeInputValueSetter) {
nativeInputValueSetter.call(inputElement, value);
inputElement.dispatchEvent(new Event("input", { bubbles: true }));
}
}
},
{ selector, value },
);
};