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