From f80af6bd036ec12026d8bfc177d1cc64455d5396 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 28 Mar 2024 17:24:36 -0300 Subject: [PATCH] Add end-to-end test for tweaks functionality --- .../tests/end-to-end/tweaks_test.spec.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/frontend/tests/end-to-end/tweaks_test.spec.ts diff --git a/src/frontend/tests/end-to-end/tweaks_test.spec.ts b/src/frontend/tests/end-to-end/tweaks_test.spec.ts new file mode 100644 index 000000000..63dbebcab --- /dev/null +++ b/src/frontend/tests/end-to-end/tweaks_test.spec.ts @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; + +test('curl_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.waitForTimeout(2000); + await page.getByText('API', { exact: true }).click(); + await page.getByRole('tab', { name: 'cURL' }).click(); + await page.getByRole('button', { name: 'Copy Code' }).click(); + const handle = await page.evaluateHandle(() => navigator.clipboard.readText()); + const clipboardContent = await handle.jsonValue(); + const oldValue = clipboardContent; + expect(clipboardContent.length).toBeGreaterThan(0); + await page.getByRole('tab', { name: 'Tweaks' }).click(); + await page.getByRole('heading', { name: 'URL' }).locator('div').first().click(); + await page.getByRole('textbox', { name: 'Type something...' }).click(); + await page.getByRole('textbox', { name: 'Type something...' }).press('Control+a'); + await page.getByRole('textbox', { name: 'Type something...' }).fill('teste'); + await page.getByRole('tab', { name: 'cURL' }).click(); + await page.getByRole('button', { name: 'Copy Code' }).click(); + const handle2 = await page.evaluateHandle(() => navigator.clipboard.readText()); + const clipboardContent2 = await handle2.jsonValue(); + const newValue = clipboardContent2; + expect(oldValue).not.toBe(newValue); + expect(clipboardContent2.length).toBeGreaterThan(clipboardContent.length); +}); \ No newline at end of file