Refactor API generation tests

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-28 20:16:16 -03:00
commit 76dbaf3b21
5 changed files with 104 additions and 84 deletions

View file

@ -1,17 +1,17 @@
import { test, expect } from '@playwright/test';
import { expect, test } from "@playwright/test";
test('python_api_generation', async ({ page,context }) => {
test("python_api_generation", async ({ page, context }) => {
await page.goto("/");
await page.locator('//*[@id="new-project-btn"]').click();
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
await page.getByRole('heading', { name: 'Data Ingestion' }).click();
await page.getByRole("heading", { name: "Data Ingestion" }).click();
await page.waitForTimeout(2000);
await page.getByText('API', { exact: true }).click();
await page.getByRole('tab', { name: 'Python API' }).click();
await page.getByRole('button', { name: 'Copy Code' }).click();
const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
await page.getByText("API", { exact: true }).click();
await page.getByRole("tab", { name: "Python API" }).click();
await page.getByRole("button", { name: "Copy Code" }).click();
const handle = await page.evaluateHandle(() =>
navigator.clipboard.readText()
);
const clipboardContent = await handle.jsonValue();
expect(clipboardContent.length).toBeGreaterThan(0);
});
});