mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 07:59:00 +03:00
test: add e2e for crawling (#1288)
* feat: update translations * fix: update createBrain tests * test: add crawl e2e test
This commit is contained in:
parent
36fd146fed
commit
a1e6d400b2
@ -36,7 +36,7 @@ export const KnowledgeToFeed = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex-col w-full relative">
|
||||
<div className="flex-col w-full relative" data-testid="feed-card">
|
||||
<div className="flex flex-1 justify-between">
|
||||
<AddBrainModal />
|
||||
<Button
|
||||
|
@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FaBrain } from "react-icons/fa";
|
||||
|
||||
import { sidebarLinkStyle } from "@/app/chat/components/ChatsList/components/ChatsListItem/styles/SidebarLinkStyle";
|
||||
@ -6,14 +7,16 @@ import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainConte
|
||||
|
||||
export const BrainManagementButton = (): JSX.Element => {
|
||||
const { currentBrainId } = useBrainContext();
|
||||
const { t } = useTranslation("brain");
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={`/brains-management/${currentBrainId ?? ""}`}
|
||||
className={sidebarLinkStyle}
|
||||
data-testid="brain-management-button"
|
||||
>
|
||||
<FaBrain className="w-8 h-8" />
|
||||
<span>My Brains</span>
|
||||
<span>{t("myBrains")}</span>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
@ -6,6 +6,6 @@ import { uploadTests } from "./tests/upload";
|
||||
|
||||
test.describe(createBrainTests);
|
||||
|
||||
test.describe.skip(uploadTests);
|
||||
test.describe(uploadTests);
|
||||
|
||||
test.describe.skip(chatTests);
|
||||
|
@ -5,7 +5,7 @@ import { login } from "../utils/login";
|
||||
export const createBrainTests = (): void => {
|
||||
test("create brain", async ({ page }) => {
|
||||
await login(page);
|
||||
await page.getByTestId("brain-management-button").first().click();
|
||||
await page.getByTestId("brain-management-button").click();
|
||||
await page.getByTestId("add-brain-button").click();
|
||||
await page.getByTestId("brain-name").fill("Test brain");
|
||||
await page.getByTestId("create-brain-submit-button").click();
|
||||
|
@ -3,17 +3,16 @@ import { test } from "@playwright/test";
|
||||
import { login } from "../utils/login";
|
||||
|
||||
export const uploadTests = (): void => {
|
||||
test("upload", async ({ page }) => {
|
||||
test("it should be able to add url to crawl", async ({ page }) => {
|
||||
await login(page);
|
||||
await page.goto("/chat");
|
||||
await page.getByTestId("upload-button").click();
|
||||
await page
|
||||
.getByRole("button", {
|
||||
name: "Drag and drop files here, or click to browse",
|
||||
})
|
||||
.click();
|
||||
await page.getByPlaceholder("Insert website URL").click();
|
||||
await page.getByPlaceholder("Insert website URL").fill("https://quivr.app");
|
||||
await page.getByPlaceholder("Insert website URL").press("Enter");
|
||||
await page.getByTestId("feed-card").isVisible();
|
||||
await page.getByTestId("urlToCrawlInput").click();
|
||||
await page.getByTestId("urlToCrawlInput").fill("https://quivr.app");
|
||||
await page.getByTestId("urlToCrawlInput").press("Enter");
|
||||
await page.getByTestId("urlToCrawlInput").fill("https://google.fr");
|
||||
await page.getByTestId("urlToCrawlInputSubmit").click();
|
||||
await page.getByTestId("submit-feed-button").click();
|
||||
await page.getByTestId("feed-card").isHidden();
|
||||
});
|
||||
};
|
||||
|
@ -20,5 +20,5 @@ export const login = async (page: Page): Promise<void> => {
|
||||
await page.getByPlaceholder("Email").fill(email);
|
||||
await page.getByPlaceholder("Password").fill(password);
|
||||
await page.getByTestId("submit-login").click();
|
||||
await page.waitForURL(/chat/);
|
||||
await page.getByTestId("chat-page").isVisible();
|
||||
};
|
||||
|
@ -33,6 +33,7 @@ export const KnowledgeToFeedInput = ({
|
||||
disabled={knowledgeToFeed.length === 0}
|
||||
className="rounded-xl bg-primary border-white"
|
||||
onClick={() => void feedBrain()}
|
||||
data-testid="submit-feed-button"
|
||||
>
|
||||
{t("feed_form_submit_button", { ns: "upload" })}
|
||||
</Button>
|
||||
|
@ -25,12 +25,13 @@ export const Crawler = (): JSX.Element => {
|
||||
name="crawlurl"
|
||||
ref={urlInputRef}
|
||||
type="text"
|
||||
data-testid="urlToCrawlInput"
|
||||
placeholder={t("webSite", { ns: "upload" })}
|
||||
className="w-full"
|
||||
value={urlToCrawl}
|
||||
onChange={(e) => setUrlToCrawl(e.target.value)}
|
||||
icon={
|
||||
<Button variant={"tertiary"}>
|
||||
<Button data-testid="urlToCrawlInputSubmit" variant={"tertiary"}>
|
||||
<MdSend />
|
||||
</Button>
|
||||
}
|
||||
|
@ -3,7 +3,11 @@ import Link from "next/link";
|
||||
|
||||
export const Logo = (): JSX.Element => {
|
||||
return (
|
||||
<Link href={"/chat"} className="flex items-center gap-4">
|
||||
<Link
|
||||
data-testid="app-logo"
|
||||
href={"/chat"}
|
||||
className="flex items-center gap-4"
|
||||
>
|
||||
<Image
|
||||
className="rounded-full"
|
||||
src={"/logo.png"}
|
||||
|
@ -23,5 +23,6 @@ export default defineConfig({
|
||||
process.env.NODE_ENV === "production"
|
||||
? "yarn run build && yarn run start -p 3003"
|
||||
: "yarn run dev -p 3003",
|
||||
url: process.env.NEXT_PUBLIC_E2E_URL,
|
||||
},
|
||||
});
|
||||
|
@ -45,5 +45,6 @@
|
||||
"set_brain_status_to_private_modal_description":"Every Quivr users won't be able to use this brain anymore and they won't see it in the brain library.",
|
||||
"confirm_set_brain_status_to_private":"Yes, set as private",
|
||||
"cancel_set_brain_status_to_private":"No, keep it public",
|
||||
"empty_brain_description":"No description"
|
||||
"empty_brain_description":"No description",
|
||||
"myBrains":"My Brains"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"confirm_set_brain_status_to_private": "Sí, establecer como privado",
|
||||
"cancel_set_brain_status_to_private": "No, mantenerlo público",
|
||||
"brain_management_button_label": "Gestionar cerebro",
|
||||
"empty_brain_description":"Sin descripción"
|
||||
"empty_brain_description":"Sin descripción",
|
||||
"myBrains": "Mis cerebros"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"confirm_set_brain_status_to_private": "Oui, définir comme privé",
|
||||
"cancel_set_brain_status_to_private": "Non, le laisser public",
|
||||
"brain_management_button_label": "Gestion des cerveaux",
|
||||
"empty_brain_description":"Pas de description"
|
||||
"empty_brain_description":"Pas de description",
|
||||
"myBrains": "Mes cerveaux"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"confirm_set_brain_status_to_private": "Sim, definir como privado",
|
||||
"cancel_set_brain_status_to_private": "Não, mantê-lo público",
|
||||
"brain_management_button_label": "Gerenciamento de cérebros",
|
||||
"empty_brain_description":"Sem descrição"
|
||||
"empty_brain_description":"Sem descrição",
|
||||
"myBrains": "Meus cérebros"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"confirm_set_brain_status_to_private": "Да, установить как частное",
|
||||
"cancel_set_brain_status_to_private": "Нет, оставить общедоступным",
|
||||
"brain_management_button_label": "Управление мозгом",
|
||||
"empty_brain_description": "Нет описания"
|
||||
"empty_brain_description": "Нет описания",
|
||||
"myBrains": "Мои мозги"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"confirm_set_brain_status_to_private": "是的,设为私有",
|
||||
"cancel_set_brain_status_to_private": "不,保持为公开",
|
||||
"brain_management_button_label": "管理",
|
||||
"empty_brain_description": "无描述"
|
||||
"empty_brain_description": "无描述",
|
||||
"myBrains": "我的大脑"
|
||||
}
|
Loading…
Reference in New Issue
Block a user