| import { expect, test } from "@playwright/test"; |
|
|
| test( |
| "curl_api_generation", |
| { tag: ["@release", "@api", "@workspace"] }, |
| async ({ page, context }) => { |
| await page.goto("/"); |
| let modalCount = 0; |
| try { |
| const modalTitleElement = await page?.getByTestId("modal-title"); |
| if (modalTitleElement) { |
| modalCount = await modalTitleElement.count(); |
| } |
| } catch (error) { |
| modalCount = 0; |
| } |
|
|
| while (modalCount === 0) { |
| await page.getByText("New Flow", { exact: true }).click(); |
| await page.waitForSelector('[data-testid="modal-title"]', { |
| timeout: 3000, |
| }); |
| modalCount = await page.getByTestId("modal-title")?.count(); |
| } |
| await page.getByTestId("side_nav_options_all-templates").click(); |
| await page.getByRole("heading", { name: "Basic Prompting" }).click(); |
| await page.getByText("API", { exact: true }).click(); |
| await page.getByRole("tab", { name: "cURL" }).click(); |
| await page.getByTestId("icon-Copy").last().click(); |
| const handle = await page.evaluateHandle(() => |
| navigator.clipboard.readText(), |
| ); |
| const clipboardContent = await handle.jsonValue(); |
| expect(clipboardContent.length).toBeGreaterThan(0); |
| }, |
| ); |
|
|