introduce wc-e2e shorthand script

This commit is contained in:
Ron Rennick 2020-12-15 13:54:59 -04:00 committed by Leif Singer
parent 597ec5f9c3
commit a7014d5496
1 changed files with 62 additions and 0 deletions

62
tests/e2e/env/bin/wc-e2e.sh vendored Executable file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env bash
#
# Run package scripts
#
# Script help
usage() {
echo 'usage: npx wc-e2e <script>'
echo 'scripts:'
echo ' docker:up [initialization-script] - boot docker container'
echo ' docker:down - shut down docker container'
echo ' docker:ssh - open SSH shell into docker container'
echo ' docker:clear-all - remove all docker containers'
echo ' test:e2e [test-script] - run e2e test suite or specific test-script'
echo ' test:e2e-dev [test-script] - run e2e test(s) in non-headless mode'
echo ' test:e2e-debug [test-script] - run e2e test(s) in non-headless debug mode'
}
# Parameter check
if [ $# -lt 1 ]; then
usage
exit 1
fi
# Store original path
OLDPATH=$(pwd)
# Use the script symlink to find and change directory to the root of the package
SCRIPTPATH=$(dirname "$0")
REALPATH=$(readlink $0)
cd $SCRIPTPATH/$(dirname "$REALPATH")/..
# Run scripts
case $1 in
'docker:up')
./bin/docker-compose.sh up $2
;;
'docker:down')
./bin/docker-compose.sh down
;;
'docker:ssh')
docker exec -it $(node utils/get-app-name.js)_wordpress-www /bin/bash
;;
'docker:clear-all')
docker rmi --force $(docker images -q)
;;
'test:e2e')
./bin/wait-for-build.sh && ./bin/e2e-test-integration.js $2
;;
'test:e2e-dev')
./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev $2
;;
'test:e2e-debug')
./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev --debug $2
;;
*)
usage
;;
esac
# Restore working path
cd $OLDPATH