forked from tarantool/cartridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress-test.sh
executable file
·45 lines (38 loc) · 1.04 KB
/
cypress-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# Usage examples:
#
# ./cypress-test.sh
# ./cypress-test.sh open
# ./cypress-test.sh run --spec ./webui/cypress/integration/plugin.spec.js
if [ -z "$1" ] ; then set -- "run" ; fi
set -e -x
pushd $(dirname "${BASH_SOURCE[0]}")
tarantool <<LAUNCHER_SCRIPT &
log = require('log')
fio = require('fio')
helpers = require('test.helper')
require('console').listen('127.0.0.1:3333')
httpd = require('http.server').new("localhost", 8080)
httpd:start()
_G.server = nil
_G.cluster = nil
function cleanup()
print('----- Performing cleanup -----')
pcall(function() httpd:stop() end)
if _G.server ~= nil then
_G.server:stop()
fio.rmtree(_G.server.workdir)
_G.server = nil
end
if _G.cluster ~= nil then
_G.cluster:stop()
fio.rmtree(_G.cluster.datadir)
_G.cluster = nil
end
end
LAUNCHER_SCRIPT
trap "kill %1" EXIT
export NODE_ENV=production
export BABEL_ENV=$NODE_ENV
npx cypress "$@" -P webui/