Merge branch 'fix/minor_bugs' into fix/api_settings

This commit is contained in:
Lucas Oliveira 2024-06-04 19:14:51 -03:00
commit 2aa011c70b
38 changed files with 344 additions and 314 deletions

View file

@ -15,13 +15,13 @@ dotenv.config({ path: path.resolve(__dirname, "../../.env") });
export default defineConfig({ export default defineConfig({
testDir: "./tests", testDir: "./tests",
/* Run tests in files in parallel */ /* Run tests in files in parallel */
fullyParallel: true, fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
/* Retry on CI only */ /* Retry on CI only */
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: 1, workers: 5,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
timeout: 120 * 1000, timeout: 120 * 1000,
// reporter: [ // reporter: [
@ -52,18 +52,18 @@ export default defineConfig({
}, },
}, },
{ // {
name: "firefox", // name: "firefox",
use: { // use: {
...devices["Desktop Firefox"], // ...devices["Desktop Firefox"],
launchOptions: { // launchOptions: {
firefoxUserPrefs: { // firefoxUserPrefs: {
"dom.events.asyncClipboard.readText": true, // "dom.events.asyncClipboard.readText": true,
"dom.events.testing.asyncClipboard": true, // "dom.events.testing.asyncClipboard": true,
}, // },
}, // },
}, // },
}, // },
], ],
webServer: [ webServer: [
{ {

View file

@ -7,7 +7,6 @@ import { useTypesStore } from "../../stores/typesStore";
import { ResponseErrorDetailAPI } from "../../types/api"; import { ResponseErrorDetailAPI } from "../../types/api";
import ForwardedIconComponent from "../genericIconComponent"; import ForwardedIconComponent from "../genericIconComponent";
import InputComponent from "../inputComponent"; import InputComponent from "../inputComponent";
import { Button } from "../ui/button";
import { Input } from "../ui/input"; import { Input } from "../ui/input";
import { Label } from "../ui/label"; import { Label } from "../ui/label";
import { Textarea } from "../ui/textarea"; import { Textarea } from "../ui/textarea";
@ -65,7 +64,7 @@ export default function AddNewVariableButton({ children }): JSX.Element {
let responseError = error as ResponseErrorDetailAPI; let responseError = error as ResponseErrorDetailAPI;
setErrorData({ setErrorData({
title: "Error creating variable", title: "Error creating variable",
list: [responseError.response.data.detail ?? "Unknown error"], list: [responseError?.response?.data?.detail ?? "Unknown error"],
}); });
}); });
} }
@ -142,7 +141,9 @@ export default function AddNewVariableButton({ children }): JSX.Element {
></InputComponent> ></InputComponent>
</div> </div>
</BaseModal.Content> </BaseModal.Content>
<BaseModal.Footer submit={{ label: "Save Variable" }} /> <BaseModal.Footer
submit={{ label: "Save Variable", dataTestId: "save-variable-btn" }}
/>
</BaseModal> </BaseModal>
); );
} }

View file

@ -31,7 +31,7 @@ export default function InputListComponent({
<div <div
className={classNames( className={classNames(
value.length > 1 && editNode ? "my-1" : "", value.length > 1 && editNode ? "my-1" : "",
"flex flex-col gap-3" "flex flex-col gap-3",
)} )}
> >
{value.map((singleValue, idx) => { {value.map((singleValue, idx) => {
@ -55,10 +55,11 @@ export default function InputListComponent({
/> />
{idx === value.length - 1 ? ( {idx === value.length - 1 ? (
<button <button
onClick={() => { onClick={(e) => {
let newInputList = _.cloneDeep(value); let newInputList = _.cloneDeep(value);
newInputList.push(""); newInputList.push("");
onChange(newInputList); onChange(newInputList);
e.preventDefault();
}} }}
data-testid={ data-testid={
`input-list-plus-btn${ `input-list-plus-btn${
@ -79,10 +80,11 @@ export default function InputListComponent({
editNode ? "-edit" : "" editNode ? "-edit" : ""
}_${componentName}-` + idx }_${componentName}-` + idx
} }
onClick={() => { onClick={(e) => {
let newInputList = _.cloneDeep(value); let newInputList = _.cloneDeep(value);
newInputList.splice(idx, 1); newInputList.splice(idx, 1);
onChange(newInputList); onChange(newInputList);
e.preventDefault();
}} }}
disabled={disabled || playgroundDisabled} disabled={disabled || playgroundDisabled}
> >

View file

@ -100,6 +100,7 @@ const SideBarFoldersButtonsComponent = ({
size="icon" size="icon"
className="px-2" className="px-2"
onClick={addNewFolder} onClick={addNewFolder}
data-testid="add-folder-button"
> >
<ForwardedIconComponent name="FolderPlus" className="w-4" /> <ForwardedIconComponent name="FolderPlus" className="w-4" />
</Button> </Button>
@ -108,6 +109,7 @@ const SideBarFoldersButtonsComponent = ({
size="icon" size="icon"
className="px-2" className="px-2"
onClick={handleUploadFlowsToFolder} onClick={handleUploadFlowsToFolder}
data-testid="upload-folder-button"
> >
<ForwardedIconComponent name="Upload" className="w-4" /> <ForwardedIconComponent name="Upload" className="w-4" />
</Button> </Button>
@ -258,6 +260,7 @@ const SideBarFoldersButtonsComponent = ({
}} }}
value={foldersNames[item.name]} value={foldersNames[item.name]}
id={`input-folder-${item.name}`} id={`input-folder-${item.name}`}
data-testid={`input-folder`}
/> />
</div> </div>
) : ( ) : (

View file

@ -5,7 +5,7 @@ import { cn } from "../../utils/utils";
import ForwardedIconComponent from "../genericIconComponent"; import ForwardedIconComponent from "../genericIconComponent";
const buttonVariants = cva( const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background", "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",
{ {
variants: { variants: {
variant: { variant: {
@ -54,7 +54,16 @@ function toTitleCase(text: string) {
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
( (
{ className, variant, size, loading, asChild = false, children, ...props }, {
className,
variant,
size,
loading,
disabled,
asChild = false,
children,
...props
},
ref, ref,
) => { ) => {
const Comp = asChild ? Slot : "button"; const Comp = asChild ? Slot : "button";
@ -66,14 +75,13 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
<> <>
<Comp <Comp
className={cn(buttonVariants({ variant, size, className }))} className={cn(buttonVariants({ variant, size, className }))}
disabled={loading || disabled}
ref={ref} ref={ref}
{...props} {...props}
> >
{loading ? ( {loading ? (
<span className={cn("relative")}> <span className="relative">
<span className={loading ? "invisible" : "hidden"}> <span className="invisible">{newChildren}</span>
{newChildren}
</span>
<span className="absolute inset-0 flex items-center justify-center"> <span className="absolute inset-0 flex items-center justify-center">
<ForwardedIconComponent <ForwardedIconComponent
name={"Loader2"} name={"Loader2"}

View file

@ -2,11 +2,11 @@ import axios, { AxiosError, AxiosInstance } from "axios";
import { useContext, useEffect } from "react"; import { useContext, useEffect } from "react";
import { Cookies } from "react-cookie"; import { Cookies } from "react-cookie";
import { renewAccessToken } from "."; import { renewAccessToken } from ".";
import { AUTHORIZED_DUPLICATE_REQUESTS } from "../../constants/constants";
import { BuildStatus } from "../../constants/enums"; import { BuildStatus } from "../../constants/enums";
import { AuthContext } from "../../contexts/authContext"; import { AuthContext } from "../../contexts/authContext";
import useAlertStore from "../../stores/alertStore"; import useAlertStore from "../../stores/alertStore";
import useFlowStore from "../../stores/flowStore"; import useFlowStore from "../../stores/flowStore";
import { checkDuplicateRequestAndStoreRequest } from "./helpers/check-duplicate-requests";
// Create a new Axios instance // Create a new Axios instance
const api: AxiosInstance = axios.create({ const api: AxiosInstance = axios.create({
@ -81,28 +81,12 @@ function ApiInterceptor() {
// Request interceptor to add access token to every request // Request interceptor to add access token to every request
const requestInterceptor = api.interceptors.request.use( const requestInterceptor = api.interceptors.request.use(
(config) => { (config) => {
const lastUrl = localStorage.getItem("lastUrlCalled"); const checkRequest = checkDuplicateRequestAndStoreRequest(config);
const lastMethodCalled = localStorage.getItem("lastMethodCalled");
const isContained = AUTHORIZED_DUPLICATE_REQUESTS.some((request) => if (!checkRequest) {
config?.url!.includes(request), return Promise.reject("Duplicate request.");
);
if (
config?.url === lastUrl &&
!isContained &&
lastMethodCalled === config.method
) {
return Promise.reject("Duplicate request");
} }
localStorage.setItem("lastUrlCalled", config.url ?? "");
localStorage.setItem("lastMethodCalled", config.method ?? "");
localStorage.setItem(
"lastRequestData",
JSON.stringify(config.data) ?? "",
);
const accessToken = cookies.get("access_token_lf"); const accessToken = cookies.get("access_token_lf");
if (accessToken && !isAuthorizedURL(config?.url)) { if (accessToken && !isAuthorizedURL(config?.url)) {
config.headers["Authorization"] = `Bearer ${accessToken}`; config.headers["Authorization"] = `Bearer ${accessToken}`;

View file

@ -0,0 +1,30 @@
import { AUTHORIZED_DUPLICATE_REQUESTS } from "../../../constants/constants";
export function checkDuplicateRequestAndStoreRequest(config) {
const lastUrl = localStorage.getItem("lastUrlCalled");
const lastMethodCalled = localStorage.getItem("lastMethodCalled");
const lastRequestTime = localStorage.getItem("lastRequestTime");
const currentTime = Date.now();
const isContained = AUTHORIZED_DUPLICATE_REQUESTS.some((request) =>
config?.url!.includes(request),
);
if (
config?.url === lastUrl &&
!isContained &&
lastMethodCalled === config.method &&
lastMethodCalled === "get" && // Assuming you want to check only for GET requests
lastRequestTime &&
currentTime - parseInt(lastRequestTime, 10) < 800
) {
return false;
}
localStorage.setItem("lastUrlCalled", config.url ?? "");
localStorage.setItem("lastMethodCalled", config.method ?? "");
localStorage.setItem("lastRequestTime", currentTime.toString());
return true;
}

View file

@ -77,10 +77,10 @@ export default function GenericNode({
// first check if data.type in NATIVE_CATEGORIES // first check if data.type in NATIVE_CATEGORIES
// if not return // if not return
if (!data.node?.template?.code?.value) return; if (!data.node?.template?.code?.value) return;
const thisNodeTemplate = templates[data.type].template; const thisNodeTemplate = templates[data.type]?.template;
// if the template does not have a code key // if the template does not have a code key
// return // return
if (!thisNodeTemplate.code) return; if (!thisNodeTemplate?.code) return;
const currentCode = thisNodeTemplate.code?.value; const currentCode = thisNodeTemplate.code?.value;
const thisNodesCode = data.node!.template?.code?.value; const thisNodesCode = data.node!.template?.code?.value;
const componentsToIgnore = ["Custom Component"]; const componentsToIgnore = ["Custom Component"];
@ -416,6 +416,7 @@ export default function GenericNode({
"generic-node-title-arrangement rounded-full" + "generic-node-title-arrangement rounded-full" +
(!showNode && " justify-center ") (!showNode && " justify-center ")
} }
data-testid="generic-node-title-arrangement"
> >
{iconNodeRender()} {iconNodeRender()}
{showNode && ( {showNode && (

View file

@ -40,7 +40,7 @@ const useFetchDataOnMount = (
setErrorData({ setErrorData({
title: "Error while updating the Component", title: "Error while updating the Component",
list: [responseError.response.data.detail ?? "Unknown error"], list: [responseError?.response?.data?.detail ?? "Unknown error"],
}); });
} }
setIsLoading(false); setIsLoading(false);

View file

@ -44,7 +44,9 @@ const useHandleOnNewValue = (
let responseError = error as ResponseErrorTypeAPI; let responseError = error as ResponseErrorTypeAPI;
setErrorData({ setErrorData({
title: "Error while updating the Component", title: "Error while updating the Component",
list: [responseError.response.data.detail.error ?? "Unknown error"], list: [
responseError?.response?.data?.detail.error ?? "Unknown error",
],
}); });
} }
setIsLoading(false); setIsLoading(false);

View file

@ -26,7 +26,7 @@ const useHandleRefreshButtonPress = (setIsLoading, setNode, renderTooltips) => {
setErrorData({ setErrorData({
title: "Error while updating the Component", title: "Error while updating the Component",
list: [responseError.response.data.detail ?? "Unknown error"], list: [responseError?.response?.data?.detail ?? "Unknown error"],
}); });
} }
setIsLoading(false); setIsLoading(false);

View file

@ -72,6 +72,7 @@ const Footer: React.FC<{
icon?: ReactNode; icon?: ReactNode;
loading?: boolean; loading?: boolean;
disabled?: boolean; disabled?: boolean;
dataTestId?: string;
}; };
}> = ({ children, submit }) => { }> = ({ children, submit }) => {
return submit ? ( return submit ? (
@ -84,25 +85,12 @@ const Footer: React.FC<{
</Button> </Button>
</DialogClose> </DialogClose>
<Button <Button
data-testid={submit.dataTestId}
type="submit" type="submit"
disabled={submit.loading || submit.disabled} loading={submit.loading}
className="relative"
> >
<div {submit.icon && submit.icon}
className={cn( {submit.label}
submit.loading ? "opacity-100" : "opacity-0",
"absolute self-center",
)}
>
<ForwardedIconComponent
name={"Loader2"}
className={"animate-spin"}
/>
</div>
<div className={cn(submit.loading ? "opacity-0" : "opacity-100")}>
{submit.icon && submit.icon}
{submit.label}
</div>
</Button> </Button>
</div> </div>
</div> </div>

View file

@ -1,7 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import EditFlowSettings from "../../components/editFlowSettingsComponent"; import EditFlowSettings from "../../components/editFlowSettingsComponent";
import IconComponent from "../../components/genericIconComponent"; import IconComponent from "../../components/genericIconComponent";
import { Button } from "../../components/ui/button";
import { SETTINGS_DIALOG_SUBTITLE } from "../../constants/constants"; import { SETTINGS_DIALOG_SUBTITLE } from "../../constants/constants";
import useAlertStore from "../../stores/alertStore"; import useAlertStore from "../../stores/alertStore";
import useFlowsManagerStore from "../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore";
@ -36,7 +35,7 @@ export default function FlowSettingsModal({
.catch((err) => { .catch((err) => {
useAlertStore.getState().setErrorData({ useAlertStore.getState().setErrorData({
title: "Error while saving changes", title: "Error while saving changes",
list: [(err as AxiosError).response?.data.detail ?? ""], list: [err?.response?.data.detail ?? ""],
}); });
console.error(err); console.error(err);
}); });
@ -79,6 +78,7 @@ export default function FlowSettingsModal({
submit={{ submit={{
label: "Save", label: "Save",
disabled: nameLists.includes(name) && name !== currentFlow!.name, disabled: nameLists.includes(name) && name !== currentFlow!.name,
dataTestId: "save-flow-settings",
}} }}
/> />
</BaseModal> </BaseModal>

View file

@ -263,9 +263,7 @@ export default function ShareModal({
<BaseModal.Footer <BaseModal.Footer
submit={{ submit={{
label: `Share ${ label: `Share ${is_component ? " Component" : " Flow"}`,
!loadingNames && (!is_component ? " Flow" : " Component")
}`,
loading: loadingNames, loading: loadingNames,
}} }}
> >

View file

@ -183,10 +183,10 @@ export default function NodeToolbarComponent({
case "update": case "update":
takeSnapshot(); takeSnapshot();
// to update we must get the code from the templates in useTypesStore // to update we must get the code from the templates in useTypesStore
const thisNodeTemplate = templates[data.type].template; const thisNodeTemplate = templates[data.type]?.template;
// if the template does not have a code key // if the template does not have a code key
// return // return
if (!thisNodeTemplate.code) return; if (!thisNodeTemplate?.code) return;
const currentCode = thisNodeTemplate.code.value; const currentCode = thisNodeTemplate.code.value;
if (data.node) { if (data.node) {

View file

@ -1,6 +1,7 @@
import * as Form from "@radix-ui/react-form"; import * as Form from "@radix-ui/react-form";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import { useContext, useEffect, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import ForwardedIconComponent from "../../../../components/genericIconComponent"; import ForwardedIconComponent from "../../../../components/genericIconComponent";
import GradientChooserComponent from "../../../../components/gradientChooserComponent"; import GradientChooserComponent from "../../../../components/gradientChooserComponent";
import InputComponent from "../../../../components/inputComponent"; import InputComponent from "../../../../components/inputComponent";
@ -36,13 +37,12 @@ import {
} from "../../../../controllers/API"; } from "../../../../controllers/API";
import useAlertStore from "../../../../stores/alertStore"; import useAlertStore from "../../../../stores/alertStore";
import useFlowsManagerStore from "../../../../stores/flowsManagerStore"; import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
import { useStoreStore } from "../../../../stores/storeStore";
import { import {
inputHandlerEventType, inputHandlerEventType,
patchUserInputStateType, patchUserInputStateType,
} from "../../../../types/components"; } from "../../../../types/components";
import { gradients } from "../../../../utils/styleUtils"; import { gradients } from "../../../../utils/styleUtils";
import { useStoreStore } from "../../../../stores/storeStore";
import { useParams } from "react-router-dom";
export default function GeneralPage() { export default function GeneralPage() {
const setCurrentFlowId = useFlowsManagerStore( const setCurrentFlowId = useFlowsManagerStore(
@ -332,7 +332,11 @@ export default function GeneralPage() {
</CardContent> </CardContent>
<CardFooter className="border-t px-6 py-4"> <CardFooter className="border-t px-6 py-4">
<Form.Submit asChild> <Form.Submit asChild>
<Button loading={loadingApiKey} type="submit"> <Button
loading={loadingApiKey}
type="submit"
data-testid="api-key-save-button-store"
>
Save Save
</Button> </Button>
</Form.Submit> </Form.Submit>

View file

@ -1,183 +1,206 @@
import { Suspense, lazy } from "react";
import { Navigate, Route, Routes } from "react-router-dom"; import { Navigate, Route, Routes } from "react-router-dom";
import { ProtectedAdminRoute } from "./components/authAdminGuard"; import { ProtectedAdminRoute } from "./components/authAdminGuard";
import { ProtectedRoute } from "./components/authGuard"; import { ProtectedRoute } from "./components/authGuard";
import { ProtectedLoginRoute } from "./components/authLoginGuard"; import { ProtectedLoginRoute } from "./components/authLoginGuard";
import { CatchAllRoute } from "./components/catchAllRoutes"; import { CatchAllRoute } from "./components/catchAllRoutes";
import LoadingComponent from "./components/loadingComponent";
import { StoreGuard } from "./components/storeGuard"; import { StoreGuard } from "./components/storeGuard";
import AdminPage from "./pages/AdminPage";
import LoginAdminPage from "./pages/AdminPage/LoginPage"; const AdminPage = lazy(() => import("./pages/AdminPage"));
import DeleteAccountPage from "./pages/DeleteAccountPage"; const LoginAdminPage = lazy(() => import("./pages/AdminPage/LoginPage"));
import FlowPage from "./pages/FlowPage"; const ApiKeysPage = lazy(
import LoginPage from "./pages/LoginPage"; () => import("./pages/SettingsPage/pages/ApiKeysPage"),
import MyCollectionComponent from "./pages/MainPage/components/myCollectionComponent"; );
import HomePage from "./pages/MainPage/pages/mainPage"; const DeleteAccountPage = lazy(() => import("./pages/DeleteAccountPage"));
import PlaygroundPage from "./pages/Playground"; const FlowPage = lazy(() => import("./pages/FlowPage"));
import SettingsPage from "./pages/SettingsPage"; const LoginPage = lazy(() => import("./pages/LoginPage"));
import GeneralPage from "./pages/SettingsPage/pages/GeneralPage"; const MyCollectionComponent = lazy(
import GlobalVariablesPage from "./pages/SettingsPage/pages/GlobalVariablesPage"; () => import("./pages/MainPage/components/myCollectionComponent"),
import ApiKeysPage from "./pages/SettingsPage/pages/ApiKeysPage"; );
import ShortcutsPage from "./pages/SettingsPage/pages/ShortcutsPage"; const HomePage = lazy(() => import("./pages/MainPage/pages/mainPage"));
import SignUp from "./pages/SignUpPage"; const PlaygroundPage = lazy(() => import("./pages/Playground"));
import StorePage from "./pages/StorePage"; const SettingsPage = lazy(() => import("./pages/SettingsPage"));
import ViewPage from "./pages/ViewPage"; const GeneralPage = lazy(
() => import("./pages/SettingsPage/pages/GeneralPage"),
);
const GlobalVariablesPage = lazy(
() => import("./pages/SettingsPage/pages/GlobalVariablesPage"),
);
const ShortcutsPage = lazy(
() => import("./pages/SettingsPage/pages/ShortcutsPage"),
);
const SignUp = lazy(() => import("./pages/SignUpPage"));
const StorePage = lazy(() => import("./pages/StorePage"));
const ViewPage = lazy(() => import("./pages/ViewPage"));
const Router = () => { const Router = () => {
return ( return (
<Routes> <Suspense
<Route fallback={
path="/" <div className="loading-page-panel">
element={ <LoadingComponent remSize={50} />
<ProtectedRoute> </div>
<HomePage /> }
</ProtectedRoute> >
} <Routes>
>
<Route index element={<Navigate replace to={"all"} />} />
<Route <Route
path="flows/*" path="/"
element={<MyCollectionComponent key="flows" type="flow" />}
/>
<Route
path="components/*"
element={<MyCollectionComponent key="components" type="component" />}
/>
<Route
path="all/*"
element={<MyCollectionComponent key="all" type="all" />}
/>
</Route>
<Route
path="/settings"
element={
<ProtectedRoute>
<SettingsPage />
</ProtectedRoute>
}
>
<Route index element={<Navigate replace to={"general"} />} />
<Route path="global-variables" element={<GlobalVariablesPage />} />
<Route path="api-keys" element={<ApiKeysPage />} />
<Route path="general/:scrollId?" element={<GeneralPage />} />
<Route path="shortcuts" element={<ShortcutsPage />} />
</Route>
<Route
path="/store"
element={
<ProtectedRoute>
<StoreGuard>
<StorePage />
</StoreGuard>
</ProtectedRoute>
}
/>
<Route
path="/store/:id/"
element={
<ProtectedRoute>
<StoreGuard>
<StorePage />
</StoreGuard>
</ProtectedRoute>
}
/>
<Route path="/playground/:id/">
<Route
path=""
element={ element={
<ProtectedRoute> <ProtectedRoute>
<PlaygroundPage /> <HomePage />
</ProtectedRoute>
}
>
<Route index element={<Navigate replace to={"all"} />} />
<Route
path="flows/*"
element={<MyCollectionComponent key="flows" type="flow" />}
/>
<Route
path="components/*"
element={
<MyCollectionComponent key="components" type="component" />
}
/>
<Route
path="all/*"
element={<MyCollectionComponent key="all" type="all" />}
/>
</Route>
<Route
path="/settings"
element={
<ProtectedRoute>
<SettingsPage />
</ProtectedRoute>
}
>
<Route index element={<Navigate replace to={"general"} />} />
<Route path="global-variables" element={<GlobalVariablesPage />} />
<Route path="api-keys" element={<ApiKeysPage />} />
<Route path="general/:scrollId?" element={<GeneralPage />} />
<Route path="shortcuts" element={<ShortcutsPage />} />
</Route>
<Route
path="/store"
element={
<ProtectedRoute>
<StoreGuard>
<StorePage />
</StoreGuard>
</ProtectedRoute> </ProtectedRoute>
} }
/> />
</Route> <Route
<Route path="/flow/:id/"> path="/store/:id/"
element={
<ProtectedRoute>
<StoreGuard>
<StorePage />
</StoreGuard>
</ProtectedRoute>
}
/>
<Route path="/playground/:id/">
<Route
path=""
element={
<ProtectedRoute>
<PlaygroundPage />
</ProtectedRoute>
}
/>
</Route>
<Route path="/flow/:id/">
<Route
path="*"
element={
<ProtectedRoute>
<FlowPage />
</ProtectedRoute>
}
/>
<Route
path=""
element={
<ProtectedRoute>
<FlowPage />
</ProtectedRoute>
}
/>
<Route
path="view"
element={
<ProtectedRoute>
<ViewPage />
</ProtectedRoute>
}
/>
</Route>
<Route <Route
path="*" path="*"
element={ element={
<ProtectedRoute> <ProtectedRoute>
<FlowPage /> <CatchAllRoute />
</ProtectedRoute> </ProtectedRoute>
} }
/> />
<Route <Route
path="" path="/login"
element={ element={
<ProtectedRoute> <ProtectedLoginRoute>
<FlowPage /> <LoginPage />
</ProtectedRoute> </ProtectedLoginRoute>
} }
/> />
<Route <Route
path="view" path="/signup"
element={ element={
<ProtectedRoute> <ProtectedLoginRoute>
<ViewPage /> <SignUp />
</ProtectedRoute> </ProtectedLoginRoute>
} }
/> />
</Route>
<Route
path="*"
element={
<ProtectedRoute>
<CatchAllRoute />
</ProtectedRoute>
}
/>
<Route
path="/login"
element={
<ProtectedLoginRoute>
<LoginPage />
</ProtectedLoginRoute>
}
/>
<Route
path="/signup"
element={
<ProtectedLoginRoute>
<SignUp />
</ProtectedLoginRoute>
}
/>
<Route
path="/login/admin"
element={
<ProtectedLoginRoute>
<LoginAdminPage />
</ProtectedLoginRoute>
}
/>
<Route
path="/admin"
element={
<ProtectedAdminRoute>
<AdminPage />
</ProtectedAdminRoute>
}
/>
<Route path="/account">
<Route <Route
path="delete" path="/login/admin"
element={ element={
<ProtectedRoute> <ProtectedLoginRoute>
<DeleteAccountPage /> <LoginAdminPage />
</ProtectedRoute> </ProtectedLoginRoute>
} }
></Route> />
<Route <Route
path="api-keys" path="/admin"
element={ element={
<ProtectedRoute> <ProtectedAdminRoute>
<ApiKeysPage /> <AdminPage />
</ProtectedRoute> </ProtectedAdminRoute>
} }
></Route> />
</Route>
</Routes> <Route path="/account">
<Route
path="delete"
element={
<ProtectedRoute>
<DeleteAccountPage />
</ProtectedRoute>
}
></Route>
<Route
path="api-keys"
element={
<ProtectedRoute>
<ApiKeysPage />
</ProtectedRoute>
}
></Route>
</Route>
</Routes>
</Suspense>
); );
}; };

View file

@ -23,8 +23,8 @@ test("chat_io_teste", async ({ page }) => {
} }
const jsonContent = readFileSync( const jsonContent = readFileSync(
"tests/end-to-end/assets/ChatTest.json", "src/frontend/tests/end-to-end/assets/ChatTest.json",
"utf-8" "utf-8",
); );
await page.getByTestId("blank-flow").click(); await page.getByTestId("blank-flow").click();
@ -47,7 +47,7 @@ test("chat_io_teste", async ({ page }) => {
"drop", "drop",
{ {
dataTransfer, dataTransfer,
} },
); );
await page.getByLabel("fit view").click(); await page.getByLabel("fit view").click();
await page.getByText("Playground", { exact: true }).click(); await page.getByText("Playground", { exact: true }).click();

View file

@ -57,8 +57,11 @@ test("user must interact with chat with Input/Output", async ({ page }) => {
.getByTestId("textarea-input_value") .getByTestId("textarea-input_value")
.nth(1) .nth(1)
.fill( .fill(
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!" "testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!",
); );
await page.getByTestId("icon-LucideSend").click();
await page.getByText("Close", { exact: true }).click();
await page await page
.getByTestId("popover-anchor-input-sender_name") .getByTestId("popover-anchor-input-sender_name")
.nth(1) .nth(1)
@ -68,7 +71,7 @@ test("user must interact with chat with Input/Output", async ({ page }) => {
.nth(0) .nth(0)
.fill("TestSenderNameAI"); .fill("TestSenderNameAI");
await page.getByText("Playground", { exact: true }).click(); await page.getByText("Playground", { exact: true }).last().click();
await page.getByTestId("icon-LucideSend").click(); await page.getByTestId("icon-LucideSend").click();
valueUser = await page valueUser = await page
@ -85,8 +88,8 @@ test("user must interact with chat with Input/Output", async ({ page }) => {
await page await page
.getByText( .getByText(
"testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!", "testtesttesttesttesttestte;.;.,;,.;,.;.,;,..,;;;;;;;;;;;;;;;;;;;;;,;.;,.;,.,;.,;.;.,~~çççççççççççççççççççççççççççççççççççççççisdajfdasiopjfaodisjhvoicxjiovjcxizopjviopasjioasfhjaiohf23432432432423423sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestççççççççççççççççççççççççççççççççç,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,!",
{ exact: true } { exact: true },
) )
.isVisible() .isVisible(),
); );
}); });

View file

@ -26,7 +26,7 @@ test.describe("drag and drop test", () => {
await page.locator("span").filter({ hasText: "My Collection" }).isVisible(); await page.locator("span").filter({ hasText: "My Collection" }).isVisible();
// Read your file into a buffer. // Read your file into a buffer.
const jsonContent = readFileSync( const jsonContent = readFileSync(
"tests/end-to-end/assets/collection.json", "src/frontend/tests/end-to-end/assets/collection.json",
"utf-8", "utf-8",
); );

View file

@ -170,7 +170,7 @@ test("dropDownComponent", async ({ page }) => {
expect(false).toBeTruthy(); expect(false).toBeTruthy();
} }
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
value = await page.getByTestId("dropdown-model_id").innerText(); value = await page.getByTestId("dropdown-model_id").innerText();
if (value !== "ai21.j2-mid-v1") { if (value !== "ai21.j2-mid-v1") {

View file

@ -148,7 +148,6 @@ test("LLMChain - Filter", async ({ page }) => {
await expect(page.getByTestId("model_specsChatOllama")).toBeVisible(); await expect(page.getByTestId("model_specsChatOllama")).toBeVisible();
await expect(page.getByTestId("model_specsChatOpenAI")).toBeVisible(); await expect(page.getByTestId("model_specsChatOpenAI")).toBeVisible();
await expect(page.getByTestId("model_specsChatVertexAI")).toBeVisible(); await expect(page.getByTestId("model_specsChatVertexAI")).toBeVisible();
await expect(page.getByTestId("model_specsCohere")).toBeVisible();
await expect( await expect(
page.getByTestId("model_specsGoogle Generative AI"), page.getByTestId("model_specsGoogle Generative AI"),
).toBeVisible(); ).toBeVisible();
@ -176,7 +175,6 @@ test("LLMChain - Filter", async ({ page }) => {
await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible(); await expect(page.getByTestId("model_specsChatOllama")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible(); await expect(page.getByTestId("model_specsChatOpenAI")).not.toBeVisible();
await expect(page.getByTestId("model_specsChatVertexAI")).not.toBeVisible(); await expect(page.getByTestId("model_specsChatVertexAI")).not.toBeVisible();
await expect(page.getByTestId("model_specsCohere")).not.toBeVisible();
await page await page
.locator( .locator(

View file

@ -60,26 +60,20 @@ test("FloatComponent", async ({ page }) => {
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click(); await page.getByTestId("edit-button-modal").click();
await page.locator('//*[@id="showcache"]').click();
expect(await page.locator('//*[@id="showcache"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="showcache"]').click();
expect(await page.locator('//*[@id="showcache"]').isChecked()).toBeFalsy();
await page.getByTestId("showformat").click(); await page.getByTestId("showformat").click();
expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeTruthy(); expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeTruthy();
await page.getByTestId("showformat").click(); await page.getByTestId("showformat").click();
expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeFalsy(); expect(await page.locator('//*[@id="showformat"]').isChecked()).toBeFalsy();
await page.getByTestId("showmirostat").click();
expect(await page.locator('//*[@id="showmirostat"]').isChecked()).toBeFalsy();
await page.getByTestId("showmirostat").click(); await page.getByTestId("showmirostat").click();
expect( expect(
await page.locator('//*[@id="showmirostat"]').isChecked(), await page.locator('//*[@id="showmirostat"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.getByTestId("showmirostat").click();
expect(await page.locator('//*[@id="showmirostat"]').isChecked()).toBeFalsy();
await page.getByTestId("showmirostat_eta").click(); await page.getByTestId("showmirostat_eta").click();
expect( expect(
await page.locator('//*[@id="showmirostat_eta"]').isChecked(), await page.locator('//*[@id="showmirostat_eta"]').isChecked(),
@ -138,7 +132,7 @@ test("FloatComponent", async ({ page }) => {
await page.locator('//*[@id="showrepeat_last_n"]').isChecked(), await page.locator('//*[@id="showrepeat_last_n"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
const plusButtonLocator = page.locator('//*[@id="float-input"]'); const plusButtonLocator = page.locator('//*[@id="float-input"]');
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -154,7 +148,7 @@ test("FloatComponent", async ({ page }) => {
await page.locator('//*[@id="showtemperature"]').isChecked(), await page.locator('//*[@id="showtemperature"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.locator('//*[@id="float-input"]').click(); await page.locator('//*[@id="float-input"]').click();
await page.locator('//*[@id="float-input"]').fill("3"); await page.locator('//*[@id="float-input"]').fill("3");

View file

@ -44,7 +44,8 @@ test("flowSettings", async ({ page }) => {
"Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test", "Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test Flow Name Test",
); );
await page.getByText("Save").last().click(); await page.getByTestId("save-flow-settings").click();
await page.getByTestId("save-flow-settings").click();
await page.waitForTimeout(1000); await page.waitForTimeout(1000);

View file

@ -31,33 +31,16 @@ test("CRUD folders", async ({ page }) => {
await page.getByText("All").first().isVisible(); await page.getByText("All").first().isVisible();
await page.getByText("Select All").isVisible(); await page.getByText("Select All").isVisible();
await page.getByText("New Folder", { exact: true }).last().click(); await page.getByTestId("add-folder-button").click();
await page.getByPlaceholder("Insert a name for the folder").fill("test"); await page.getByText("New Folder").last().isVisible();
await page
.getByPlaceholder("Insert a description for the folder")
.fill("test");
await page.getByText("Save Folder").click();
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
await page.getByText("Folder created succefully").isVisible(); await page.getByText("New Folder").last().dblclick();
await page.getByText("test").last().isVisible(); await page.getByTestId("input-folder").fill("new folder test name");
await page await page.keyboard.press("Enter");
.getByText("test") await page.getByText("new folder test name").last().isVisible();
.last()
.hover()
.then(async () => {
await page.getByTestId("icon-pencil").last().click();
});
await page.getByPlaceholder("Insert a name for the folder").fill("test edit");
await page
.getByPlaceholder("Insert a description for the folder")
.fill("test edit");
await page.getByText("Edit Folder").last().click();
await page.getByText("test edit").last().isVisible();
await page await page
.getByText("test edit") .getByText("new folder test name")
.last() .last()
.hover() .hover()
.then(async () => { .then(async () => {
@ -74,7 +57,7 @@ test("add folder by drag and drop", async ({ page }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
const jsonContent = readFileSync( const jsonContent = readFileSync(
"tests/end-to-end/assets/collection.json", "src/frontend/tests/end-to-end/assets/collection.json",
"utf-8", "utf-8",
); );
@ -131,17 +114,13 @@ test("change flow folder", async ({ page }) => {
await page.getByText("All").first().isVisible(); await page.getByText("All").first().isVisible();
await page.getByText("Select All").isVisible(); await page.getByText("Select All").isVisible();
await page.getByText("New Folder", { exact: true }).last().click(); await page.getByTestId("add-folder-button").click();
await page.getByPlaceholder("Insert a name for the folder").fill("test"); await page.getByText("New Folder").last().isVisible();
await page
.getByPlaceholder("Insert a description for the folder")
.fill("test");
await page.getByText("Save Folder").click();
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
await page.getByText("Folder created succefully").isVisible(); await page.getByText("New Folder").last().dblclick();
await page.getByText("test").last().isVisible(); await page.getByTestId("input-folder").fill("new folder test name");
await page.keyboard.press("Enter");
await page.getByText("new folder test name").last().isVisible();
await page.getByText("My Projects").last().click(); await page.getByText("My Projects").last().click();
await page.getByText("Basic Prompting").first().hover(); await page.getByText("Basic Prompting").first().hover();

View file

@ -69,7 +69,6 @@ test("GlobalVariables", async ({ page }) => {
await page.getByText("Save Variable", { exact: true }).click(); await page.getByText("Save Variable", { exact: true }).click();
expect(page.getByText(credentialName, { exact: true })).not.toBeNull(); expect(page.getByText(credentialName, { exact: true })).not.toBeNull();
await page.getByText(credentialName, { exact: true }).isVisible(); await page.getByText(credentialName, { exact: true }).isVisible();
await page.getByText("Save Variable", { exact: true }).click();
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page await page

View file

@ -73,9 +73,9 @@ test("InputComponent", async ({ page }) => {
await page.locator('//*[@id="showchroma_server_host"]').isChecked(), await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showchroma_server_port"]').click(); await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect( expect(
await page.locator('//*[@id="showchroma_server_port"]').isChecked(), await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click(); await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
@ -110,9 +110,9 @@ test("InputComponent", async ({ page }) => {
await page.locator('//*[@id="showchroma_server_host"]').isChecked(), await page.locator('//*[@id="showchroma_server_host"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showchroma_server_port"]').click(); await page.locator('//*[@id="showchroma_server_http_port"]').click();
expect( expect(
await page.locator('//*[@id="showchroma_server_port"]').isChecked(), await page.locator('//*[@id="showchroma_server_http_port"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click(); await page.locator('//*[@id="showchroma_server_ssl_enabled"]').click();
@ -138,7 +138,7 @@ test("InputComponent", async ({ page }) => {
.getByTestId("popover-anchor-input-collection_name-edit") .getByTestId("popover-anchor-input-collection_name-edit")
.fill("NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe"); .fill("NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe");
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
const plusButtonLocator = page.getByTestId("input-collection_name"); const plusButtonLocator = page.getByTestId("input-collection_name");
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -155,7 +155,7 @@ test("InputComponent", async ({ page }) => {
await page.locator('//*[@id="showcollection_name"]').isChecked(), await page.locator('//*[@id="showcollection_name"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
let value = await page let value = await page
.getByTestId("popover-anchor-input-collection_name") .getByTestId("popover-anchor-input-collection_name")

View file

@ -41,19 +41,19 @@ test("InputListComponent", async ({ page }) => {
await page.getByTestId("edit-button-modal").click(); await page.getByTestId("edit-button-modal").click();
expect( expect(
await page.getByTestId("showmetadata_indexing_exclude").isChecked() await page.getByTestId("showmetadata_indexing_exclude").isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.getByTestId("showmetadata_indexing_exclude").click(); await page.getByTestId("showmetadata_indexing_exclude").click();
expect( expect(
await page.getByTestId("showmetadata_indexing_exclude").isChecked() await page.getByTestId("showmetadata_indexing_exclude").isChecked(),
).toBeTruthy(); ).toBeTruthy();
expect( expect(
await page.getByTestId("showmetadata_indexing_include").isChecked() await page.getByTestId("showmetadata_indexing_include").isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.getByTestId("showmetadata_indexing_include").click(); await page.getByTestId("showmetadata_indexing_include").click();
expect( expect(
await page.getByTestId("showmetadata_indexing_include").isChecked() await page.getByTestId("showmetadata_indexing_include").isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page await page
@ -68,7 +68,7 @@ test("InputListComponent", async ({ page }) => {
.getByTestId("input-list-input-edit_metadata_indexing_include-1") .getByTestId("input-list-input-edit_metadata_indexing_include-1")
.fill("test1 test1 test1 test1"); .fill("test1 test1 test1 test1");
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page await page
.getByTestId("input-list-input_metadata_indexing_include-0") .getByTestId("input-list-input_metadata_indexing_include-0")
@ -93,7 +93,7 @@ test("InputListComponent", async ({ page }) => {
.click(); .click();
const plusButtonLocator = page.getByTestId( const plusButtonLocator = page.getByTestId(
"input-list-plus-btn_metadata_indexing_include-1" "input-list-plus-btn_metadata_indexing_include-1",
); );
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -164,12 +164,12 @@ test("InputListComponent", async ({ page }) => {
.click(); .click();
const plusButtonLocatorEdit0 = await page.getByTestId( const plusButtonLocatorEdit0 = await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-0" "input-list-plus-btn-edit_metadata_indexing_include-0",
); );
const elementCountEdit0 = await plusButtonLocatorEdit0?.count(); const elementCountEdit0 = await plusButtonLocatorEdit0?.count();
const plusButtonLocatorEdit2 = await page.getByTestId( const plusButtonLocatorEdit2 = await page.getByTestId(
"input-list-plus-btn-edit_metadata_indexing_include-2" "input-list-plus-btn-edit_metadata_indexing_include-2",
); );
const elementCountEdit2 = await plusButtonLocatorEdit2?.count(); const elementCountEdit2 = await plusButtonLocatorEdit2?.count();
@ -178,13 +178,13 @@ test("InputListComponent", async ({ page }) => {
} }
const minusButtonLocatorEdit1 = await page.getByTestId( const minusButtonLocatorEdit1 = await page.getByTestId(
"input-list-minus-btn-edit_metadata_indexing_include-1" "input-list-minus-btn-edit_metadata_indexing_include-1",
); );
const elementCountMinusEdit1 = await minusButtonLocatorEdit1?.count(); const elementCountMinusEdit1 = await minusButtonLocatorEdit1?.count();
const minusButtonLocatorEdit2 = await page.getByTestId( const minusButtonLocatorEdit2 = await page.getByTestId(
"input-list-minus-btn-edit_metadata_indexing_include-2" "input-list-minus-btn-edit_metadata_indexing_include-2",
); );
const elementCountMinusEdit2 = await minusButtonLocatorEdit2?.count(); const elementCountMinusEdit2 = await minusButtonLocatorEdit2?.count();

View file

@ -39,6 +39,12 @@ test("IntComponent", async ({ page }) => {
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.getByTestId("showmax_tokens").click();
await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("int-input-max_tokens").click(); await page.getByTestId("int-input-max_tokens").click();
await page await page
.getByTestId("int-input-max_tokens") .getByTestId("int-input-max_tokens")
@ -154,7 +160,7 @@ test("IntComponent", async ({ page }) => {
await page.locator('//*[@id="showtemperature"]').isChecked(), await page.locator('//*[@id="showtemperature"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
const plusButtonLocator = page.getByTestId("int-input-max_tokens"); const plusButtonLocator = page.getByTestId("int-input-max_tokens");
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -177,7 +183,7 @@ test("IntComponent", async ({ page }) => {
expect(false).toBeTruthy(); expect(false).toBeTruthy();
} }
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("int-input-max_tokens").click(); await page.getByTestId("int-input-max_tokens").click();
await page.getByTestId("int-input-max_tokens").fill("3"); await page.getByTestId("int-input-max_tokens").fill("3");

View file

@ -83,7 +83,7 @@ test("KeypairListComponent", async ({ page }) => {
expect( expect(
await page.locator('//*[@id="showcredentials_profile_name"]').isChecked(), await page.locator('//*[@id="showcredentials_profile_name"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
const plusButtonLocator = page.locator('//*[@id="plusbtn0"]'); const plusButtonLocator = page.locator('//*[@id="plusbtn0"]');
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -108,7 +108,7 @@ test("KeypairListComponent", async ({ page }) => {
const elementKeyCount = await keyPairVerification?.count(); const elementKeyCount = await keyPairVerification?.count();
if (elementKeyCount === 1) { if (elementKeyCount === 1) {
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("div-generic-node").click(); await page.getByTestId("div-generic-node").click();

View file

@ -47,11 +47,11 @@ test("LangflowShortcuts", async ({ page }) => {
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click(); await page.getByTitle("zoom out").click();
await page.getByTestId("title-Ollama").click(); await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+Shift+A`); await page.keyboard.press(`${control}+Shift+A`);
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("title-Ollama").click(); await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+d`); await page.keyboard.press(`${control}+d`);
let numberOfNodes = await page.getByTestId("title-Ollama")?.count(); let numberOfNodes = await page.getByTestId("title-Ollama")?.count();
@ -71,7 +71,7 @@ test("LangflowShortcuts", async ({ page }) => {
expect(false).toBeTruthy(); expect(false).toBeTruthy();
} }
await page.getByTestId("title-Ollama").click(); await page.getByTestId("generic-node-title-arrangement").click();
await page.keyboard.press(`${control}+c`); await page.keyboard.press(`${control}+c`);
await page.getByTestId("title-Ollama").click(); await page.getByTestId("title-Ollama").click();

View file

@ -30,6 +30,8 @@ test("should able to see and interact with logs", async ({ page }) => {
await page.getByText("No Data Available", { exact: true }).isVisible(); await page.getByText("No Data Available", { exact: true }).isVisible();
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.getByText("Close").last().click();
await page await page
.getByTestId("popover-anchor-input-openai_api_key") .getByTestId("popover-anchor-input-openai_api_key")
.fill(process.env.OPENAI_API_KEY ?? ""); .fill(process.env.OPENAI_API_KEY ?? "");

View file

@ -189,5 +189,5 @@ test("NestedComponent", async ({ page }) => {
await page.locator('//*[@id="showtext_key"]').isChecked(), await page.locator('//*[@id="showtext_key"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
}); });

View file

@ -164,7 +164,7 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="showprompt"]').click(); await page.locator('//*[@id="showprompt"]').click();
expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeTruthy(); expect(await page.locator('//*[@id="showprompt"]').isChecked()).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("more-options-modal").click(); await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click(); await page.getByTestId("edit-button-modal").click();

View file

@ -26,7 +26,7 @@ test.describe("save component tests", () => {
// Read your file into a buffer. // Read your file into a buffer.
const jsonContent = readFileSync( const jsonContent = readFileSync(
"tests/end-to-end/assets/flow_group_test.json", "src/frontend/tests/end-to-end/assets/flow_group_test.json",
"utf-8", "utf-8",
); );

View file

@ -141,7 +141,6 @@ test("should add API-KEY", async ({ page }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByText("API Key Error").isVisible(); await page.getByText("API Key Error").isVisible();
await page.getByTestId("api-key-button-store").click();
await page await page
.getByPlaceholder("Insert your API Key") .getByPlaceholder("Insert your API Key")
.fill(process.env.STORE_API_KEY ?? ""); .fill(process.env.STORE_API_KEY ?? "");
@ -174,6 +173,9 @@ test("should like and add components and flows", async ({ page }) => {
await page.waitForTimeout(2000); await page.waitForTimeout(2000);
await page.getByText("API Key Error").isHidden(); await page.getByText("API Key Error").isHidden();
await page.waitForTimeout(2000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(5000); await page.waitForTimeout(5000);
const likedValue = await page const likedValue = await page

View file

@ -132,11 +132,13 @@ test("TextInputOutputComponent", async ({ page }) => {
await page.getByText("Outputs", { exact: true }).nth(1).click(); await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click(); await page.getByText("Text Output", { exact: true }).nth(2).click();
let contentOutput = await page.getByPlaceholder("Empty").inputValue(); let contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
expect(contentOutput).not.toBe(null); expect(contentOutput).not.toBe(null);
await page.keyboard.press("Escape"); await page.keyboard.press("Escape");
await page.getByText("Close", { exact: true }).last().click();
await page await page
.getByTestId("popover-anchor-input-input_value") .getByTestId("popover-anchor-input-input_value")
.nth(0) .nth(0)
@ -151,6 +153,6 @@ test("TextInputOutputComponent", async ({ page }) => {
await page.getByText("Outputs", { exact: true }).nth(1).click(); await page.getByText("Outputs", { exact: true }).nth(1).click();
await page.getByText("Text Output", { exact: true }).nth(2).click(); await page.getByText("Text Output", { exact: true }).nth(2).click();
contentOutput = await page.getByPlaceholder("Empty").inputValue(); contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
expect(contentOutput).not.toBe(null); expect(contentOutput).not.toBe(null);
}); });

View file

@ -48,7 +48,7 @@ test("ToggleComponent", async ({ page }) => {
await page.locator('//*[@id="showload_hidden"]').isChecked(), await page.locator('//*[@id="showload_hidden"]').isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTitle("fit view").click(); await page.getByTitle("fit view").click();
@ -130,7 +130,7 @@ test("ToggleComponent", async ({ page }) => {
await page.locator('//*[@id="showuse_multithreading"]').isChecked(), await page.locator('//*[@id="showuse_multithreading"]').isChecked(),
).toBeFalsy(); ).toBeFalsy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
const plusButtonLocator = page.getByTestId("toggle-load_hidden"); const plusButtonLocator = page.getByTestId("toggle-load_hidden");
const elementCount = await plusButtonLocator?.count(); const elementCount = await plusButtonLocator?.count();
@ -151,7 +151,7 @@ test("ToggleComponent", async ({ page }) => {
await page.getByTestId("toggle-edit-load_hidden").isChecked(), await page.getByTestId("toggle-edit-load_hidden").isChecked(),
).toBeTruthy(); ).toBeTruthy();
await page.locator('//*[@id="saveChangesBtn"]').click(); await page.getByText("Save Changes", { exact: true }).click();
await page.getByTestId("toggle-load_hidden").click(); await page.getByTestId("toggle-load_hidden").click();
expect( expect(