Created
December 16, 2017 15:22
-
-
Save CompuIves/de421c8a81df791fd225303746fdd47f to your computer and use it in GitHub Desktop.
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
const puppeteer = require('puppeteer'); | |
let browser = puppeteer.launch({ | |
args: ['--no-sandbox', '--disable-setuid-sandbox'], | |
}); | |
async function test(url) { | |
browser = await browser; | |
const page = await browser.newPage(); | |
const a = Date.now(); | |
await page.goto(url, { | |
timeout: 60000, | |
}); | |
await page.waitForSelector('#root', { timeout: 10000 }); | |
console.log(Date.now() - a); | |
return Date.now() - a; | |
} | |
(async function go() { | |
const results = []; | |
for (let i = 0; i < 10; i++) { | |
const res = await test('https://new.codesandbox.io'); | |
results.push(res); | |
} | |
browser.close(); | |
const total = results.reduce((p, n) => p + n, 0); | |
const avg = total / results.length; | |
console.log('AVG: ' + avg); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment