test: Update regression test to use data-testid for input fields (#8762)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-06-27 10:08:50 -03:00 committed by GitHub
commit 03537b5dcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,42 +55,39 @@ test(
timeout: 3000,
});
// Wait for the modal inputs to be visible
await page.waitForSelector(
'[data-testid="popover-anchor-input-base_url-edit"]',
{
timeout: 5000,
state: "visible",
},
);
// Fill the first input (base_url field)
await page
.getByPlaceholder("Type something...")
.first()
.getByTestId("popover-anchor-input-base_url-edit")
.fill("ollama_test_ctrl_a_first_input");
let value = await page
.getByPlaceholder("Type something...")
.first()
.getByTestId("popover-anchor-input-base_url-edit")
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_first_input");
await page
.getByPlaceholder("Type something...")
.last()
.fill("ollama_test_ctrl_a_second_input");
let secondValue = await page
.getByPlaceholder("Type something...")
.last()
.inputValue();
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
await page.getByPlaceholder("Type something...").last().click();
await page.keyboard.press("ControlOrMeta+a");
await page.keyboard.press("ControlOrMeta+c");
await page.getByPlaceholder("Type something...").first().click();
await page.keyboard.press("ControlOrMeta+a");
await page.keyboard.press("Backspace");
value = await page
.getByTestId("popover-anchor-input-base_url-edit")
.inputValue();
expect(value).toBe("");
await page.keyboard.press("ControlOrMeta+v");
value = await page
.getByPlaceholder("Type something...")
.first()
.getByTestId("popover-anchor-input-base_url-edit")
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_second_input");
expect(value).toBe("ollama_test_ctrl_a_first_input");
},
);