cd $BUILD_DIR
../src/stop.sh
fi
- exit
+ exit $1
}
BASE_URL=''
case "${flag}" in
d) DEVICE=$OPTARG;;
r) REMOTE='true'
- BASE_URL=$OPTARG;;
+ # jq is expecting a string literal, otherwise it will fail on the url ':'.
+ # We need to ensure that jq gets a json string for assignment; we achieve
+ # that by introducing literal double quotes (i.e., '"').
+ BASE_URL='"'$OPTARG'"';;
esac
done
else
echo "ERROR: Chrome and Docker not found. You need to install one of \
them to run the e2e frontend tests."
- stop
+ stop 1
fi
fi
sleep 10
BASE_URL=`./bin/ceph mgr services | jq .dashboard`
- BASE_URL=${BASE_URL//\"}
fi
cd $DASH_DIR/frontend
+jq .[].target=$BASE_URL proxy.conf.json.sample > proxy.conf.json
+
. $BUILD_DIR/src/pybind/mgr/dashboard/node-env/bin/activate
npm ci
npm run build -- --prod
if [ $DEVICE == "chrome" ]; then
- npm run e2e -- --serve=false --base-href $BASE_URL || stop
+ npm run e2e || stop 1
+ stop 0
elif [ $DEVICE == "docker" ]; then
- docker run -d -v $(pwd):/workdir --net=host --name angular-e2e-container rogargon/angular-e2e || stop
- docker exec angular-e2e-container npm run e2e -- --serve=false --base-href $BASE_URL
+ failed=0
+ docker run -d -v $(pwd):/workdir --net=host --name angular-e2e-container rogargon/angular-e2e || failed=1
+ docker exec angular-e2e-container npm run e2e || failed=1
docker stop angular-e2e-container
docker rm angular-e2e-container
+ stop $failed
else
echo "ERROR: Device not recognized. Valid devices are 'chrome' and 'docker'."
+ stop 1
fi
-
-stop