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
a2ca395c
Commit
a2ca395c
authored
Oct 17, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added content compression test script
parent
96bd16ab
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
download_content.js
download_content.js
+19
-0
download_content_random.js
download_content_random.js
+56
-0
node
node
+0
-0
No files found.
download_content.js
0 → 100644
View file @
a2ca395c
const
puppeteer
=
require
(
'
puppeteer
'
);
const
args
=
require
(
"
yargs
"
)
.
usage
(
"
Usage : download_content.js -file file_path
"
)
.
demandOption
([
'
file
'
])
.
alias
(
"
f
"
,
"
file
"
)
.
describe
(
"
file
"
,
"
file containing content, data must follow the CSV standard
"
)
.
nargs
(
"
file
"
,
1
)
.
argv
;
(
async
()
=>
{
var
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
var
page
=
await
browser
.
newPage
();
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/download_content.html
'
);
const
[
fileChooser
]
=
await
Promise
.
all
([
page
.
waitForFileChooser
(),
page
.
click
(
'
input#load
'
)
]);
await
fileChooser
.
accept
([
args
.
file
]);
})();
download_content_random.js
0 → 100644
View file @
a2ca395c
const
puppeteer
=
require
(
'
puppeteer
'
);
const
randomstring
=
require
(
"
randomstring
"
);
const
tmp
=
require
(
'
tmp
'
);
const
fs
=
require
(
'
fs
'
);
const
args
=
require
(
"
yargs
"
)
.
usage
(
"
Usage : download_content_random.js -p number of random paragraphs to add to the index
"
)
.
demandOption
([
'
paragraphs
'
])
.
alias
(
"
p
"
,
"
paragraphs
"
)
.
describe
(
"
paragraphs
"
,
"
Number of random paragraphs to generate
"
)
.
nargs
(
"
prom
"
,
1
)
.
argv
;
function
gen_rdm_string
(
length
){
return
randomstring
.
generate
({
length
:
length
,
charset
:
'
alphabetic
'
});
}
function
gen_rdm_sentence
(
word_count
,
word_length
){
var
tmp_word_array
=
[];
for
(
var
i
=
0
;
i
<
word_count
;
i
+=
1
){
tmp_word_array
[
i
]
=
gen_rdm_string
(
word_length
);
}
return
tmp_word_array
.
join
(
"
"
);
}
function
gen_rdm_paragraph
(
sentence_count
,
words_per_sentence
,
word_length
){
var
tmp_sentence_array
=
[];
for
(
var
i
=
0
;
i
<
sentence_count
;
i
+=
1
){
tmp_sentence_array
[
i
]
=
gen_rdm_sentence
(
words_per_sentence
,
word_length
);
}
return
tmp_sentence_array
.
join
(
"
.
"
);
}
function
gen_random_content
(){
var
tmp_para_array
=
[];
for
(
var
i
=
0
;
i
<
args
.
p
;
i
+=
1
){
tmp_para_array
[
i
]
=
gen_rdm_paragraph
(
6
,
15
,
5
);
}
var
tmp_file
=
tmp
.
fileSync
();
fs
.
writeFileSync
(
tmp_file
.
name
,
tmp_para_array
.
join
(
"
\n
"
));
return
tmp_file
.
name
;
}
(
async
()
=>
{
var
file_path
=
gen_random_content
();
var
browser
=
await
puppeteer
.
launch
({
headless
:
false
});
var
page
=
await
browser
.
newPage
();
await
page
.
goto
(
'
https://softinst115787.host.vifib.net/public/unit_tests/download_content.html
'
);
const
[
fileChooser
]
=
await
Promise
.
all
([
page
.
waitForFileChooser
(),
page
.
click
(
'
input#load
'
)
]);
await
fileChooser
.
accept
([
file_path
]);
})();
node
0 → 100644
View file @
a2ca395c
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