Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test cases showing and dismissing of toasts #280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cypress/e2e/tests.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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", () => {
Expand Down
7 changes: 5 additions & 2 deletions cypress/fixtures/templates/ChatBotApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand Down
7 changes: 5 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand Down
Loading