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

fix: share button not working on canvas #3770

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/backend/base/langflow/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def get_is_component_from_data(data: dict):


async def check_langflow_version(component: StoreComponentCreate):
from langflow.version import get_version
from langflow.utils.version import get_version_info

__version__ = get_version()
__version__ = get_version_info()["version"]

if not component.last_tested_version:
component.last_tested_version = __version__
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/modals/shareModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ export default function ShareModal({

<BaseModal.Footer
submit={{
label: `Share ${is_component ? " Component" : " Flow"}`,
label: `Share ${is_component ? "Component" : "Flow"}`,
loading: loadingNames,
dataTestId: "share-modal-button-flow",
}}
>
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";

test("should be able to share a component on the store by clicking on the share button on the canvas", async ({
page,
}) => {
test.skip(
!process?.env?.STORE_API_KEY,
"STORE_API_KEY required to run this test",
);

if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}

await page.goto("/");
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 Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}

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

await page.waitForTimeout(1000);

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

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

await page.waitForTimeout(1000);

await page
.getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? "");

await page.getByTestId("api-key-save-button-store").click();

await page.waitForTimeout(1000);

await page.getByText("Success! Your API Key has been saved.").isVisible();

await page.waitForTimeout(1000);

await page.getByText("My Collection", { exact: true }).click();

await page.waitForTimeout(1000);

await page.getByText("New Project", { exact: true }).click();

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

await page.waitForSelector("text=share", { timeout: 10000 });
await page.waitForSelector("text=playground", { timeout: 10000 });
await page.waitForSelector("text=api", { timeout: 10000 });

await page.getByTestId("shared-button-flow").click();

await page.waitForTimeout(500);

await page.waitForSelector("text=Publish workflow to the Langflow Store.", {
timeout: 10000,
});
await page.waitForSelector('[data-testid="share-modal-button-flow"]', {
timeout: 10000,
});
await page.waitForSelector("text=Share Flow", { timeout: 10000 });

await page.getByTestId("share-modal-button-flow").click();

await page.waitForSelector("text=flow shared successfully ", {
timeout: 10000,
});
});
Loading