feat: add tool_mode parameter to MessageTextInput in ID Generator Component (#5311)
* feat: add tool_mode parameter to MessageTextInput for enhanced functionality * fix: update tool mode test to ensure correct functionality and response handling - Adjusted test to wait for the "Toolset" element to appear before asserting its count. - Modified code handling to replace "tool_mode=True" with "tool_mode=False" and verified the updated code is different. - Added response check for the custom component to ensure a successful status (200) after submission. --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
214829ab45
commit
e79b1649a5
2 changed files with 17 additions and 14 deletions
|
|
@ -21,6 +21,7 @@ class IDGeneratorComponent(Component):
|
|||
display_name="Value",
|
||||
info="The generated unique ID.",
|
||||
refresh_button=True,
|
||||
tool_mode=True,
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,12 @@ test(
|
|||
await page.getByTestId("title-ID Generator").click();
|
||||
await page.keyboard.press("ControlOrMeta+Shift+m");
|
||||
|
||||
expect(await page.getByText("Toolset", { exact: true }).count()).toBe(0);
|
||||
await page.waitForSelector('text="Toolset"', {
|
||||
timeout: 3000,
|
||||
});
|
||||
expect(
|
||||
await page.getByText("Toolset", { exact: true }).count(),
|
||||
).toBeGreaterThan(0);
|
||||
|
||||
await page.getByTestId("title-ID Generator").click();
|
||||
|
||||
|
|
@ -43,29 +48,26 @@ test(
|
|||
await page.getByTestId("code-button-modal").click();
|
||||
|
||||
let code = await extractAndCleanCode(page);
|
||||
code = code!.replace(
|
||||
"refresh_button=True,",
|
||||
"refresh_button=True,\n tool_mode=True,",
|
||||
);
|
||||
let updatedCode = code!.replace("tool_mode=True", "tool_mode=False");
|
||||
|
||||
expect(updatedCode).not.toBe(code);
|
||||
|
||||
await page.locator("textarea").last().press(`ControlOrMeta+a`);
|
||||
await page.keyboard.press("Backspace");
|
||||
await page.locator("textarea").last().fill(code);
|
||||
await page.locator("textarea").last().fill(updatedCode);
|
||||
const customComponentPromise = page.waitForResponse("**/custom_component");
|
||||
await page.locator('//*[@id="checkAndSaveBtn"]').click();
|
||||
const customComponentResponse = await customComponentPromise;
|
||||
// check if the response is 200
|
||||
expect(customComponentResponse?.status()).toBe(200);
|
||||
|
||||
await page.waitForSelector('[data-testid="fit_view"]', {
|
||||
await page.waitForSelector('[data-testid="title-ID Generator"]', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
await page.getByTestId("title-ID Generator").click();
|
||||
await page.keyboard.press("ControlOrMeta+Shift+m");
|
||||
|
||||
await page.waitForSelector('text="Toolset"', {
|
||||
timeout: 3000,
|
||||
});
|
||||
|
||||
expect(
|
||||
await page.getByText("Toolset", { exact: true }).count(),
|
||||
).toBeGreaterThan(0);
|
||||
expect(await page.getByText("Toolset", { exact: true }).count()).toBe(0);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue