Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Mynij-unit-tests
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
Mynij-unit-tests
Commits
cc5cce49
Commit
cc5cce49
authored
Nov 05, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added timer to index export
parent
541a9b6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
download_index.js
download_index.js
+27
-1
download_index_random.js
download_index_random.js
+27
-1
No files found.
download_index.js
View file @
cc5cce49
const
puppeteer
=
require
(
'
puppeteer
'
);
const
Server
=
require
(
'
ws
'
).
Server
;
const
args
=
require
(
"
yargs
"
)
.
usage
(
"
Usage : download_index.js -file file_path
"
)
.
demandOption
([
'
file
'
])
...
...
@@ -7,8 +8,33 @@ const args = require("yargs")
.
nargs
(
"
file
"
,
1
)
.
argv
;
var
browser
,
start
;
function
init_server
(){
var
port
=
9030
;
var
ws
=
new
Server
({
port
:
port
});
ws
.
on
(
'
connection
'
,
function
(
w
){
w
.
on
(
'
message
'
,
function
(
msg
){
if
(
msg
===
"
Start
"
){
start
=
Date
.
now
();
}
else
if
(
msg
===
"
Done
"
){
var
total
=
Date
.
now
()
-
start
;
console
.
log
(
"
Time spent :
"
+
total
/
1000
+
"
s
"
);
}
else
{
console
.
log
(
"
Error :
"
+
msg
);
browser
.
close
();
}
});
w
.
on
(
'
close
'
,
function
()
{
ws
.
close
();
});
});
}
(
async
()
=>
{
var
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
init_server
();
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
var
page
=
await
browser
.
newPage
();
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/download_index.html
'
);
const
[
fileChooser
]
=
await
Promise
.
all
([
...
...
download_index_random.js
View file @
cc5cce49
const
puppeteer
=
require
(
'
puppeteer
'
);
const
Server
=
require
(
'
ws
'
).
Server
;
const
randomstring
=
require
(
"
randomstring
"
);
const
tmp
=
require
(
'
tmp
'
);
const
fs
=
require
(
'
fs
'
);
...
...
@@ -10,6 +11,30 @@ const args = require("yargs")
.
nargs
(
"
prom
"
,
1
)
.
argv
;
var
browser
,
start
;
function
init_server
(){
var
port
=
9030
;
var
ws
=
new
Server
({
port
:
port
});
ws
.
on
(
'
connection
'
,
function
(
w
){
w
.
on
(
'
message
'
,
function
(
msg
){
if
(
msg
===
"
Start
"
){
start
=
Date
.
now
();
}
else
if
(
msg
===
"
Done
"
){
var
total
=
Date
.
now
()
-
start
;
console
.
log
(
"
Time spent :
"
+
total
/
1000
+
"
s
"
);
}
else
{
console
.
log
(
"
Error :
"
+
msg
);
browser
.
close
();
}
});
w
.
on
(
'
close
'
,
function
()
{
ws
.
close
();
});
});
}
function
gen_rdm_string
(
length
){
return
randomstring
.
generate
({
length
:
length
,
...
...
@@ -44,8 +69,9 @@ function gen_random_content (){
}
(
async
()
=>
{
init_server
();
var
file_path
=
gen_random_content
();
var
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
var
page
=
await
browser
.
newPage
();
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/download_index.html
'
);
const
[
fileChooser
]
=
await
Promise
.
all
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment