Skip to content

Commit

Permalink
Remove all VW and parity specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpiatek committed Dec 14, 2023
1 parent ec48e43 commit 49a8f15
Show file tree
Hide file tree
Showing 23 changed files with 316 additions and 1,396 deletions.
10 changes: 0 additions & 10 deletions cypress/e2e/core/code/parity.cy.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
exports[`Chat button state > react > the button is inactive without Hubspot widget #0`] = `
<button
type="button"
class="ui-btn-secondary self-start mt-16"
disabled=""
data-id="open-chat-widget"
data-enabled-label="Start a live chat"
data-disabled-label="Live chat unavailable"
>
Live chat unavailable
</button>
`;

exports[`Chat button state > vw > the button is inactive without Hubspot widget #0`] = `
exports[`Chat button state > the button is inactive without Hubspot widget #0`] = `
<button
type="button"
class="ui-btn-secondary self-start mt-16"
Expand Down
83 changes: 38 additions & 45 deletions cypress/e2e/core/contact_footer/behaviour.cy.js
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");
});
});
28 changes: 0 additions & 28 deletions cypress/e2e/core/contact_footer/parity.cy.js

This file was deleted.

21 changes: 3 additions & 18 deletions cypress/e2e/core/contact_footer/snapshots.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@ import { fixSnapshotSpec } from "../../../support";
beforeEach(fixSnapshotSpec(__filename));

describe("Chat button state", () => {
const url = "/components/contact-footer";
const sharedSpecs = (url) => {
beforeEach(() => {
cy.visit(url);
});

it("the button is inactive without Hubspot widget", () => {
cy.get("[data-id='open-chat-widget']").toMatchSnapshot();
});
};

beforeEach(() => {
cy.viewport("macbook-16");
});

describe("react", () => {
sharedSpecs(url);
cy.visit("/components/contact-footer");
});

describe("vw", () => {
sharedSpecs(`${url}?iframework=vw`);
it("the button is inactive without Hubspot widget", () => {
cy.get("[data-id='open-chat-widget']").toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports[`Cookie Message Snapshot Test > react > the message component is visible #0`] = `
exports[`Cookie Message Snapshot Test > the message component is visible #0`] = `
<div class="ui-cookie-message">
<p class="ui-text-p2 pr-32">
<a href="/privacy" class="underline">How we use cookies</a> to improve your
Expand Down
14 changes: 3 additions & 11 deletions cypress/e2e/core/cookie_message/snapshots.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ import { fixSnapshotSpec } from "../../../support";
beforeEach(fixSnapshotSpec(__filename));

describe("Cookie Message Snapshot Test", () => {
const url = "/components/cookie-message";
const sharedSpecs = (url) => {
beforeEach(() => cy.visit(url));

it("the message component is visible", () => {
cy.get(".ui-cookie-message").first().toMatchSnapshot();
});
};

beforeEach(() => {
cy.viewport("macbook-16");
cy.visit("/components/cookie-message");
});

describe("react", () => {
sharedSpecs(url);
it("the message component is visible", () => {
cy.get(".ui-cookie-message").first().toMatchSnapshot();
});
});
Loading

0 comments on commit 49a8f15

Please sign in to comment.