Created
June 11, 2020 16:58
-
-
Save stfsy/e8ac5bbf53cde5ae2bb3a985e0ee063b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'use strict' | |
const BroccoliTestRunner = require('broccoli-test-runner') | |
const runner = new BroccoliTestRunner('test/fixtures') | |
const expect = require('chai').expect | |
const puppeteer = require('puppeteer') | |
describe('BroccoliInjectLivereload', () => { | |
let page = null | |
before(() => { | |
return runner.serve() | |
.then(() => puppeteer.launch({ headless: true })) | |
.then(browser => browser.newPage()) | |
.then(p => page = p) | |
}) | |
after(() => { | |
return runner.stop() | |
.then(() => page.browser().close()) | |
}) | |
it('should inject livereload tag into test.html', () => { | |
return page.goto('http://localhost:4200/test.html') | |
.then(() => { | |
return page.evaluate(() => document.querySelector("script").textContent) | |
}).then((text) => { | |
expect(text).to.contain("livereload.js") | |
}) | |
}) | |
it('should NOT inject livereload tag into index.html', () => { | |
return page.goto('http://localhost:4200/index.html') | |
.then(() => { | |
return page.evaluate(() => document.querySelector("script")) | |
}).then((text) => { | |
expect(text).to.be.null | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment