test: Add utility functions to streamline test setup and improve maintainability (#5168)

* change tests to use utils libs

* 🔧 (frontend): add data-testid attribute to buttons in baseModal and secretKeyModal components
🔧 (frontend): add data-testid attribute to buttons in various test files for improved testing
🔧 (frontend): refactor awaitBootstrapTest function to remove skipNewFlow option and improve modal handling

* ✅ (userSettings.spec.ts): add a 1-second timeout before checking for the "Please save" text to ensure it is rendered on the page before interacting with it

* ✅ (userSettings.spec.ts): add comment to clarify waiting for API key creation to complete before proceeding to the next form element

* ✨ (freeze-path.spec.ts): refactor adjustScreenView function to accept a parameter for the number of zoom outs to perform, improving flexibility and reusability in test scenarios.
🔧 (freeze-path.spec.ts): replace adjustScreenView function with initialGPTsetup function for setting up initial GPT configuration in the test scenario.
This commit is contained in:
Cristhian Zanforlin Lousa 2024-12-09 17:30:56 -03:00 • committed by GitHub
commit ab68e13493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
94 changed files with 344 additions and 3058 deletions

View file

@ -336,7 +336,7 @@ export const MenuBar = ({}: {}): JSX.Element => {
</div> </div>
</div> </div>
<button <button
data-testid="stop_building_button " data-testid="stop_building_button"
disabled={!isBuilding} disabled={!isBuilding}
onClick={(_) => { onClick={(_) => {
if (isBuilding) { if (isBuilding) {

View file

@ -113,7 +113,11 @@ const Footer: React.FC<{
{children ?? <div />} {children ?? <div />}
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<DialogClose asChild> <DialogClose asChild>
<Button variant="outline" type="button"> <Button
variant="outline"
type="button"
data-testid="btn-cancel-modal"
>
Cancel Cancel
</Button> </Button>
</DialogClose> </DialogClose>
@ -134,7 +138,9 @@ const Footer: React.FC<{
)} )}
{close && ( {close && (
<DialogClose asChild> <DialogClose asChild>
<Button type="button">Close</Button> <Button data-testid="btn-close-modal" type="button">
Close
</Button>
</DialogClose> </DialogClose>
)} )}
</div> </div>

View file

@ -112,6 +112,7 @@ export default function SecretKeyModal({
onClick={() => { onClick={() => {
handleCopyClick(); handleCopyClick();
}} }}
data-testid="btn-copy-api-key"
unstyled unstyled
> >
{textCopied ? ( {textCopied ? (

View file

@ -1,35 +1,12 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"select and delete a flow", "select and delete a flow",
{ tag: ["@release", "@api"] }, { tag: ["@release", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -61,32 +38,8 @@ test(
); );
test("search flows", { tag: ["@release"] }, async ({ page }) => { test("search flows", { tag: ["@release"] }, async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -122,32 +75,8 @@ test("search flows", { tag: ["@release"] }, async ({ page }) => {
}); });
test("search components", { tag: ["@release"] }, async ({ page }) => { test("search components", { tag: ["@release"] }, async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"when auto_login is false, admin can CRUD user's and should see just your own flows", "when auto_login is false, admin can CRUD user's and should see just your own flows",
@ -115,23 +116,7 @@ test(
timeout: 30000, timeout: 30000,
}); });
let modalCount = 0; await awaitBootstrapTest(page, { skipGoto: true });
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: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -204,19 +189,7 @@ test(
).isVisible(), ).isVisible(),
); );
while (modalCount === 0) { await awaitBootstrapTest(page, { skipGoto: true });
await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 30000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
await page.getByText("New Flow", { exact: true }).click();
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -2,6 +2,8 @@ import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user must be able to send an image on chat", "user must be able to send an image on chat",
@ -16,25 +18,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -42,38 +26,7 @@ test(
timeout: 100000, timeout: 100000,
}); });
await page.getByTestId("fit_view").click(); await initialGPTsetup(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForSelector('[data-testid="icon-AlertTriangle"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector("text=Chat Input", { timeout: 30000 }); await page.waitForSelector("text=Chat Input", { timeout: 30000 });

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user can add components by hovering and clicking the plus icon", "user can add components by hovering and clicking the plus icon",
@ -6,28 +7,7 @@ test(
async ({ page }) => { async ({ page }) => {
// Navigate to homepage and handle initial modal // Navigate to homepage and handle initial modal
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
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();
}
// Start with blank flow // Start with blank flow
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,27 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must see on handle hover a tooltip with possibility connections", "user must see on handle hover a tooltip with possibility connections",
{ tag: ["@release", "@components", "@api"] }, { tag: ["@release", "@components", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForTimeout(1000);
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
@ -41,10 +26,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const outputElements = await page const outputElements = await page
.getByTestId("handle-retrievalqa-shownode-text-right") .getByTestId("handle-retrievalqa-shownode-text-right")
@ -76,10 +58,7 @@ test(
).toBeVisible(); ).toBeVisible();
}); });
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements1 = await page const rqaChainInputElements1 = await page
.getByTestId("handle-retrievalqa-shownode-language model-left") .getByTestId("handle-retrievalqa-shownode-language model-left")
@ -109,10 +88,7 @@ test(
page.getByTestId("input-tooltip-languagemodel").first(), page.getByTestId("input-tooltip-languagemodel").first(),
).toBeVisible(); ).toBeVisible();
}); });
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements0 = await page const rqaChainInputElements0 = await page
.getByTestId("handle-retrievalqa-shownode-retriever-left") .getByTestId("handle-retrievalqa-shownode-retriever-left")
@ -143,10 +119,7 @@ test(
).toBeVisible(); ).toBeVisible();
}); });
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const rqaChainInputElements2 = await page const rqaChainInputElements2 = await page
.getByTestId("handle-retrievalqa-shownode-memory-left") .getByTestId("handle-retrievalqa-shownode-memory-left")

