-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
316 additions
and
1,396 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
15 changes: 1 addition & 14 deletions
15
cypress/e2e/core/contact_footer/__snapshots__/snapshots.cy.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,51 @@ | ||
describe("Live Chat button", () => { | ||
const url = "/components/contact-footer"; | ||
const sharedExample = (url) => { | ||
it("should be active when hubspot widget is defined and widget is present", () => { | ||
cy.visit(url, { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: { open: () => {} } }; | ||
cy.spy(window.HubSpotConversations.widget, "open").as("widgetOpen"); | ||
}, | ||
}); | ||
|
||
cy.document().then((document) => { | ||
const fakeChat = document.createElement("div"); | ||
fakeChat.id = "hubspot-messages-iframe-container"; | ||
document.body.append(fakeChat); | ||
}); | ||
|
||
cy.get("[data-id='open-chat-widget']").contains("Start a live chat"); | ||
cy.get("[data-id='open-chat-widget']").trigger("click"); | ||
cy.get("@widgetOpen").should("be.called"); | ||
beforeEach(() => { | ||
cy.visit("/components/contact-footer"); | ||
}); | ||
|
||
it("should be active when hubspot widget is defined and widget is present", () => { | ||
cy.visit("/components/contact-footer", { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: { open: () => {} } }; | ||
cy.spy(window.HubSpotConversations.widget, "open").as("widgetOpen"); | ||
}, | ||
}); | ||
|
||
it("should be inactive when hubspot widget is undefined", () => { | ||
cy.visit(url, { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: undefined }; | ||
}, | ||
}); | ||
cy.document().then((document) => { | ||
const fakeChat = document.createElement("div"); | ||
fakeChat.id = "hubspot-messages-iframe-container"; | ||
document.body.append(fakeChat); | ||
}); | ||
|
||
cy.document().then((document) => { | ||
const fakeChat = document.createElement("div"); | ||
fakeChat.id = "hubspot-messages-iframe-container"; | ||
document.body.append(fakeChat); | ||
}); | ||
cy.get("[data-id='open-chat-widget']").contains("Start a live chat"); | ||
cy.get("[data-id='open-chat-widget']").trigger("click"); | ||
cy.get("@widgetOpen").should("be.called"); | ||
}); | ||
|
||
cy.get("[data-id='open-chat-widget']").contains("Live chat unavailable"); | ||
it("should be inactive when hubspot widget is undefined", () => { | ||
cy.visit("/components/contact-footer", { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: undefined }; | ||
}, | ||
}); | ||
|
||
it("should be inactive when hubspot widget is not on the page", () => { | ||
cy.visit(url, { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: { open: () => {} } }; | ||
cy.spy(window.HubSpotConversations.widget, "open").as("widgetOpen"); | ||
}, | ||
}); | ||
|
||
cy.get("[data-id='open-chat-widget']").contains("Live chat unavailable"); | ||
cy.document().then((document) => { | ||
const fakeChat = document.createElement("div"); | ||
fakeChat.id = "hubspot-messages-iframe-container"; | ||
document.body.append(fakeChat); | ||
}); | ||
}; | ||
|
||
describe("react", () => { | ||
sharedExample(url); | ||
cy.get("[data-id='open-chat-widget']").contains("Live chat unavailable"); | ||
}); | ||
|
||
describe("vw", () => { | ||
sharedExample(`${url}?framework=vw`); | ||
it("should be inactive when hubspot widget is not on the page", () => { | ||
cy.visit("/components/contact-footer", { | ||
onBeforeLoad(window) { | ||
window.HubSpotConversations = { widget: { open: () => {} } }; | ||
cy.spy(window.HubSpotConversations.widget, "open").as("widgetOpen"); | ||
}, | ||
}); | ||
|
||
cy.get("[data-id='open-chat-widget']").contains("Live chat unavailable"); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
cypress/e2e/core/cookie_message/__snapshots__/snapshots.cy.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.