-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from EkoLabs/overriding-host-param
Added the ability to override the URL's host via options.
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable new-cap */ | ||
/* eslint-disable no-magic-numbers */ | ||
const puppeteer = require('puppeteer'); | ||
const testingInstanceId = '42rvvp6tpn'; | ||
|
||
let browser; | ||
beforeAll(async() => { | ||
browser = await puppeteer.launch({ | ||
headless: true, | ||
args: ['--disable-features=site-per-process'] | ||
}); | ||
}, 10000); | ||
|
||
afterAll(async() => { | ||
await browser.close(); | ||
}, 15000); | ||
|
||
jest.setTimeout(999999); | ||
|
||
describe('ekoPlayer.load()', () => { | ||
it(`ekoPlayer.load(id, { host: 'directembed.eko.com' })) | ||
check host override `, async() => { | ||
const page = await browser.newPage(); | ||
await page.goto(`file://${__dirname}/../app.html`); | ||
|
||
await page.evaluate((instanceId) => { | ||
let ekoPlayer = new EkoPlayer('#ekoPlayerEl', '3.0'); | ||
ekoPlayer.load(instanceId, { | ||
iframeAttributes: { id: 'testFrame' }, | ||
host: 'directembed.eko.com' | ||
}); | ||
}, testingInstanceId); | ||
|
||
// Check host | ||
const host = await page.evaluate(() => { | ||
const iframeSrc = document.querySelector('iframe').getAttribute('src'); | ||
const iframeURL = new URL(iframeSrc); | ||
return iframeURL.host; | ||
}); | ||
|
||
expect(host).toBeDefined(); | ||
expect(host).toEqual('directembed.eko.com'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters