@forgeflowai/chat
Version:
This is an embeddable Chat widget for n8n. It allows the execution of AI-Powered Workflows through a Chat window.
42 lines (41 loc) • 1.46 kB
JavaScript
import { screen } from "@testing-library/vue";
import { defaultMountingTarget } from "@forgeflowai/chat/constants";
export function getMountingTarget(target = defaultMountingTarget) {
return document.querySelector(target);
}
export function getChatWindowWrapper() {
return document.querySelector(".chat-window-wrapper");
}
export function getChatWindowToggle() {
return document.querySelector(".chat-window-toggle");
}
export function getChatWrapper() {
return document.querySelector(".chat-wrapper");
}
export function getChatMessages() {
return document.querySelectorAll(".chat-message:not(.chat-message-typing)");
}
export function getChatMessage(index) {
const messages = getChatMessages();
return index < 0 ? messages[messages.length + index] : messages[index];
}
export function getChatMessageByText(text) {
return screen.queryByText(text, {
selector: ".chat-message:not(.chat-message-typing) .chat-message-markdown p"
});
}
export function getChatMessageTyping() {
return document.querySelector(".chat-message-typing");
}
export function getGetStartedButton() {
return document.querySelector(".chat-get-started .chat-button");
}
export function getChatInput() {
return document.querySelector(".chat-input");
}
export function getChatInputTextarea() {
return document.querySelector(".chat-input textarea");
}
export function getChatInputSendButton() {
return document.querySelector(".chat-input .chat-input-send-button");
}