diff --git a/cypress/e2e/tests.cy.ts b/cypress/e2e/tests.cy.ts index 9e6c0214..70358e95 100644 --- a/cypress/e2e/tests.cy.ts +++ b/cypress/e2e/tests.cy.ts @@ -11,7 +11,7 @@ describe("Chat Bot Test Suite", () => { it("Opens the chat window", () => { cy.get(".rcb-toggle-button").click(); - cy.get(".rcb-window-open").should("exist"); + cy.get(".rcb-window-open").should("exist"); }); it("Sends name and verifies bot reply", () => { @@ -116,20 +116,24 @@ describe("Chat Bot Test Suite", () => { it("Send food and verifies bot reply", () => { cy.get(".bold").should('have.css', 'font-weight') - .then((fontWeight) => +fontWeight).and('be.gte', 700) + .then((fontWeight) => +fontWeight).and('be.gte', 700) cy.get(".rcb-chat-input-textarea") .should("be.visible") .type("pasta{enter}"); cy.get(".rcb-bot-message").contains("pasta? Interesting.").should("be.visible"); }); - it("Send image and verifies bot reply", () => { + it("Sends image and verifies bot reply, checks the toast message and clicks on it", () => { const filePath = path.resolve("./assets/logo.png"); cy.get(".rcb-attach-input").should("exist").attachFile(filePath); cy.get(".rcb-bot-message").should( "contain.text", "Thank you for sharing! See you again!" ); + + cy.get(".rcb-toast-prompt").should("be.visible"); + cy.get(".rcb-toast-prompt").click(); + cy.get(".rcb-toast-prompt").should("not.exist"); }); it("Sends goodbye, scrolls away, and verifies new message prompt", () => { diff --git a/cypress/fixtures/templates/ChatBotApp.tsx b/cypress/fixtures/templates/ChatBotApp.tsx index 23ef3211..69f65905 100644 --- a/cypress/fixtures/templates/ChatBotApp.tsx +++ b/cypress/fixtures/templates/ChatBotApp.tsx @@ -110,9 +110,12 @@ function App() { path: "ask_image" }, ask_image: { - message: (params: Params) => `${params.userInput}? Interesting. Could you share an image of that?`, + message: (params: Params) => + `${params.userInput}? Interesting. Could you share an image of that?`, file: (params: Params) => console.log(params.files), - path: "end" + function: (params: Params) => + params.showToast("Image is uploaded successfully!"), + path: "end", }, end: { message: "Thank you for sharing! See you again!", diff --git a/src/App.tsx b/src/App.tsx index a83dfce7..ceef700a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -110,9 +110,12 @@ function App() { path: "ask_image" }, ask_image: { - message: (params: Params) => `${params.userInput}? Interesting. Could you share an image of that?`, + message: (params: Params) => + `${params.userInput}? Interesting. Could you share an image of that?`, file: (params: Params) => console.log(params.files), - path: "end" + function: (params: Params) => + params.showToast("Image is uploaded successfully!"), + path: "end", }, end: { message: "Thank you for sharing! See you again!",