-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·54 lines (42 loc) · 1.21 KB
/
run_tests.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
46
47
48
49
50
51
52
53
54
IMAGE_NAME="lct-playwright-image:latest"
function prepare_test() {
rm -rf ./test/live || true
mkdir -p ./test/live/tests
cp ./test/static/lctReporter.js ./test/live
cp ./test/static/playwright.config.js ./test/live
cp ./test/static/test.spec.js ./test/live/tests
}
function single_file_exists() {
FILE=$1
if [ ! -f "$FILE" ]; then
echo "$FILE not found."
exit 1
else
echo "$FILE found."
fi
}
function check_result_and_cleanup() {
single_file_exists "./test/live/results.xml"
rm ./test/live/results.xml || true
single_file_exists "./test/live/example.png"
rm ./test/live/example.png || true
rm -rf ./test/live/output || true
}
function run_container() {
BROWSER=$1
docker run -u pwuser --rm --ipc=host -v $(pwd)/test/live:/app/workdir $IMAGE_NAME "--project=$BROWSER"
}
echo "Launching Test Suite..."
prepare_test
echo "Starting chromium test..."
run_container "chromium"
echo "Verifying chromium test results..."
check_result_and_cleanup
echo "Starting firefox test..."
run_container "firefox"
echo "Verifying firefox test results..."
check_result_and_cleanup
echo "Starting webkit test..."
run_container "webkit"
echo "Verifying webkit test results..."
check_result_and_cleanup