View file

@ -1,36 +1,14 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must see on handle click the possibility connections", "user must see on handle click the possibility connections",
{ tag: ["@release", "@components", "@api"] }, { tag: ["@release", "@components", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 3000, timeout: 3000,
}); });
@ -51,10 +29,8 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.waitForSelector( await page.waitForSelector(
'[data-testid="handle-apirequest-shownode-urls-left"]', '[data-testid="handle-apirequest-shownode-urls-left"]',
{ {

View file

@ -1,37 +1,14 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"CRUD folders", "CRUD folders",
{ tag: ["@release", "@api"] }, { tag: ["@release", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -147,32 +124,8 @@ test("add a flow into a folder by drag and drop", async ({ page }) => {
}); });
test("change flow folder", async ({ page }) => { test("change flow folder", async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user must be able to freeze a path", "user must be able to freeze a path",
@ -16,68 +18,12 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
//remove all saved api keys
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page await page
.getByTestId("textarea_str_input_value") .getByTestId("textarea_str_input_value")

View file

@ -1,36 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to freeze a component", "user must be able to freeze a component",
{ tag: ["@release", "@workspace", "@components"] }, { tag: ["@release", "@workspace", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -250,8 +226,7 @@ test(
.getByPlaceholder("Empty") .getByPlaceholder("Empty")
.textContent(); .textContent();
await page.getByText("Close").last().click(); await page.getByTestId("btn-close-modal").click();
await page.getByText("Close").last().click();
await page.getByTestId("textarea_str_input_value").first().fill(","); await page.getByTestId("textarea_str_input_value").first().fill(",");

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to save or delete a global variable", "user must be able to save or delete a global variable",
{ tag: ["@release", "@workspace", "@api"] }, { tag: ["@release", "@workspace", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -47,14 +25,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const genericName = Math.random().toString(); const genericName = Math.random().toString();
const credentialName = Math.random().toString(); const credentialName = Math.random().toString();

View file

@ -1,4 +1,5 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.describe("group node test", () => { test.describe("group node test", () => {
/// <reference lib="dom"/> /// <reference lib="dom"/>
@ -6,22 +7,7 @@ test.describe("group node test", () => {
"group and ungroup updating values", "group and ungroup updating values",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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();
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page await page

View file

@ -1,32 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user can search and add components using keyboard shortcuts", "user can search and add components using keyboard shortcuts",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
// Navigate to homepage and handle initial modal // Navigate to homepage and handle initial modal
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
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();
}
// Start with blank flow // Start with blank flow
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should able to see and interact with logs", "should able to see and interact with logs",
@ -16,32 +17,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"fresh start playground", "fresh start playground",
@ -10,31 +12,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
@ -52,10 +30,8 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
@ -85,10 +61,8 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();

View file

@ -1,5 +1,6 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.describe("save component tests", () => { test.describe("save component tests", () => {
/// <reference lib="dom"/> /// <reference lib="dom"/>
@ -8,24 +9,8 @@ test.describe("save component tests", () => {
{ tag: ["@release", "@workspace", "@api"] }, { tag: ["@release", "@workspace", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });

View file

@ -1,41 +1,18 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
// TODO: fix this test // TODO: fix this test
test( test(
"user must be able to stop a building", "user must be able to stop a building",
{ tag: ["@release", "@workspace", "@api"] }, { tag: ["@release", "@workspace", "@api"] },
async ({ page }) => { async ({ page }) => {
test.skip(true, "Test is flaky"); await awaitBootstrapTest(page);
await page.goto("/");
// await page.waitForTimeout(2000);
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();
//first component //first component
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text input"); await page.getByTestId("sidebar-search-input").fill("text input");
// await page.waitForTimeout(1000);
await page await page
.getByTestId("inputsText Input") .getByTestId("inputsText Input")
@ -56,7 +33,6 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("url"); await page.getByTestId("sidebar-search-input").fill("url");
// await page.waitForTimeout(1000);
await page await page
.getByTestId("dataURL") .getByTestId("dataURL")
@ -77,7 +53,6 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("split text"); await page.getByTestId("sidebar-search-input").fill("split text");
// await page.waitForTimeout(1000);
await page await page
.getByTestId("processingSplit Text") .getByTestId("processingSplit Text")
@ -98,7 +73,6 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data"); await page.getByTestId("sidebar-search-input").fill("parse data");
// await page.waitForTimeout(1000);
await page await page
.getByTestId("processingParse Data") .getByTestId("processingParse Data")
@ -119,7 +93,6 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output"); await page.getByTestId("sidebar-search-input").fill("chat output");
// await page.waitForTimeout(1000);
await page await page
.getByTestId("outputsChat Output") .getByTestId("outputsChat Output")
@ -142,7 +115,6 @@ test(
while (outdatedComponents > 0) { while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click(); await page.getByTestId("icon-AlertTriangle").first().click();
// await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count(); outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
} }
@ -251,9 +223,15 @@ class CustomComponent(Component):
await page.getByTestId("title-Custom Component").first().click(); await page.getByTestId("title-Custom Component").first().click();
await page.waitForTimeout(500); await page.waitForSelector('[data-testid="code-button-modal"]', {
timeout: 3000,
});
await page.getByTestId("code-button-modal").click(); await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);
await page.waitForSelector('[id="checkAndSaveBtn"]', {
timeout: 3000,
});
await page.locator("textarea").last().press(`ControlOrMeta+a`); await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace"); await page.keyboard.press("Backspace");
@ -263,53 +241,17 @@ class CustomComponent(Component):
await page.getByTestId("button_run_custom component").click(); await page.getByTestId("button_run_custom component").click();
await page.waitForSelector("text=Building", { await page.waitForSelector("text=running", {
timeout: 100000, timeout: 100000,
}); });
await page.waitForSelector('div[class*="animate-border-beam"]', { await page.waitForSelector('[data-testid="stop_building_button"]', {
state: "visible",
timeout: 5000,
});
await page.waitForTimeout(1000);
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "hidden",
timeout: 5000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000, timeout: 100000,
}); });
await page.getByTestId("button_run_custom component").click(); await page.getByTestId("stop_building_button").last().click();
await page.waitForSelector("text=Building", { await page.waitForSelector("text=build stopped", {
timeout: 100000,
});
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector("text=Building", {
timeout: 100000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000,
});
await page.getByTestId("button_run_custom component").click();
await page.waitForSelector('div[class*="animate-border-beam"]', {
state: "visible",
timeout: 5000,
});
await page.waitForSelector("text=Saved", {
timeout: 100000, timeout: 100000,
}); });
}, },

View file

@ -1,6 +1,7 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should filter by tag", "should filter by tag",
@ -99,21 +100,10 @@ test("should share component with share button", async ({ page }) => {
await page.getByTestId("icon-ChevronLeft").first().click(); await page.getByTestId("icon-ChevronLeft").first().click();
let modalCount = 0; await awaitBootstrapTest(page, {
try { skipGoto: true,
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
const randomName = Math.random().toString(36).substring(2); const randomName = Math.random().toString(36).substring(2);

View file

@ -1,28 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"curl_api_generation", "curl_api_generation",
{ tag: ["@release", "@workspace", "@api"] }, { tag: ["@release", "@workspace", "@api"] },
async ({ page, context }) => { async ({ page, context }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
@ -69,32 +53,7 @@ test(
test("check if tweaks are updating when someothing on the flow changes", async ({ test("check if tweaks are updating when someothing on the flow changes", async ({
page, page,
}) => { }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"Basic Prompting (Hello, World)", "Basic Prompting (Hello, World)",
@ -15,69 +17,12 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("button_run_chat output").click(); await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 }); await page.waitForSelector("text=built successfully", { timeout: 30000 });

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"Blog Writer", "Blog Writer",
@ -15,68 +17,12 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Blog Writer" }).click(); await page.getByRole("heading", { name: "Blog Writer" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 5000,
});
await page.getByTestId("fit_view").click(); await initialGPTsetup(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page await page
.getByTestId("inputlist_str_urls_0") .getByTestId("inputlist_str_urls_0")

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"Document Q&A", "Document Q&A",
@ -15,68 +17,11 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Document Q&A" }).click(); await page.getByRole("heading", { name: "Document Q&A" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 3000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
const fileChooserPromise = page.waitForEvent("filechooser"); const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click(); await page.getByTestId("button_upload_file").click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test.skip( test.skip(
"Dynamic Agent", "Dynamic Agent",
@ -17,69 +19,17 @@ test.skip(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Dynamic Agent" }).last().click(); await page.getByRole("heading", { name: "Dynamic Agent" }).last().click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page await page
.getByTestId("popover-anchor-input-api_key") .getByTestId("popover-anchor-input-api_key")
.last() .last()
.fill(process.env.SEARCH_API_KEY ?? ""); .fill(process.env.SEARCH_API_KEY ?? "");
await page.waitForTimeout(1000);
let openAiLlms = await page.getByText("OpenAI", { exact: true }).count();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
for (let i = 0; i < openAiLlms; i++) {
await page
.getByTestId("popover-anchor-input-api_key")
.nth(i)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("zoom_in").click();
await page.getByTestId("dropdown_str_model_name").nth(i).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.waitForTimeout(1000);
}
await page await page
.getByTestId("textarea_str_input_value") .getByTestId("textarea_str_input_value")
.first() .first()

View file

@ -1,7 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test.skip( test.skip(
"Hierarchical Tasks Agent", "Hierarchical Tasks Agent",
@ -21,81 +22,14 @@ test.skip(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page await page
.getByRole("heading", { name: "Hierarchical Tasks Agent" }) .getByRole("heading", { name: "Hierarchical Tasks Agent" })
.first() .first()
.click(); .click();
await initialGPTsetup(page);
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("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.nth(1)
.fill(process.env.OPENAI_API_KEY ?? "");
await page
.getByTestId("popover-anchor-input-api_key")
.nth(0)
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("dropdown_str_model_name").nth(1).click();
await page.getByTestId("gpt-4o-1-option").last().click();
await page.getByTestId("dropdown_str_model_name").nth(0).click();
await page.getByTestId("gpt-4o-1-option").first().click();
await page await page
.getByTestId("popover-anchor-input-api_key") .getByTestId("popover-anchor-input-api_key")

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"Memory Chatbot", "Memory Chatbot",
@ -15,68 +17,11 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Memory Chatbot" }).click(); await page.getByRole("heading", { name: "Memory Chatbot" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 5000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("button_run_chat output").click(); await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 }); await page.waitForSelector("text=built successfully", { timeout: 30000 });

View file

@ -1,7 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test.skip( test.skip(
"Sequential Task Agent", "Sequential Task Agent",
@ -16,33 +17,7 @@ test.skip(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page await page
@ -50,40 +25,7 @@ test.skip(
.first() .first()
.click(); .click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForTimeout(1000);
await page.getByTestId("button_run_chat output").click(); await page.getByTestId("button_run_chat output").click();

View file

@ -1,7 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"Simple Agent", "Simple Agent",
@ -17,71 +18,11 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Simple Agent" }).first().click(); await page.getByRole("heading", { name: "Simple Agent" }).first().click();
await initialGPTsetup(page);
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("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
await page
.getByTestId("popover-anchor-input-api_key")
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("fit_view").click();
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("button_run_chat output").last().click(); await page.getByTestId("button_run_chat output").last().click();

View file

@ -1,6 +1,6 @@
import { Page, test } from "@playwright/test"; import { Page, test } from "@playwright/test";
import path from "path"; import path from "path";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { extractAndCleanCode } from "../../utils/extract-and-clean-code"; import { extractAndCleanCode } from "../../utils/extract-and-clean-code";
test( test(
@ -19,29 +19,8 @@ test(
!process?.env?.ASTRA_DB_APPLICATION_TOKEN, !process?.env?.ASTRA_DB_APPLICATION_TOKEN,
"ASTRA_DB_APPLICATION_TOKEN required to run this test", "ASTRA_DB_APPLICATION_TOKEN required to run this test",
); );
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page await page
.getByRole("heading", { name: "Vector Store RAG" }) .getByRole("heading", { name: "Vector Store RAG" })
@ -67,7 +46,6 @@ test(
filledApiKey = await page.getByTestId("remove-icon-badge").count(); filledApiKey = await page.getByTestId("remove-icon-badge").count();
} }
if (process?.env?.ASTRA_DB_API_ENDPOINT?.includes("astra-dev")) { if (process?.env?.ASTRA_DB_API_ENDPOINT?.includes("astra-dev")) {
const getUA = await page.evaluate(() => navigator.userAgent);
await page.getByTestId("title-Astra DB").first().click(); await page.getByTestId("title-Astra DB").first().click();
await page.getByTestId("code-button-modal").click(); await page.getByTestId("code-button-modal").click();
await page.waitForSelector("text=Edit Code", { await page.waitForSelector("text=Edit Code", {

View file

@ -1,6 +1,7 @@
import { Page, test } from "@playwright/test"; import { Page, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
async function zoomOut(page: Page, times: number = 4) { async function zoomOut(page: Page, times: number = 4) {
for (let i = 0; i < times; i++) { for (let i = 0; i < times; i++) {
@ -20,29 +21,8 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to check similarity between embedding texts", "user must be able to check similarity between embedding texts",
@ -9,25 +10,7 @@ test(
"OPENAI_API_KEY required to run this test", "OPENAI_API_KEY required to run this test",
); );
await page.goto("/"); await awaitBootstrapTest(page);
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("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"vector store from starter projects should have its connections and nodes on the flow", "vector store from starter projects should have its connections and nodes on the flow",
@ -46,33 +47,7 @@ test(
} }
}); });
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page await page

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.skip( test.skip(
"TextInputOutputComponent", "TextInputOutputComponent",
@ -14,27 +16,8 @@ test.skip(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -55,13 +38,7 @@ test.skip(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let visibleElementHandle; let visibleElementHandle;
const elementsTextInputOutput = await page const elementsTextInputOutput = await page
.getByTestId("handle-textinput-shownode-text-right") .getByTestId("handle-textinput-shownode-text-right")

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to edit an empty prompt", "user must be able to edit an empty prompt",
@ -14,33 +15,7 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await awaitBootstrapTest(page);
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should be able to move flow from folder, rename it and be displayed on correct folder", "should be able to move flow from folder, rename it and be displayed on correct folder",
@ -11,31 +12,7 @@ test(
const randomName = Math.random().toString(36).substring(2); const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2); const secondRandomName = Math.random().toString(36).substring(2);
await page.goto("/"); await awaitBootstrapTest(page);
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByTestId("side_nav_options_all-templates").click(); await page.getByTestId("side_nav_options_all-templates").click();
await page await page

View file

@ -1,36 +1,15 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should be able to see output preview from grouped components and connect components with a single click", "should be able to see output preview from grouped components and connect components with a single click",
{ tag: ["@release", "@workspace", "@components"] }, { tag: ["@release", "@workspace", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/");
let modalCount = 0;
const randomName = Math.random().toString(36).substring(2); const randomName = Math.random().toString(36).substring(2);
const secondRandomName = Math.random().toString(36).substring(2); const secondRandomName = Math.random().toString(36).substring(2);
const thirdRandomName = Math.random().toString(36).substring(2); const thirdRandomName = Math.random().toString(36).substring(2);
try { await awaitBootstrapTest(page);
const modalTitleElement = 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.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"memory should work as expect", "memory should work as expect",
@ -14,26 +15,7 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,33 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test("chat_io_teste", { tag: ["@release", "@workspace"] }, async ({ page }) => { test("chat_io_teste", { tag: ["@release", "@workspace"] }, async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,35 +1,11 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"CodeAreaModalComponent", "CodeAreaModalComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"dropDownComponent", "dropDownComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -49,10 +27,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("title-Amazon Bedrock").click(); await page.getByTestId("title-Amazon Bedrock").click();
await page.getByTestId("dropdown_str_model_id").click(); await page.getByTestId("dropdown_str_model_id").click();

View file

@ -1,5 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import path from "path"; import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should be able to upload a file", "should be able to upload a file",
@ -7,32 +9,8 @@ test(
tag: ["@release", "@workspace"], tag: ["@release", "@workspace"],
}, },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -51,10 +29,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
const fileChooserPromise = page.waitForEvent("filechooser"); const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click(); await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise; const fileChooser = await fileChooserPromise;
@ -72,10 +47,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("parse data"); await page.getByTestId("sidebar-search-input").fill("parse data");
@ -86,10 +58,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let visibleElementHandle; let visibleElementHandle;

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"FloatComponent", "FloatComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -46,10 +24,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.locator('//*[@id="float_float_temperature"]').click(); await page.locator('//*[@id="float_float_temperature"]').click();
await page.locator('//*[@id="float_float_temperature"]').fill(""); await page.locator('//*[@id="float_float_temperature"]').fill("");

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"InputComponent", "InputComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -45,14 +23,8 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("popover-anchor-input-collection_name").click(); await page.getByTestId("popover-anchor-input-collection_name").click();
await page await page
.getByTestId("popover-anchor-input-collection_name") .getByTestId("popover-anchor-input-collection_name")

View file

@ -1,28 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"InputListComponent", "InputListComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
@ -36,10 +20,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("inputlist_str_urls_0").fill("test test test test"); await page.getByTestId("inputlist_str_urls_0").fill("test test test test");

View file

@ -1,32 +1,9 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test("IntComponent", { tag: ["@release", "@workspace"] }, async ({ page }) => { test("IntComponent", { tag: ["@release", "@workspace"] }, async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"KeypairListComponent", "KeypairListComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -46,10 +24,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click(); await page.getByTestId("advanced-button-modal").click();

View file

@ -1,40 +1,12 @@
import { expect, Page, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
// TODO: This test might not be needed anymore // TODO: This test might not be needed anymore
test( test(
"user should interact with link component", "user should interact with link component",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ context, page }) => { async ({ context, page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"NestedComponent", "NestedComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -47,10 +25,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.click('//*[@id="react-flow-id"]'); await page.click('//*[@id="react-flow-id"]');
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("dict_nesteddict_headers").first().click(); await page.getByTestId("dict_nesteddict_headers").first().click();
await page await page

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"PromptTemplateComponent", "PromptTemplateComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -46,10 +24,7 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click(); await page.getByTestId("promptarea_prompt_template").click();
await page await page

View file

@ -1,5 +1,5 @@
import { expect, Page, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
// TODO: This component doesn't have slider needs updating // TODO: This component doesn't have slider needs updating
test( test(
@ -8,35 +8,7 @@ test(
tag: ["@release", "@workspace"], tag: ["@release", "@workspace"],
}, },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,5 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to interact with table input component", "user must be able to interact with table input component",
@ -7,39 +7,12 @@ test(
tag: ["@release", "@workspace"], tag: ["@release", "@workspace"],
}, },
async ({ page }) => { async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
const randomText = Math.random().toString(36).substring(7); const randomText = Math.random().toString(36).substring(7);
const secondRandomText = Math.random().toString(36).substring(7); const secondRandomText = Math.random().toString(36).substring(7);
const thirdRandomText = Math.random().toString(36).substring(7); const thirdRandomText = Math.random().toString(36).substring(7);
const getUA = await page.evaluate(() => navigator.userAgent); await awaitBootstrapTest(page);
const userAgentInfo = uaParser(getUA);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });

View file

@ -1,28 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"TextAreaModalComponent", "TextAreaModalComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -40,14 +25,8 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("promptarea_prompt_template").click(); await page.getByTestId("promptarea_prompt_template").click();
await page.getByTestId("modal-promptarea_prompt_template").fill("{text}"); await page.getByTestId("modal-promptarea_prompt_template").fill("{text}");

View file

@ -1,35 +1,13 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"ToggleComponent", "ToggleComponent",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });
@ -47,14 +25,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").click(); await page.getByTestId("div-generic-node").click();
@ -101,14 +72,7 @@ test(
await page.getByTestId("div-generic-node").click(); await page.getByTestId("div-generic-node").click();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
await page.getByTestId("advanced-button-modal").click(); await page.getByTestId("advanced-button-modal").click();

View file

@ -1,48 +1,16 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to download a flow or a component", "user should be able to download a flow or a component",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await adjustScreenView(page);
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("zoom_out").click();
await page.getByText("Chat Input", { exact: true }).click(); await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
@ -94,21 +62,6 @@ test(
await page.waitForSelector('[data-testid="mainpage_title"]', { await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000, timeout: 30000,
}); });
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
await page.getByTestId("upload-folder-button").last().click(); await page.getByTestId("upload-folder-button").last().click();
}, },
); );
@ -117,43 +70,11 @@ test(
"user should be able to duplicate a flow or a component", "user should be able to duplicate a flow or a component",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByText("Chat Input", { exact: true }).click(); await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();

View file

@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to manually save a flow when the auto_save is off", "user should be able to manually save a flow when the auto_save is off",
@ -19,34 +20,7 @@ test(
}); });
}); });
await page.goto("/"); await awaitBootstrapTest(page);
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 5000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 5000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 5000, timeout: 5000,

View file

@ -1,27 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"curl_api_generation", "curl_api_generation",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page, context }) => { async ({ page, context }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByText("API", { exact: true }).click(); await page.getByText("API", { exact: true }).click();

View file

@ -1,29 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { simulateDragAndDrop } from "../../utils/simulate-drag-and-drop"; import { simulateDragAndDrop } from "../../utils/simulate-drag-and-drop";
test( test(
"user should be able to drag and drop an old collection without crashing the application", "user should be able to drag and drop an old collection without crashing the application",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.locator("span").filter({ hasText: "Close" }).first().click(); await page.locator("span").filter({ hasText: "Close" }).first().click();
@ -55,25 +38,7 @@ test(
"user should be able to drag and drop a flow on main page", "user should be able to drag and drop a flow on main page",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.locator("span").filter({ hasText: "Close" }).first().click(); await page.locator("span").filter({ hasText: "Close" }).first().click();
await page.locator("span").filter({ hasText: "My Projects" }).isVisible(); await page.locator("span").filter({ hasText: "My Projects" }).isVisible();

View file

@ -1,35 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must see on handle click the possibility connections - RetrievalQA", "user must see on handle click the possibility connections - RetrievalQA",
{ tag: ["@release", "@api", "@components"] }, { tag: ["@release", "@api", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -60,11 +37,8 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await adjustScreenView(page);
let visibleElementHandle; let visibleElementHandle;
const outputElements = await page const outputElements = await page

View file

@ -1,33 +1,9 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.describe("Flow Page tests", () => { test.describe("Flow Page tests", () => {
test("save", { tag: ["@release"] }, async ({ page }) => { test("save", { tag: ["@release"] }, async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,35 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"flowSettings", "flowSettings",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
}); });

View file

@ -1,41 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to see integrations in the sidebar if mvp_components is true", "user should be able to see integrations in the sidebar if mvp_components is true",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page }) => { async ({ page }) => {
// await page.route("**/api/v1/config", (route) => { await awaitBootstrapTest(page);
// route.fulfill({
// status: 200,
// contentType: "application/json",
// body: JSON.stringify({
// feature_flags: {
// mvp_components: true,
// },
// }),
// headers: {
// "content-type": "application/json",
// ...route.request().headers(),
// },
// });
// });
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="shad-sidebar"]', { await page.waitForSelector('[data-testid="shad-sidebar"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,32 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"LangflowShortcuts", "LangflowShortcuts",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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();
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
@ -48,14 +28,7 @@ test(
await page.locator('//*[@id="react-flow-id"]/div/div[2]/button[3]').click(); await page.locator('//*[@id="react-flow-id"]/div/div[2]/button[3]').click();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("generic-node-title-arrangement").click(); await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`ControlOrMeta+Shift+A`); await page.keyboard.press(`ControlOrMeta+Shift+A`);
await page.getByText("Close").last().click(); await page.getByText("Close").last().click();

View file

@ -2,6 +2,8 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user should not be able to upload a file larger than the limit", "user should not be able to upload a file larger than the limit",
@ -30,61 +32,11 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector("text=Chat Input", { timeout: 30000 }); await page.waitForSelector("text=Chat Input", { timeout: 30000 });

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to lock a flow and it must be saved", "user must be able to lock a flow and it must be saved",
@ -15,32 +16,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,35 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to minimize and expand a component", "user must be able to minimize and expand a component",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -54,10 +31,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();

View file

@ -1,26 +1,10 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test("user must be able to update outdated components", async ({ page }) => { test("user must be able to update outdated components", async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.locator("span").filter({ hasText: "Close" }).first().click(); await page.locator("span").filter({ hasText: "Close" }).first().click();
await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.locator("span").filter({ hasText: "My Collection" }).isVisible();

View file

@ -1,24 +1,10 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test("user must be able outdated message on error", async ({ page }) => { test("user must be able outdated message on error", async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.waitForTimeout(3000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.locator("span").filter({ hasText: "Close" }).first().click(); await page.locator("span").filter({ hasText: "Close" }).first().click();
await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.locator("span").filter({ hasText: "My Collection" }).isVisible();

View file

@ -1,34 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"python_api_generation", "python_api_generation",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page, context }) => { async ({ page, context }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.getByText("API", { exact: true }).click(); await page.getByText("API", { exact: true }).click();

View file

@ -1,27 +1,11 @@
import { expect, Page, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to interact with starter projects", "user must be able to interact with starter projects",
{ tag: ["@release", "@starter-projects"] }, { tag: ["@release", "@starter-projects"] },
async ({ page, context }) => { async ({ page, context }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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();
}
expect(page.getByText("Start from scratch", { exact: true })).toBeVisible(); expect(page.getByText("Start from scratch", { exact: true })).toBeVisible();
expect(page.getByRole("button", { name: "Blank Flow" })).toBeVisible(); expect(page.getByRole("button", { name: "Blank Flow" })).toBeVisible();

View file

@ -1,33 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to interact with sticky notes", "user should be able to interact with sticky notes",
{ tag: ["@release", "@workspace"] }, { tag: ["@release", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
const randomTitle = Math.random() const randomTitle = Math.random()
.toString(36) .toString(36)
.substring(7) .substring(7)
@ -55,13 +33,7 @@ Despite its many benefits, AI also raises important ethical and societal questio
The future of AI is both exciting and uncertain. As the technology continues to advance, it will undoubtedly bring about profound changes in society. The challenge will be to harness AI's potential for good while addressing the ethical and societal issues that arise. Whether it's through smarter healthcare, more efficient transportation, or enhanced creativity, AI has the potential to reshape the world in ways we are only beginning to imagine. The journey of AI is far from over, and its impact will be felt for generations to come. The future of AI is both exciting and uncertain. As the technology continues to advance, it will undoubtedly bring about profound changes in society. The challenge will be to harness AI's potential for good while addressing the ethical and societal issues that arise. Whether it's through smarter healthcare, more efficient transportation, or enhanced creativity, AI has the potential to reshape the world in ways we are only beginning to imagine. The journey of AI is far from over, and its impact will be felt for generations to come.
`; `;
while (modalCount === 0) { await awaitBootstrapTest(page);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,36 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"User must be able to stop building from inside Playground", "User must be able to stop building from inside Playground",
{ tag: ["@release", "@api"] }, { tag: ["@release", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -58,10 +34,7 @@ test(
.getByTestId("outputsChat Output") .getByTestId("outputsChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("div-generic-node").nth(0).click(); await page.getByTestId("div-generic-node").nth(0).click();
@ -96,9 +69,6 @@ class CustomComponent(Component):
sleep(60) sleep(60)
return data`; return data`;
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.locator(".ace_content").click(); await page.locator(".ace_content").click();
await page.keyboard.press(`ControlOrMeta+A`); await page.keyboard.press(`ControlOrMeta+A`);
await page.locator("textarea").fill(waitTimeoutCode); await page.locator("textarea").fill(waitTimeoutCode);

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.skip( test.skip(
"should like and add components and flows", "should like and add components and flows",
@ -13,22 +14,8 @@ test.skip(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForTimeout(1000);
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.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close", { exact: true }).click(); await page.getByText("Close", { exact: true }).click();
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
await page.getByTestId("button-store").click(); await page.getByTestId("button-store").click();

View file

@ -1,35 +1,11 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to see multiple edges and interact with them", "user should be able to see multiple edges and interact with them",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByText("Vector Store RAG", { exact: true }).last().click(); await page.getByText("Vector Store RAG", { exact: true }).last().click();
await page.getByText("Retriever", { exact: true }).first().isVisible(); await page.getByText("Retriever", { exact: true }).first().isVisible();

View file

@ -159,7 +159,6 @@ test("should see shortcuts", { tag: ["@release"] }, async ({ page }) => {
test( test(
"should interact with API Keys", "should interact with API Keys",
{ tag: ["@release", "@api"] }, { tag: ["@release", "@api"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await page.goto("/");
await page.getByTestId("user-profile-settings").click(); await page.getByTestId("user-profile-settings").click();
@ -175,11 +174,20 @@ test(
.getByPlaceholder("Insert a name for your API Key") .getByPlaceholder("Insert a name for your API Key")
.fill(randomName); .fill(randomName);
await page.getByText("Create Secret Key", { exact: true }).click(); await page.getByText("Create Secret Key", { exact: true }).click();
await page.getByText("Please save").isVisible();
await page.getByTestId("icon-Copy").click(); // Wait for api key creation to complete and render the next form element
await expect(page.getByText("Api Key Copied!")).toBeVisible({ await page.waitForTimeout(1000);
await page.waitForSelector("text=Please save", { timeout: 30000 });
await page.waitForSelector('[data-testid="btn-copy-api-key"]', {
timeout: 3000, timeout: 3000,
state: "visible",
}); });
await page.getByTestId("btn-copy-api-key").click();
await page.waitForSelector("text=Api Key Copied!", { timeout: 30000 });
await page.getByText(randomName).isVisible(); await page.getByText(randomName).isVisible();
}, },
); );

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user must be able to see output inspection", "user must be able to see output inspection",
@ -15,61 +17,14 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000, timeout: 100000,
}); });
await initialGPTsetup(page);
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("button_run_chat output").last().click(); await page.getByTestId("button_run_chat output").last().click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, Page, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user must interact with chat with Input/Output", "user must interact with chat with Input/Output",
@ -15,61 +17,12 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("fit_view").click(); await initialGPTsetup(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByText("Playground", { exact: true }).last().click(); await page.getByText("Playground", { exact: true }).last().click();

View file

@ -1,35 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to use duckduckgo search component", "user should be able to use duckduckgo search component",
{ tag: ["@release", "@components"] }, { tag: ["@release", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();

View file

@ -1,35 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to use youtube transcripts component", "user should be able to use youtube transcripts component",
{ tag: ["@release", "@components"] }, { tag: ["@release", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();

View file

@ -1,28 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { extractAndCleanCode } from "../../utils/extract-and-clean-code"; import { extractAndCleanCode } from "../../utils/extract-and-clean-code";
test( test(
"user must be able to use component as tool shortcut only if has tool mode is True", "user must be able to use component as tool shortcut only if has tool mode is True",
{ tag: ["@release", "@components"] }, { tag: ["@release", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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("blank-flow").click(); await page.getByTestId("blank-flow").click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"user must be able to send an image on chat using advanced tool on ChatInputComponent", "user must be able to send an image on chat using advanced tool on ChatInputComponent",
@ -15,61 +17,11 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForSelector("text=Chat Input", { timeout: 30000 }); await page.waitForSelector("text=Chat Input", { timeout: 30000 });

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user must be able to create a new flow clicking on New Flow button", "user must be able to create a new flow clicking on New Flow button",
@ -15,25 +16,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByText("Close").last().click(); await page.getByText("Close").last().click();

View file

@ -1,6 +1,8 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"should delete rows from table message", "should delete rows from table message",
@ -13,68 +15,11 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.getByTestId("button_run_chat output").click(); await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 }); await page.waitForSelector("text=built successfully", { timeout: 30000 });

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"freeze must work correctly", "freeze must work correctly",
@ -15,28 +16,10 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/");
const promptText = "answer as you are a dog"; const promptText = "answer as you are a dog";
const newPromptText = "answer as you are a bird"; const newPromptText = "answer as you are a bird";
let modalCount = 0; await awaitBootstrapTest(page);
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.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click(); await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -1,33 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to use ComposIO without getting api_key error", "user should be able to use ComposIO without getting api_key error",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
@ -62,30 +40,7 @@ test(
"user should be able to use connect tools", "user should be able to use connect tools",
{ tag: ["@release", "@api", "@components"] }, { tag: ["@release", "@api", "@components"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,33 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"user should be able to connect RetrieverTool into another components", "user should be able to connect RetrieverTool into another components",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
let modalCount = 0;
try {
const modalTitleElement = await page.getByTestId("modal-title");
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should be able to share a component on the store by clicking on the share button on the canvas", "should be able to share a component on the store by clicking on the share button on the canvas",
@ -15,25 +16,7 @@ test(
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
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.getByText("Close", { exact: true }).click(); await page.getByText("Close", { exact: true }).click();

View file

@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should use webhook component on API", "should use webhook component on API",
@ -15,32 +17,7 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -57,14 +34,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await adjustScreenView(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
// wait for the update to be applied // wait for the update to be applied
await page.waitForTimeout(1000); await page.waitForTimeout(1000);

View file

@ -1,6 +1,9 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv"; import * as dotenv from "dotenv";
import path from "path"; import path from "path";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
test( test(
"should copy code from playground modal", "should copy code from playground modal",
@ -16,34 +19,7 @@ test(
if (!process.env.CI) { if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") }); dotenv.config({ path: path.resolve(__dirname, "../../.env") });
} }
await awaitBootstrapTest(page);
await page.goto("/");
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
@ -66,10 +42,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input"); await page.getByTestId("sidebar-search-input").fill("chat input");
@ -86,10 +59,7 @@ test(
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("openai"); await page.getByTestId("sidebar-search-input").fill("openai");
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page await page
.getByTestId("modelsOpenAI") .getByTestId("modelsOpenAI")
@ -97,40 +67,7 @@ test(
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.waitForSelector('[data-testid="fit_view"]', { await initialGPTsetup(page);
timeout: 100000,
});
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
let outdatedComponents = await page
.getByTestId("icon-AlertTriangle")
.count();
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
const isApiKeyInputVisible = await apiKeyInput.isVisible();
if (isApiKeyInputVisible) {
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
}
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
const elementsChatInput = await page const elementsChatInput = await page
.locator('[data-testid="handle-chatinput-shownode-message-right"]') .locator('[data-testid="handle-chatinput-shownode-message-right"]')
@ -240,33 +177,7 @@ test(
"playground button should be enabled or disabled", "playground button should be enabled or disabled",
{ tag: ["@release", "@api", "@workspace"] }, { tag: ["@release", "@api", "@workspace"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,29 +1,11 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should be able to see error when something goes wrong on Code Modal", "should be able to see error when something goes wrong on Code Modal",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,

View file

@ -1,31 +1,12 @@
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js"; import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
// TODO: This test might not be needed anymore // TODO: This test might not be needed anymore
test( test(
"should be able to select all with ctrl + A on advanced modal", "should be able to select all with ctrl + A on advanced modal",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
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.waitForSelector('[data-testid="blank-flow"]', { await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000, timeout: 30000,
@ -47,9 +28,6 @@ test(
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
await page.getByTestId("div-generic-node").click(); await page.getByTestId("div-generic-node").click();
await page.keyboard.press(`ControlOrMeta+Shift+A`); await page.keyboard.press(`ControlOrMeta+Shift+A`);

View file

@ -1,35 +1,13 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { adjustScreenView } from "../../utils/adjust-screen-view";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"should interact with api request", "should interact with api request",
{ tag: ["@release"] }, { tag: ["@release"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page);
await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
timeout: 30000,
});
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("blank-flow").click(); await page.getByTestId("blank-flow").click();
await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("api request"); await page.getByTestId("sidebar-search-input").fill("api request");
@ -43,9 +21,6 @@ test(
.dragTo(page.locator('//*[@id="react-flow-id"]')); .dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.mouse.up(); await page.mouse.up();
await page.mouse.down(); await page.mouse.down();
await page.getByTestId("fit_view").click(); await adjustScreenView(page);
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
}, },
); );

View file

@ -1,8 +1,16 @@
import { Page } from "playwright/test"; import { Page } from "playwright/test";
export async function adjustScreenView(page: Page) { export async function adjustScreenView(
page: Page,
{
numberOfZoomOut = 3,
}: {
numberOfZoomOut?: number;
} = {},
) {
await page.getByTestId("fit_view").click(); await page.getByTestId("fit_view").click();
for (let i = 0; i < numberOfZoomOut; i++) {
await page.getByTestId("zoom_out").click(); await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click(); }
await page.getByTestId("zoom_out").click();
} }

View file

@ -1,6 +1,15 @@
import { Page } from "playwright/test"; import { Page } from "playwright/test";
export const awaitBootstrapTest = async (page: Page) => { export const awaitBootstrapTest = async (
page: Page,
options?: {
skipGoto?: boolean;
},
) => {
if (!options?.skipGoto) {
await page.goto("/");
}
await page.waitForSelector('[data-testid="mainpage_title"]', { await page.waitForSelector('[data-testid="mainpage_title"]', {
timeout: 30000, timeout: 30000,
}); });