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

test: Enhance test stability #4566

Merged
merged 40 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d18b720
🐛 (genericIconComponent/index.tsx): fix optional chaining for split a…
Cristhianzl Nov 13, 2024
a3e07af
⬆️ (typescript_test.yml): update matrix configuration to run tests on…
Cristhianzl Nov 13, 2024
433cdd0
🐛 (genericIconComponent/index.tsx): fix optional chaining for split a…
Cristhianzl Nov 13, 2024
40f38be
⬆️ (typescript_test.yml): update matrix configuration to run tests on…
Cristhianzl Nov 13, 2024
72ae516
🐛 (Travel Planning Agent.spec.ts): Fix issue with setting API keys fo…
Cristhianzl Nov 13, 2024
1b6a0d9
Merge branch 'cz/fix-tests-FE' of github.com:langflow-ai/langflow int…
Cristhianzl Nov 13, 2024
cee56ba
🔧 (generalBugs-shard-4.spec.ts): skip test case temporarily due to fu…
Cristhianzl Nov 13, 2024
f7b200a
Update test to use 'message history' instead of 'chat memory' in side…
ogabrielluiz Nov 13, 2024
00a6f76
Update test selectors and expected values in dropdownComponent.spec.ts
ogabrielluiz Nov 13, 2024
475f5ff
📝 (Simple Agent.spec.ts): Remove unnecessary test.skip and commented …
Cristhianzl Nov 13, 2024
fb1a508
Refactor tests to use `ControlOrMeta` for cross-platform keyboard sho…
ogabrielluiz Nov 13, 2024
b4e1d10
📝 (frontend): Update test descriptions to improve clarity and accuracy
Cristhianzl Nov 13, 2024
5790dcf
🔧 (frontend): Remove unnecessary control variable assignment and cond…
Cristhianzl Nov 13, 2024
e9b2c25
Merge branch 'main' into cz/fix-tests-FE
Cristhianzl Nov 13, 2024
849b2fc
✅ (Simple Agent.spec.ts): update timeout value for waitForSelector to…
Cristhianzl Nov 13, 2024
70a76a5
Merge branch 'cz/fix-tests-FE' of github.com:langflow-ai/langflow int…
Cristhianzl Nov 13, 2024
51554be
Handle undefined stars in GithubStarComponent to prevent errors
ogabrielluiz Nov 13, 2024
bc1d7a2
Add waitForSelector to ensure sidebar search input is visible before …
ogabrielluiz Nov 13, 2024
5d4a480
✅ (Simple Agent.spec.ts): update timeout value to 5 minutes for "buil…
Cristhianzl Nov 13, 2024
9ad6cae
Merge branch 'cz/fix-tests-FE' of github.com:langflow-ai/langflow int…
Cristhianzl Nov 13, 2024
c17c8da
Merge branch 'main' into cz/fix-tests-FE
Cristhianzl Nov 13, 2024
b57b842
🐛 (Simple Agent.spec.ts): reduce timeout for "built successfully" tex…
Cristhianzl Nov 13, 2024
ea7efcc
Merge branch 'cz/fix-tests-FE' of github.com:langflow-ai/langflow int…
Cristhianzl Nov 13, 2024
316e250
✅ (auto-login-off.spec.ts): add delay before checking visibility of e…
Cristhianzl Nov 13, 2024
39f4e8a
Fix indentation in TypeScript test workflow file
ogabrielluiz Nov 13, 2024
f1725db
Update test IDs and expected values in dropdownComponent.spec.ts
ogabrielluiz Nov 13, 2024
034146e
📝 (playground.spec.ts): remove redundant code related to zooming out …
Cristhianzl Nov 13, 2024
0f2a639
✨ (typescript_test.yml): update matrix indentation for better readabi…
Cristhianzl Nov 13, 2024
2fb32af
✅ (playground.spec.ts): remove skip from the test case to enable it t…
Cristhianzl Nov 13, 2024
4982137
Refactor timeout in playground test for better stability
anovazzi1 Nov 13, 2024
c160a07
Refactor keyboard shortcuts to use `ControlOrMeta` for cross-platform…
ogabrielluiz Nov 13, 2024
1faf8e3
🐛 (generalBugs-shard-7.spec.ts): fix keyboard shortcuts to use "Contr…
Cristhianzl Nov 13, 2024
fbde807
merge fix
Cristhianzl Nov 13, 2024
be4a75c
🔧 (Blog Writer.spec.ts): Remove commented-out code related to text in…
Cristhianzl Nov 13, 2024
7840ac4
🐛 (generalBugs-shard-7.spec.ts): fix incorrect keyboard shortcuts for…
Cristhianzl Nov 13, 2024
88feb70
🔧 (generalBugs-shard-7.spec.ts): resolve conflict in selecting all wi…
Cristhianzl Nov 13, 2024
dfe8c11
Remove unused control variable in Vector Store test
ogabrielluiz Nov 13, 2024
ac24582
Remove unnecessary newline in similarity.spec.ts test file
ogabrielluiz Nov 13, 2024
cff6f09
✅ (dropdownComponent.spec.ts): update test assertions to match new dr…
Cristhianzl Nov 13, 2024
2b7f2f8
🔧 (Vector Store.spec.ts): Remove unnecessary variable assignment and …
Cristhianzl Nov 13, 2024
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
11 changes: 5 additions & 6 deletions .github/workflows/typescript_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ jobs:
strategy:
fail-fast: false
matrix:
# shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# shardTotal: [10]
shardIndex: [1]
shardTotal: [1]
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
shardTotal: [10]

