17
describe("Host communication", () => {
19
cy.visit("hostframe.html");
20
cy.get("#toolbar button").should("have.length", 10);
23
cy.waitForScriptFinish()
27
it("handles a host theme message", () => {
28
cy.get("iframe").iframe(() => {
29
cy.prepForElementSnapshots()
32
cy.get("iframe").first().matchImageSnapshot("theme-message-before");
33
cy.get("#toolbar").contains("Send Theme").click();
34
cy.get("iframe").first().matchImageSnapshot("theme-message-after");
37
it("handles a host rerun script message", () => {
38
cy.get("#toolbar").contains("Rerun Script").click();
40
cy.get("iframe").iframe(() => {
41
cy.get("[data-testid='stStatusWidget']").should("exist")
45
it("handles a host stop script message", () => {
47
cy.get("#toolbar").contains("Rerun Script").click();
49
cy.get("iframe").iframe(() => {
50
cy.get("[data-testid='stStatusWidget']").should("exist")
54
cy.get("#toolbar").contains("Stop Script").click();
56
cy.get("iframe").iframe(() => {
57
cy.get("[data-testid='stStatusWidget']").should("not.exist")
61
it("handles a host close modal message", () => {
65
cy.get("#MainMenu > button").click()
67
cy.getIndexed('[data-testid="main-menu-list"] > ul', 1).click({ force: true })
68
cy.get("div[role='dialog']").should("exist")
71
cy.get("#toolbar").contains("Close modal").click();
73
cy.get("iframe").iframe(() => {
74
cy.get("div[role='dialog']").should("not.exist")
78
it("handles a host menu item message", () => {
80
cy.get("#toolbar").contains("Add Menu Item").click({ force: true });
84
cy.get("#MainMenu > button").click()
86
cy.getIndexed('[data-testid="main-menu-list"] > ul', 4).should("have.text", "Adopt a Corgi")
88
cy.get(".main").type('{esc}')
92
it("handles a host toolbar item message", () => {
94
cy.get("#toolbar").contains("Add Toolbar Item").click();
98
cy.get('.stActionButton').should("exist")
99
cy.getIndexed('[data-testid="stActionButton"]', 0).should("have.text", "Favorite")
100
cy.getIndexed('[data-testid="stActionButton"]', 1).should("have.text", "Share")
104
it("displays the toolbar with horizontal buttons", () => {
105
cy.get("iframe").first().matchImageSnapshot("toolbarActions");
108
it("handles a hide sidebar nav message", () => {
109
cy.get("iframe").iframe(() => {
111
cy.get("[data-testid='stSidebarNav']").should("exist")
114
cy.get("#toolbar").contains("Hide Sidebar Nav").click();
115
cy.get("iframe").iframe(() => {
117
cy.get("[data-testid='stSidebarNav']").should("not.exist")
121
it("handles a host sidebar downshift message", () => {
123
cy.get("#toolbar").contains("Sidebar Chevron Downshift").click();
127
cy.get("[data-testid='stSidebar'] button").click()
129
cy.get("[data-testid='collapsedControl']").should("have.css", "top", "50px")