fix page.injectFile and add test. (#52)

This line within `injectFile` wasn't doing much of anything: 

```js
let expression = fs.readFile(filePath, 'utf8', (err, data) => callback({err, data}));
```

* That's fixed.
* A path error in examples/features.js is fixed.
* Test added for injectFile.
This commit is contained in:
Paul Irish
2017-07-06 16:09:23 -07:00
committed by Andrey Lushnikov
parent 3d3e8dd038
commit 6c7ae41ae6
4 changed files with 18 additions and 6 deletions

View File

@@ -104,6 +104,15 @@ describe('Puppeteer', function() {
}));
});
describe('Page.injectFile', function() {
it('should fail when navigating to bad url', SX(async function() {
const helloPath = path.join(__dirname, './assets/injectedfile.js');
await page.injectFile(helloPath);
const result = await page.evaluate(() => __injected);
expect(result).toBe(42);
}));
});
describe('Frame.evaluate', function() {
let FrameUtils = require('./frame-utils');
it('should have different execution contexts', SX(async function() {