fix(nightly): refactor freeze-path feature test (#5557)
This commit is contained in:
parent
89756390e8
commit
2ed0b10679
3 changed files with 47 additions and 6 deletions
|
|
@ -216,6 +216,7 @@ export default function SliderComponent({
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
className="relative bottom-[1px] w-full cursor-text rounded-sm bg-transparent text-center font-mono text-[0.88rem] arrow-hide"
|
className="relative bottom-[1px] w-full cursor-text rounded-sm bg-transparent text-center font-mono text-[0.88rem] arrow-hide"
|
||||||
autoFocus
|
autoFocus
|
||||||
|
data-testid="slider_input"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { expect, test } from "@playwright/test";
|
||||||
import * as dotenv from "dotenv";
|
import * as dotenv from "dotenv";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||||
|
import { evaluateReactStateChanges } from "../../utils/evaluate-input-react-state-changes";
|
||||||
import { initialGPTsetup } from "../../utils/initialGPTsetup";
|
import { initialGPTsetup } from "../../utils/initialGPTsetup";
|
||||||
|
|
||||||
test(
|
test(
|
||||||
|
|
@ -35,11 +36,22 @@ test(
|
||||||
await page.getByTestId("dropdown_str_model_name").click();
|
await page.getByTestId("dropdown_str_model_name").click();
|
||||||
await page.getByTestId("gpt-4o-1-option").click();
|
await page.getByTestId("gpt-4o-1-option").click();
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="float_float_temperature"]', {
|
await page.waitForSelector('[data-testid="default_slider_display_value"]', {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.getByTestId("float_float_temperature").fill("1.0");
|
await page.getByTestId("fit_view").click();
|
||||||
|
await page
|
||||||
|
.getByTestId("default_slider_display_value")
|
||||||
|
.click({ force: true });
|
||||||
|
|
||||||
|
await evaluateReactStateChanges(
|
||||||
|
page,
|
||||||
|
'[data-testid="slider_input"]',
|
||||||
|
"1.0",
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.keyboard.press("Enter");
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
|
|
@ -62,12 +74,15 @@ test(
|
||||||
|
|
||||||
await page.getByText("Close").first().click();
|
await page.getByText("Close").first().click();
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="float_float_temperature"]', {
|
await page.waitForSelector('[data-testid="default_slider_display_value"]', {
|
||||||
timeout: 3000,
|
timeout: 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.getByTestId("float_float_temperature").fill("");
|
await evaluateReactStateChanges(
|
||||||
await page.getByTestId("float_float_temperature").fill("1.2");
|
page,
|
||||||
|
'[data-testid="slider_input"]',
|
||||||
|
"1.2",
|
||||||
|
);
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
|
|
|
||||||
|
|
@ -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 },
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue