Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drawing-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hlgr
drawing-app
Commits
5638ae47
Commit
5638ae47
authored
5 years ago
by
Nayeem Rahman
Browse files
Options
Downloads
Patches
Plain Diff
WIP debug
parent
4639b745
Branches
e2e-benchmark
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scalability-benchmark/client/spawn-peer.js
+20
-1
20 additions, 1 deletion
scalability-benchmark/client/spawn-peer.js
with
20 additions
and
1 deletion
scalability-benchmark/client/spawn-peer.js
+
20
−
1
View file @
5638ae47
...
...
@@ -4,16 +4,23 @@ const appUrl = process.env.APP_URL
const
peerIndex
=
parseInt
(
process
.
env
.
PEER_INDEX
)
const
numPeers
=
parseInt
(
process
.
env
.
NUM_PEERS
)
const
syncTimeout
=
numPeers
*
4
000
const
syncTimeout
=
numPeers
*
6
000
;(
async
()
=>
{
const
browser
=
await
puppeteer
.
launch
()
try
{
// Open the application.
const
page
=
await
browser
.
newPage
()
page
.
on
(
'
console
'
,
console_
=>
console
.
log
(
console_
.
text
()));
await
page
.
goto
(
appUrl
)
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.
// Observe the time taken to receive draw calls from all peers, or how many
// were synced if it takes longer than `syncTimeout`.
...
...
@@ -36,6 +43,12 @@ const syncTimeout = numPeers * 4000
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.
const
[
left
,
top
]
=
await
page
.
evaluate
(()
=>
{
const
rect
=
document
.
querySelector
(
"
#canvas
"
).
getBoundingClientRect
()
...
...
@@ -44,6 +57,12 @@ const syncTimeout = numPeers * 4000
await
page
.
mouse
.
click
(
left
+
10
+
10
*
peerIndex
,
top
+
10
)
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.
const
[
elapsed
,
numSynced
]
=
await
page
.
evaluate
(
async
()
=>
{
return
await
window
.
result
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment