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
feaa3ebe
Commit
feaa3ebe
authored
Oct 08, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced process usage with puppeteer usage
parent
02450efe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
load_index.js
load_index.js
+34
-28
No files found.
load_index.js
View file @
feaa3ebe
const
puppeteer
=
require
(
'
puppeteer
'
);
var
args
=
require
(
"
yargs
"
)
.
usage
(
"
Usage : load_index.js -saveAs metadata/attachment -file file_path
"
)
.
demandOption
([
'
file
'
])
.
demandOption
([
'
saveAs
'
])
.
alias
(
"
f
"
,
"
file
"
)
.
alias
(
"
s
"
,
"
saveAs
"
)
.
describe
(
"
file
"
,
"
file containing content to put in the index, data must follow the CSV standard
"
)
.
describe
(
"
saveAs
"
,
"
choose whether to save the index as metadata or attachments in the indexeddb
"
)
.
nargs
(
"
file
"
,
1
)
.
nargs
(
"
saveAs
"
,
1
)
.
argv
;
.
usage
(
"
Usage : load_index.js -saveAs metadata/attachment -file file_path
"
)
.
demandOption
([
'
file
'
])
.
demandOption
([
'
saveAs
'
])
.
alias
(
"
f
"
,
"
file
"
)
.
alias
(
"
s
"
,
"
saveAs
"
)
.
describe
(
"
file
"
,
"
file containing content to put in the index, data must follow the CSV standard
"
)
.
describe
(
"
saveAs
"
,
"
choose whether to save the index as metadata or attachments in the indexeddb
"
)
.
nargs
(
"
file
"
,
1
)
.
nargs
(
"
saveAs
"
,
1
)
.
argv
;
if
(
!
(
args
.
saveAs
===
"
metadata
"
||
args
.
saveAs
===
"
attachment
"
)){
throw
'
Unrecognized save as argument
'
;
}
var
saveAs
=
args
.
saveAs
;
var
browser
;
const
puppeteer
=
require
(
'
puppeteer
'
);
var
browser
,
page
;
const
si
=
require
(
"
systeminformation
"
);
var
Server
=
require
(
'
ws
'
).
Server
;
var
port
=
9030
;
var
ws
=
new
Server
({
port
:
port
});
ws
.
on
(
'
connection
'
,
function
(
w
){
w
.
on
(
'
message
'
,
function
(
msg
){
console
.
log
(
msg
);
const
used
=
process
.
memoryUsage
();
for
(
let
key
in
used
)
{
console
.
log
(
`
${
key
}
${
Math
.
round
(
used
[
key
]
/
1024
/
1024
*
100
)
/
100
}
MB`
);
}
ws
.
on
(
'
connection
'
,
function
(
w
){
w
.
on
(
'
message
'
,
function
(
msg
){
console
.
log
(
msg
);
page
.
metrics
()
.
then
(
function
(
values
){
console
.
log
(
values
.
JSHeapUsedSize
/
1024
/
1024
);
si
.
mem
(
function
(
data
){
console
.
log
(
data
.
used
/
1024
/
1024
);
});
browser
.
close
();
});
w
.
on
(
'
close
'
,
function
()
{
ws
.
close
();
});
});
});
w
.
on
(
'
close
'
,
function
()
{
ws
.
close
();
});
});
(
async
()
=>
{
const
used
=
process
.
memoryUsage
();
for
(
let
key
in
used
)
{
console
.
log
(
`
${
key
}
${
Math
.
round
(
used
[
key
]
/
1024
/
1024
*
100
)
/
100
}
MB`
);
}
browser
=
await
puppeteer
.
launch
();
const
page
=
await
browser
.
newPage
();
page
=
await
browser
.
newPage
();
var
metrics
=
await
page
.
metrics
();
console
.
log
(
metrics
.
JSHeapUsedSize
/
1024
/
1024
);
si
.
mem
(
function
(
data
){
console
.
log
(
data
.
used
/
1024
/
1024
);
});
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/index_load.html?saveAs=
'
+
saveAs
);
const
[
fileChooser
]
=
await
Promise
.
all
([
page
.
waitForFileChooser
(),
...
...
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