|
@@ -1,63 +1,64 @@
|
1
|
1
|
#!/bin/bash
|
|
2
|
+ash
|
2
|
3
|
. bash_library.sh # source bash_library.sh
|
3
|
4
|
|
4
|
5
|
# install nodjs if not installed
|
5
|
6
|
|
6
|
7
|
(
|
7
|
|
- log "verify if nodjs is installed"
|
|
8
|
+ log "Verify if nodjs is installed."
|
8
|
9
|
dpkg -l | grep '^ii' | grep 'nodejs\s'
|
9
|
10
|
|
10
|
11
|
if [ $? -eq 0 ]; then
|
11
|
|
- loggood "nodejs is installed"
|
|
12
|
+ loggood "nodejs is installed."
|
12
|
13
|
else
|
13
|
|
- log "install nodejs"
|
|
14
|
+ log "Install nodejs"
|
14
|
15
|
sudo apt install curl
|
15
|
16
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
16
|
17
|
sudo apt install -y nodejs
|
17
|
|
- loggood "nodejs is now installed"
|
|
18
|
+ loggood "nodejs is now installed."
|
18
|
19
|
fi
|
19
|
20
|
)
|
20
|
21
|
|
21
|
22
|
# install Cypress
|
22
|
|
-log "go to functionnal_tests subdir.."
|
|
23
|
+log "Go to functionnal_tests subdir.."
|
23
|
24
|
cd functionnal_tests || exit 1;
|
24
|
25
|
(
|
25
|
26
|
ACTUALDIR=$(pwd)
|
26
|
27
|
loggood "Your are now here: \"$ACTUALDIR\""
|
27
|
|
- log "check if package.json exist"
|
|
28
|
+ log "Check if package.json exist."
|
28
|
29
|
if [ ! -f package.json ]; then
|
29
|
30
|
log "package.json not exist => run npm init"
|
30
|
31
|
npm init -y
|
31
|
|
- loggood "npm init finished => package.json is now created"
|
|
32
|
+ loggood "npm init finished => package.json is now created."
|
32
|
33
|
else
|
33
|
|
- loggood "package.json exist"
|
|
34
|
+ loggood "package.json exist."
|
34
|
35
|
fi
|
35
|
|
- log "install cypress"
|
|
36
|
+ log "Install cypress."
|
36
|
37
|
npm install cypress --save-dev
|
37
|
|
- loggood "cypress is now installed"
|
|
38
|
+ loggood "Cypress is now installed."
|
38
|
39
|
)
|
39
|
40
|
|
40
|
41
|
# modify cypress.json
|
41
|
42
|
|
42
|
43
|
(
|
43
|
|
- log "check if cypress.json exist"
|
|
44
|
+ log "Check if cypress.json exist."
|
44
|
45
|
if [ ! -f cypress.json ]; then
|
45
|
46
|
log "cypress.json not exist => copy from cypress.json.sample"
|
46
|
47
|
cp cypress.json.sample cypress.json
|
47
|
|
- loggood "cypress.json is now available"
|
48
|
|
- log "write path in cypress.json"
|
|
48
|
+ loggood "cypress.json is now available."
|
|
49
|
+ log "Write path in cypress.json"
|
49
|
50
|
SUBDIR=$(pwd)
|
50
|
|
- sed -i "s|{path_test_file}|$SUBDIR|g" cypress.json
|
51
|
|
- loggood "path is now configured"
|
|
51
|
+ sed -i "s|{path_test_file}|$SUBDIR/cypress_test|g" cypress.json
|
|
52
|
+ loggood "Path is now configured."
|
52
|
53
|
else
|
53
|
|
- log "cypress.json exist => check if integrationFolder have path"
|
|
54
|
+ log "cypress.json exist => check if integrationFolder have path."
|
54
|
55
|
if grep -q "\"integrationFolder\"\:\s\"{path_test_file}\"" cypress.json ; then
|
55
|
|
- log "no path => write path in cypress.json"
|
|
56
|
+ log "No path => write path in cypress.json"
|
56
|
57
|
SUBDIR=$(pwd)
|
57
|
58
|
sed -i "s|{path_test_file}|$SUBDIR|g" cypress.json
|
58
|
|
- loggood "path is now configured"
|
|
59
|
+ loggood "Path is now configured."
|
59
|
60
|
else
|
60
|
|
- loggood "path exist. Modify manualy if necessary"
|
|
61
|
+ loggood "Path exist. Modify manualy if necessary."
|
61
|
62
|
fi
|
62
|
63
|
fi
|
63
|
64
|
)
|