import{newE2EPage}from"@stencil/core/testing";describe("presto-email-overlay-controller",(()=>{let e,a;beforeEach((async()=>{e=await newE2EPage(),await e.setContent("<presto-email-overlay-controller></presto-email-overlay-controller>"),a=await e.find("presto-email-overlay-controller")})),it("renders",(async()=>{expect(a).toHaveClass("hydrated")})),it("Should only show after time has passed",(async()=>{await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:10},e.currentTime=0,e.duration=100})),await e.waitForChanges();let a=await e.find("presto-email-overlay-controller presto-email-overlay-ui");expect(a).toBe(null),await e.$eval("presto-email-overlay-controller",(e=>{e.currentTime=11})),await e.waitForChanges(),a=await e.find("presto-email-overlay-controller presto-email-overlay-ui"),expect(a).not.toBe(null),await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:100},e.currentTime=99.99})),a=await e.find("presto-email-overlay-controller presto-email-overlay-ui"),expect(a).not.toBe(null)})),it("Displays a skip or rewatch button",(async()=>{await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:0},e.currentTime=0,e.duration=100})),await e.waitForChanges();const a=await e.find("presto-email-overlay-controller presto-email-overlay-ui");let o=a.shadowRoot.querySelector(".skip");expect(o).toBeDefined();let t=a.shadowRoot.querySelector(".rewatch");expect(t).toBeNull(),await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:0,show_skip:!0,show_rewatch:!0},e.currentTime=0,e.duration=100})),await e.waitForChanges(),o=a.shadowRoot.querySelector(".skip"),expect(o).toBeDefined(),t=a.shadowRoot.querySelector(".rewatch"),expect(t).toBeNull(),await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:0,show_skip:!0,show_rewatch:!0},e.ended=!0,e.currentTime=100})),await e.waitForChanges(),o=a.shadowRoot.querySelector(".skip"),expect(o).toBeNull(),await e.$eval("presto-email-overlay-controller",(e=>{e.emailCollection={enabled:!0,percentage:0,show_skip:!0,show_rewatch:!0},e.ended=!0,e.currentTime=100})),await e.waitForChanges(),o=a.shadowRoot.querySelector(".skip"),expect(o).toBeNull(),t=a.shadowRoot.querySelector(".rewatch"),expect(t).toBeDefined()}))}));