This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +48
-46
lines changed Expand file tree Collapse file tree 2 files changed +48
-46
lines changed Original file line number Diff line number Diff line change
1
+ fs = require ' fs'
2
+ {execFile } = require ' child_process'
3
+
4
+ assert = require ' assert'
5
+ rmrf = require ' rimraf'
6
+
7
+ tempdir = require ' ../lib/tempdir'
8
+ seleniumDownload = require ' ..'
9
+
10
+ BIN_PATH = __dirname + ' /bin'
11
+ TMP_PATH = " #{ tempdir} testium"
12
+
13
+ clearFileSystem = ->
14
+ rmrf .sync TMP_PATH
15
+ rmrf .sync BIN_PATH
16
+
17
+ clearFileSystem ()
18
+
19
+ describe ' seleniumDownload' , ->
20
+ before clearFileSystem
21
+
22
+ after clearFileSystem
23
+
24
+ before ' initial download' , (done ) ->
25
+ @ timeout 30000
26
+ seleniumDownload .update BIN_PATH, done
27
+
28
+ it ' downloads the proper files' , ->
29
+ assert fs .existsSync (BIN_PATH + ' /chromedriver' )
30
+ assert fs .existsSync (BIN_PATH + ' /selenium.jar' )
31
+
32
+ describe ' from local tmp' , ->
33
+ before (done ) ->
34
+ @ timeout 30000
35
+ seleniumDownload .update BIN_PATH, done
36
+
37
+ it ' downloads the files again' , ->
38
+ assert fs .existsSync (BIN_PATH + ' /chromedriver' )
39
+ assert fs .existsSync (BIN_PATH + ' /selenium.jar' )
40
+
41
+ it ' did not download an invalid jar' , (done ) ->
42
+ @ timeout 10000
43
+ execFile ' java' , [
44
+ # -h means "show usage/help". Selenium has no --version :(
45
+ ' -jar' , BIN_PATH + ' /selenium.jar' , ' -h'
46
+ ], (error , stdout ) ->
47
+ clearFileSystem ()
48
+ done error
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments