Skip to content

Commit 4b3a778

Browse files
authored
New chat icon (#1766)
* New chat icon * An empty commit to trigger Konflux build
1 parent 52a88c1 commit 4b3a778

File tree

9 files changed

+140
-161
lines changed

9 files changed

+140
-161
lines changed

aap_chatbot/package-lock.json

Lines changed: 35 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aap_chatbot/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
],
1919
"dependencies": {
2020
"@microsoft/fetch-event-source": "^2.0.1",
21-
"@patternfly/chatbot": "^6.3.0-prerelease.25",
22-
"@patternfly/react-table": "^6.1.0",
21+
"@patternfly/chatbot": "^6.4.0-prerelease.22",
22+
"@patternfly/react-table": "^6.3.1",
2323
"@types/jest": "^27.5.2",
2424
"@types/node": "^22.13.1",
2525
"@types/react": "^18.3.7",

aap_chatbot/src/AnsibleChatbot/AnsibleChatbot.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import MessageBox from "@patternfly/chatbot/dist/dynamic/MessageBox";
1010
import Message from "@patternfly/chatbot/dist/dynamic/Message";
1111
import ChatbotHeader, {
1212
ChatbotHeaderActions,
13+
ChatbotHeaderNewChatButton,
1314
} from "@patternfly/chatbot/dist/dynamic/ChatbotHeader";
1415

1516
import "./AnsibleChatbot.scss";
@@ -233,6 +234,10 @@ export const AnsibleChatbot: React.FunctionComponent<ChatbotContext> = (
233234
/>
234235
)}
235236
</ChatbotHeaderActions>
237+
<ChatbotHeaderNewChatButton
238+
data-testid="header-new-chat-button"
239+
onClick={() => setCurrentConversation(undefined, [])}
240+
/>
236241
</ChatbotHeaderMain>
237242
</ChatbotHeader>
238243
{alertMessage && (

aap_chatbot/src/App.test.tsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ test("Basic chatbot interaction", async () => {
398398
assert(copiedString.includes("Create variables"));
399399
assert(copiedString.includes("https://"));
400400

401-
await page.getByLabelText("Toggle menu").click();
401+
await page.getByLabelText("Chat history menu").click();
402402
const newChatButton = page
403403
.getByText("New chat")
404404
.element() as HTMLButtonElement;
@@ -426,9 +426,33 @@ test("Basic chatbot interaction", async () => {
426426
.toBeVisible();
427427
await expect.element(view.getByText("Create variables")).toBeVisible();
428428

429-
await page.getByLabelText("Toggle menu").click();
429+
const newChatIcon = page.getByTestId("header-new-chat-button");
430+
await newChatIcon.click();
430431

431-
const filterHistory = page.getByLabelText("Filter menu items");
432+
await expect
433+
.element(
434+
page.getByText(
435+
"In Ansible, the precedence of variables is determined by the order...",
436+
),
437+
)
438+
.not.toBeInTheDocument();
439+
await expect
440+
.element(view.getByText("Create variables"))
441+
.not.toBeInTheDocument();
442+
443+
await sendMessage("Tell me about Ansible.");
444+
await expect
445+
.element(
446+
view.getByText(
447+
"In Ansible, the precedence of variables is determined by the order...",
448+
),
449+
)
450+
.toBeVisible();
451+
await expect.element(view.getByText("Create variables")).toBeVisible();
452+
453+
await page.getByLabelText("Chat history menu").click();
454+
455+
const filterHistory = page.getByLabelText("Search previous conversations");
432456
await expect.element(filterHistory).toBeVisible();
433457

434458
await filterHistory.fill("Some non-existent string");

ansible_ai_connect_chatbot/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The text version of the report is shown on the console,
4848
while the HTML version and the `lcov.info` file are saved
4949
in the `coverage` sub-directory.
5050

51+
5152
## Test Chatbot in Local environment
5253

5354
**Chatbot is enabled when all of

0 commit comments

Comments
 (0)