diff --git a/cypress/e2e/utils.ts b/cypress/e2e/utils.ts index ac7c8c1..b80acdd 100644 --- a/cypress/e2e/utils.ts +++ b/cypress/e2e/utils.ts @@ -4,7 +4,11 @@ const getPlayer = () => { }; const preparePage = (pluginConf = {}, playbackConf = {}) => { - cy.visit('index.html'); + cy.visit('index.html', { + onBeforeLoad: (contentWindow: any) => { + contentWindow._TEST_ENV = true; + } + }); return cy.window().then(win => { try { // @ts-ignore @@ -19,7 +23,7 @@ const preparePage = (pluginConf = {}, playbackConf = {}) => { }, playback: {muted: true, autoplay: true, ...playbackConf}, plugins: { - timeline: {} + timeline: pluginConf } }); return kalturaPlayer.loadMedia({entryId: '0_wifqaipd'}); diff --git a/src/timeline-manager.tsx b/src/timeline-manager.tsx index 441fa72..2da5040 100644 --- a/src/timeline-manager.tsx +++ b/src/timeline-manager.tsx @@ -74,8 +74,8 @@ class TimelineManager { this._getThumbnailInfoFn = fn; }, addSeekBarPreview: this._addSeekBarPreview, - // Expose the timelineManager to Cypress for testing purposes - ...(window.Cypress ? {timelineManager: this} : {}) + // Expose entire timelineManager for testing purposes + ...((window as any)._TEST_ENV ? {timelineManager: this} : {}) }; }