env:
OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }}
STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }}
Expand Down Expand Up @@ -121,8 +120,8 @@ jobs:
max_attempts: 2
command: |
cd src/frontend
# npx playwright test ${{ inputs.tests_folder }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
# npx playwright test ${{ inputs.tests_folder }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2
npx playwright test ${{ inputs.tests_folder }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --list
npx playwright test ${{ inputs.tests_folder }} --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2

- name: Upload blob report to GitHub Actions Artifacts
if: always()
Expand Down
2,183 changes: 1,701 additions & 482 deletions src/frontend/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { useDarkStore } from "@/stores/darkStore";
import { FaGithub } from "react-icons/fa";

export const GithubStarComponent = () => {
const stars = useDarkStore((state) => state.stars);
const stars: number | undefined = useDarkStore((state) => state.stars);

return (
<ShadTooltip content="Go to Github repo" side="bottom" styleClasses="z-10">
<div className="group inline-flex h-8 items-center justify-center gap-1 rounded-md border bg-muted px-2 pr-0 hover:border-input hover:bg-secondary-hover">
<FaGithub className="h-4 w-4" />
<div className="hidden text-xs font-semibold lg:block">Star</div>
<div className="-mr-px ml-1 flex h-8 items-center justify-center rounded-md rounded-l-none border bg-background px-2 text-xs font-semibold text-secondary-foreground group-hover:border-input">
{stars.toLocaleString() ?? 0}
{stars?.toLocaleString() ?? 0}
</div>
</div>
</ShadTooltip>
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/components/genericIconComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const ForwardedIconComponent = memo(
nodeIconsLucide[name] ||
nodeIconsLucide[
name
.split("-")
.map((x) => String(x[0]).toUpperCase() + String(x).slice(1))
.join("")
?.split("-")
?.map((x) => String(x[0]).toUpperCase() + String(x).slice(1))
?.join("")
];
if (!TargetIcon) {
if (!dynamicIconImports[name]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ test("search components", async ({ 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();

await page.getByText("Chat Input").first().click();
await page.waitForTimeout(500);
await page.getByTestId("more-options-modal").click();

await page.getByTestId("icon-SaveAll").first().click();
Expand Down
14 changes: 13 additions & 1 deletion src/frontend/tests/core/features/auto-login-off.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test("when auto_login is false, admin can CRUD user's and should see just your o

await page.waitForSelector("text=new user added", { timeout: 30000 });

await page.waitForTimeout(1000);

expect(await page.getByText(randomName, { exact: true }).isVisible()).toBe(
true,
);
Expand All @@ -64,6 +66,8 @@ test("when auto_login is false, admin can CRUD user's and should see just your o

await page.waitForSelector("text=user deleted", { timeout: 30000 });

await page.waitForTimeout(1000);

expect(await page.getByText(randomName, { exact: true }).isVisible()).toBe(
false,
);
Expand Down Expand Up @@ -147,7 +151,7 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
state: "visible",
});

await page.waitForTimeout(2000);
await page.waitForTimeout(1000);

await page.getByTestId("icon-ChevronLeft").first().click();

Expand All @@ -156,10 +160,14 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
state: "visible",
});

await page.waitForTimeout(2000);

expect(
await page.getByText(randomFlowName, { exact: true }).last().isVisible(),
).toBe(true);

await page.waitForTimeout(500);

await page.getByTestId("user-profile-settings").click();

await page.getByText("Logout", { exact: true }).click();
Expand Down Expand Up @@ -232,6 +240,8 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
).toBe(true);

await page.waitForTimeout(500);

expect(
await page.getByText(randomFlowName, { exact: true }).isVisible(),
).toBe(false);
Expand All @@ -258,6 +268,8 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
expect(
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
).toBe(false);
await page.waitForTimeout(500);

expect(
await page.getByText(randomFlowName, { exact: true }).isVisible(),
).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/tests/core/features/freeze-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ test("user must be able to freeze a path", async ({ page }) => {

await page.waitForTimeout(3000);

await page.getByText("openai").first().click();
await page.getByText("OpenAI", { exact: true }).last().click();

await page.waitForTimeout(1000);

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/tests/core/features/freeze.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ test("user must be able to freeze a component", async ({ page }) => {
await page.getByText("Close").last().click();
await page.getByText("Close").last().click();

await page.getByText("Split Text", { exact: true }).click();
await page.getByText("Split Text", { exact: true }).last().click();

await page.waitForTimeout(1000);

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/tests/core/features/playground.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ test("fresh start playground", async ({ page }) => {
await page.getByTestId("input-chat-playground").click();
await page.getByTestId("input-chat-playground").fill("second session");
await page.keyboard.press("Enter");
await page.waitForTimeout(500);
await page.waitForTimeout(5000);

await page.getByTestId("chat-message-User-second session").click();
await page
Expand Down
7 changes: 1 addition & 6 deletions src/frontend/tests/core/features/stop-building.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ test("user must be able to stop a building", async ({ page }) => {

const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";

if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}

await page.getByTestId("blank-flow").click();

Expand Down Expand Up @@ -255,7 +250,7 @@ class CustomComponent(Component):
await page.getByTestId("code-button-modal").click();
await page.waitForTimeout(500);

await page.locator("textarea").last().press(`${control}+a`);
await page.locator("textarea").last().press(`ControlOrMeta+a`);
await page.keyboard.press("Backspace");
await page.locator("textarea").last().fill(timerCode);
await page.locator('//*[@id="checkAndSaveBtn"]').click();
Expand Down
25 changes: 0 additions & 25 deletions src/frontend/tests/core/integrations/Blog Writer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,4 @@ test("Blog Writer", async ({ page }) => {
await page.getByText("turtles").last().isVisible();
await page.getByText("sea").last().isVisible();
await page.getByText("survival").last().isVisible();

//commented out for now because text input is not available in the playground

// await page.getByText("Instructions").last().click();

// const value = await page
// .getByPlaceholder("Enter text...")
// .last()
// .inputValue();

// expect(value).toBe(
// "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.",
// );

// await page.getByTestId("icon-ExternalLink").last().click();

// const count = await page
// .getByText(
// "Use the references above for style to write a new blog/tutorial about turtles. Suggest non-covered topics.",
// )
// .count();

// if (count <= 1) {
// expect(false).toBe(true);
// }
});
2 changes: 1 addition & 1 deletion src/frontend/tests/core/integrations/Dynamic Agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";

test("Dynamic Agent", async ({ page }) => {
test.skip("Dynamic Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as dotenv from "dotenv";
import path from "path";
import uaParser from "ua-parser-js";

test("Hierarchical Tasks Agent", async ({ page }) => {
test.skip("Hierarchical Tasks Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
Expand Down Expand Up @@ -45,11 +45,6 @@ test("Hierarchical Tasks Agent", async ({ page }) => {

const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";

if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}

await page.getByTestId("side_nav_options_all-templates").click();
await page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as dotenv from "dotenv";
import path from "path";
import uaParser from "ua-parser-js";

test("Sequential Task Agent", async ({ page }) => {
test.skip("Sequential Task Agent", async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
Expand Down Expand Up @@ -40,11 +40,6 @@ test("Sequential Task Agent", async ({ page }) => {

const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";

if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}

await page.getByTestId("side_nav_options_all-templates").click();
await page
Expand Down
76 changes: 11 additions & 65 deletions src/frontend/tests/core/integrations/Simple Agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ test("Simple Agent", async ({ page }) => {

const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";

if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}

await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Simple Agent" }).first().click();
Expand Down Expand Up @@ -82,71 +77,22 @@ test("Simple Agent", async ({ page }) => {
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();

await page.waitForTimeout(1000);

await page
.getByTestId("textarea_str_input_value")
.fill(
"Use the Python REPL tool to create a python function that calculates 4 + 4 and stores it in a variable.",
);

await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });

await page.getByText("built successfully").last().click({
timeout: 15000,
});

await page.getByText("Playground", { exact: true }).last().click();

await page.waitForSelector(
"text=Use the Python REPL tool to create a python function that calculates 4 + 4 and stores it in a variable.",
{
timeout: 30000,
},
);

await page.waitForTimeout(1000);

expect(page.getByText("User")).toBeVisible();

let pythonWords = await page.getByText("4 + 4").count();

expect(pythonWords).toBe(2);

await page
.getByPlaceholder("Send a message...")
.fill("write short python script to say hello world");

await page.getByTestId("button-send").last().click();

await page.waitForSelector(
"text=write short python script to say hello world",
{
timeout: 30000,
},
);

await page.waitForSelector('[data-testid="copy-code-button"]', {
timeout: 100000,
state: "visible",
});

await page.waitForTimeout(1000);

await page.getByTestId("copy-code-button").last().click();

await page.waitForTimeout(500);

await page.getByPlaceholder("Send a message...").click();
await page.getByTestId("button_run_chat output").last().click();

await page.waitForTimeout(500);
await page.waitForSelector("text=built successfully", {
timeout: 10000 * 60 * 3,
});

await page.keyboard.press(`${control}+V`);
await page.getByTestId("playground-btn-flow-io").click();

await page.waitForTimeout(500);
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();

pythonWords = await page.getByText("print(").count();
const concatAllText = textContents.join(" ").toLowerCase();

expect(pythonWords).toBeGreaterThanOrEqual(1);
expect(concatAllText).toContain("apple");
expect(concatAllText.length).toBeGreaterThan(100);
});
Loading