Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tests improvements to pipeline CI #2407

Merged
merged 4 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/typescript_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
if: ${{ steps.setup-node.outputs.cache-hit != 'true' }}
- name: Get Playwright version
run: echo "PLAYWRIGHT_VERSION=$(jq '.devDependencies["@playwright/test"]' src/frontend/package.json -r)" >> $GITHUB_ENV
- name: Cache Playwright binaries
- name: Cache Playwright binaries
id: playwright-cache
uses: actions/cache@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function HandleRenderComponent({
colors,
setFilterEdge,
showNode,
testIdComplement,
}: {
left: boolean;
nodes: any;
Expand All @@ -33,7 +34,10 @@ export default function HandleRenderComponent({
colors: string[];
setFilterEdge: any;
showNode: any;
testIdComplement?: string;
}) {
console.log(myData);
Cristhianzl marked this conversation as resolved.
Show resolved Hide resolved

return (
<Button
unstyled
Expand All @@ -52,7 +56,7 @@ export default function HandleRenderComponent({
side={left ? "left" : "right"}
>
<Handle
data-testid={`handle-${title.toLowerCase()}-${
data-testid={`handle-${testIdComplement}-${title.toLowerCase()}-${
!showNode ? (left ? "target" : "source") : left ? "left" : "right"
}`}
type={left ? "target" : "source"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ export default function ParameterComponent({
}
}, [disabledOutput]);

console.log(data);
Cristhianzl marked this conversation as resolved.
Show resolved Hide resolved

return !showNode ? (
left && LANGFLOW_SUPPORTED_TYPES.has(type ?? "") && !optionalHandle ? (
<></>
Expand All @@ -264,6 +266,7 @@ export default function ParameterComponent({
colors={colors}
setFilterEdge={setFilterEdge}
showNode={showNode}
testIdComplement={`${data?.type?.toLowerCase()}-noshownode`}
/>
)
) : (
Expand Down Expand Up @@ -390,6 +393,7 @@ export default function ParameterComponent({
colors={colors}
setFilterEdge={setFilterEdge}
showNode={showNode}
testIdComplement={`${data?.type?.toLowerCase()}-shownode`}
/>
)}

Expand Down
134 changes: 134 additions & 0 deletions src/frontend/tests/end-to-end/actionsMainPage-shard-0.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { test } from "@playwright/test";

test("user should be able to download a flow or a component", async ({
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 Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}

await page.getByRole("heading", { name: "Basic Prompting" }).click();

await page.waitForSelector('[title="fit view"]', {
timeout: 100000,
});

await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();

await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();

await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(3000);

if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(3000);

await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();

await page.getByText("Flows", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();

await page.getByText("Components", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Components exported successfully").isVisible();
});

test("user should be able to upload a flow or a component", async ({
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;
}

await page.getByTestId("upload-folder-button").last().click();
});

test("user should be able to duplicate a flow or a component", async ({
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 Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}

await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[title="fit view"]', {
timeout: 100000,
});

await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();

await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();

await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(3000);

if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(3000);

await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();

await page.getByTestId("icon-Copy").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items duplicated successfully").isVisible();
});
Original file line number Diff line number Diff line change
Expand Up @@ -137,136 +137,3 @@ test("search components", async ({ page }) => {
await page.getByText("Prompt", { exact: true }).isHidden();
await page.getByText("OpenAI", { exact: true }).isHidden();
});

test("user should be able to download a flow or a component", async ({
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 Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}

await page.getByRole("heading", { name: "Basic Prompting" }).click();

await page.waitForSelector('[title="fit view"]', {
timeout: 100000,
});

await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();

await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();

await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(3000);

if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(3000);

await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();

await page.getByText("Flows", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items exported successfully").isVisible();

await page.getByText("Components", { exact: true }).click();
await page.getByRole("checkbox").nth(1).click();
await page.getByTestId("icon-FileDown").last().click();
await page.waitForTimeout(1000);
await page.getByText("Components exported successfully").isVisible();
});

test("user should be able to upload a flow or a component", async ({
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;
}

await page.getByTestId("upload-folder-button").last().click();
});

test("user should be able to duplicate a flow or a component", async ({
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 Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}

await page.getByRole("heading", { name: "Basic Prompting" }).click();
await page.waitForSelector('[title="fit view"]', {
timeout: 100000,
});

await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();

await page.getByText("Chat Input", { exact: true }).click();
await page.getByTestId("more-options-modal").click();

await page.getByTestId("icon-SaveAll").first().click();
await page.waitForTimeout(3000);

if (await page.getByTestId("replace-button").isVisible()) {
await page.getByTestId("replace-button").click();
}
await page.waitForTimeout(3000);

await page.getByTestId("icon-ChevronLeft").last().click();
await page.getByRole("checkbox").nth(1).click();

await page.getByTestId("icon-Copy").last().click();
await page.waitForTimeout(1000);
await page.getByText("Items duplicated successfully").isVisible();
});
Loading
Loading