fix: make component test pass if component tab is not present (#7865)

This commit is contained in:
Lucas Oliveira 2025-04-30 15:39:58 -03:00 committed by GitHub
commit 37fbbe0ebf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,63 +77,64 @@ test("search flows", { tag: ["@release"] }, async ({ page }) => {
test("search components", { tag: ["@release"] }, async ({ page }) => {
await awaitBootstrapTest(page);
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
if (await page.getByTestId("components-btn").isVisible()) {
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByText("Chat Input").first().click();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.getByTestId("more-options-modal").click();
await page.getByText("Chat Input").first().click();
await page.waitForSelector('[data-testid="more-options-modal"]', {
timeout: 1000,
});
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page
.getByText("Prompt", {
exact: true,
})
.first()
.click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page
.getByText("Prompt", {
exact: true,
})
.first()
.click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page
.getByText("OpenAI", {
exact: true,
})
.first()
.click();
await page.getByTestId("more-options-modal").click();
await page
.getByText("OpenAI", {
exact: true,
})
.first()
.click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page.getByTestId("icon-SaveAll").first().click();
await page.keyboard.press("Escape");
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.waitForSelector('[data-testid="icon-ChevronLeft"]', {
timeout: 100000,
});
await page.getByTestId("icon-ChevronLeft").first().click();
await page.getByTestId("icon-ChevronLeft").first().click();
const exitButton = await page.getByText("Exit", { exact: true }).count();
const exitButton = await page.getByText("Exit", { exact: true }).count();
if (exitButton > 0) {
await page.getByText("Exit", { exact: true }).click();
if (exitButton > 0) {
await page.getByText("Exit", { exact: true }).click();
}
await page.getByTestId("components-btn").click();
await page.getByPlaceholder("Search components").fill("Chat Input");
await page.getByText("Chat Input", { exact: true }).isVisible();
await page.getByText("Prompt", { exact: true }).isHidden();
await page.getByText("OpenAI", { exact: true }).isHidden();
}
await page.getByTestId("components-btn").click();
await page.getByPlaceholder("Search components").fill("Chat Input");
await page.getByText("Chat Input", { exact: true }).isVisible();
await page.getByText("Prompt", { exact: true }).isHidden();
await page.getByText("OpenAI", { exact: true }).isHidden();
});