Skip to content

Commit

Permalink
test: test delete brain
Browse files Browse the repository at this point in the history
  • Loading branch information
mamadoudicko committed Oct 6, 2023
1 parent dc88ac6 commit e59858d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ export const MentionItem = ({
trigger,
}: MentionItemProps): JSX.Element => {
return (
<div className="relative inline-block w-fit-content">
<div
className="relative inline-block w-fit-content"
data-testid="mention-item"
>
<div className="flex items-center bg-gray-300 mr-2 text-gray-600 rounded-2xl py-1 px-2">
<span className="flex-grow">{`${trigger ?? ""}${text}`}</span>
<MdRemoveCircleOutline
className="cursor-pointer absolute top-0 right-0 mt-0 mr-0"
data-testid="remove-mention"
onClick={onRemove}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const ChatsListItem = ({ chat }: ChatsListItemProps): JSX.Element => {
className="p-5 hover:text-red-700"
type="button"
onClick={() => void deleteChat()}
data-testid="delete-chat-button"
>
<FiTrash2 />
</button>
Expand Down
2 changes: 1 addition & 1 deletion frontend/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ test.describe(createBrainTests);

test.describe(crawlTests);

test.describe.skip(chatTests);
test.describe(chatTests);
13 changes: 0 additions & 13 deletions frontend/e2e/tests/chat.ts

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/e2e/tests/chat/chat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test } from "@playwright/test";

import { testChat } from "./utils/testChat";
import { testDeleteChats } from "./utils/testDeleteChats";
import { testSelectBrain } from "./utils/testSelectBrain";
import { testUnplugChat } from "./utils/testUnplugChat";
import { login } from "../../utils/login";
Expand All @@ -11,5 +12,6 @@ export const chatTests = (): void => {
await testChat(page);
await testUnplugChat(page);
await testSelectBrain(page);
await testDeleteChats(page);
});
};
1 change: 1 addition & 0 deletions frontend/e2e/tests/chat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./chat";
11 changes: 11 additions & 0 deletions frontend/e2e/tests/chat/utils/testDeleteChats.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { expect, Page } from "@playwright/test";

export const testDeleteChats = async (page: Page): Promise<void> => {
const deleteChatButtons = await page.getByTestId("delete-chat-button").all();

for (const button of deleteChatButtons) {
await button.click();
}

expect((await page.getByTestId("chats-list-item").all()).length === 0);
};

0 comments on commit e59858d

Please sign in to comment.