Skip to content
Snippets Groups Projects
Commit 5638ae47 authored by Nayeem Rahman's avatar Nayeem Rahman
Browse files

WIP debug

parent 4639b745
Branches e2e-benchmark
No related tags found
No related merge requests found
...@@ -4,16 +4,23 @@ const appUrl = process.env.APP_URL ...@@ -4,16 +4,23 @@ const appUrl = process.env.APP_URL
const peerIndex = parseInt(process.env.PEER_INDEX) const peerIndex = parseInt(process.env.PEER_INDEX)
const numPeers = parseInt(process.env.NUM_PEERS) const numPeers = parseInt(process.env.NUM_PEERS)
const syncTimeout = numPeers * 4000 const syncTimeout = numPeers * 6000
;(async () => { ;(async () => {
const browser = await puppeteer.launch() const browser = await puppeteer.launch()
try { try {
// Open the application. // Open the application.
const page = await browser.newPage() const page = await browser.newPage()
page.on('console', console_ => console.log(console_.text()));
await page.goto(appUrl) await page.goto(appUrl)
console.log(`Peer ${peerIndex}: Connected.`) console.log(`Peer ${peerIndex}: Connected.`)
let n = await page.evaluate(() => {
const canvas = document.querySelector("#canvas")
return canvas.childElementCount - 1
})
console.log(`Peer ${peerIndex}: Strokes: ${n}`)
// Set up observer. // Set up observer.
// Observe the time taken to receive draw calls from all peers, or how many // Observe the time taken to receive draw calls from all peers, or how many
// were synced if it takes longer than `syncTimeout`. // were synced if it takes longer than `syncTimeout`.
...@@ -36,6 +43,12 @@ const syncTimeout = numPeers * 4000 ...@@ -36,6 +43,12 @@ const syncTimeout = numPeers * 4000
syncTimeout, syncTimeout,
) )
n = await page.evaluate(() => {
const canvas = document.querySelector("#canvas")
return canvas.childElementCount - 1
})
console.log(`Peer ${peerIndex}: Strokes: ${n}`)
// Simulate a mouse click on the canvas. // Simulate a mouse click on the canvas.
const [left, top] = await page.evaluate(() => { const [left, top] = await page.evaluate(() => {
const rect = document.querySelector("#canvas").getBoundingClientRect() const rect = document.querySelector("#canvas").getBoundingClientRect()
...@@ -44,6 +57,12 @@ const syncTimeout = numPeers * 4000 ...@@ -44,6 +57,12 @@ const syncTimeout = numPeers * 4000
await page.mouse.click(left + 10 + 10 * peerIndex, top + 10) await page.mouse.click(left + 10 + 10 * peerIndex, top + 10)
console.log(`Peer ${peerIndex}: Drawn.`) console.log(`Peer ${peerIndex}: Drawn.`)
n = await page.evaluate(() => {
const canvas = document.querySelector("#canvas")
return canvas.childElementCount - 1
})
console.log(`Peer ${peerIndex}: Strokes: ${n}`)
// Wait for the observed result. // Wait for the observed result.
const [elapsed, numSynced] = await page.evaluate(async () => { const [elapsed, numSynced] = await page.evaluate(async () => {
return await window.result return await window.result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment