Skip to content
Snippets Groups Projects
Commit 37043e5c authored by ilyaukin's avatar ilyaukin Committed by André Angelantoni
Browse files

Support custom installaiton dir

parent 25c317fb
Branches
Tags
1 merge request!13Support custom installaiton dir
......@@ -19,15 +19,18 @@
# (above web or html), use:
# module_support/atk_setup playwright
# For the installation to the custom directory
# export ATK_HOME=./my/test/dir
# module_support/atk_setup playwright
# == For Automated Testing Kit Contributors ==
# Copy the tests located in <project root>/tests to the repo
# (often located in <project root>/web/modules/contrib/automated_testing_kit),
# use:
# module_support/atk_setup playwright back
WEB_ROOT_DIR="web"
MODULE_DIR="modules/contrib/automated_testing_kit"
MODULE_SUPPORT_DIR=$WEB_ROOT_DIR/$MODULE_DIR/module_support
MODULE_DIR=$(dirname $(dirname $0))
MODULE_SUPPORT_DIR="$MODULE_DIR/module_support"
TARGET_DIR=${ATK_HOME:-.}
if [ -z "$1" ]; then
echo "Please provide target framework (playwright OR cypress)."
......@@ -50,7 +53,7 @@ if [ ! -z "$2" ]; then
fi
# Check if in project root by testing for presence of package.json.
TEST_FILE="package.json"
TEST_FILE="$TARGET_DIR/package.json"
if [[ ! -f "$TEST_FILE" ]]; then
echo "Install Cypress or Playwright and run this from the project root."
exit 1
......@@ -61,24 +64,24 @@ fi
if [ "$1" == "cypress" ]; then
echo "== Setting up for Cypress. =="
TEST_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/cypress/e2e"
TEST_DESTINATION_DIR="cypress/e2e"
TEST_SOURCE_DIR="$MODULE_DIR/cypress/e2e"
TEST_DESTINATION_DIR="$TARGET_DIR/cypress/e2e"
DATA_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/data"
DATA_DESTINATION_DIR="cypress"
DATA_SOURCE_DIR="$MODULE_DIR/data"
DATA_DESTINATION_DIR="$TARGET_DIR/cypress"
SUPPORT_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/cypress/support"
SUPPORT_DESTINATION_DIR="cypress"
SUPPORT_SOURCE_DIR="$MODULE_DIR/cypress/support"
SUPPORT_DESTINATION_DIR="$TARGET_DIR/cypress"
else
echo "== Setting up for Playwright. =="
TEST_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/playwright/e2e"
TEST_DESTINATION_DIR="tests"
TEST_SOURCE_DIR="$MODULE_DIR/playwright/e2e"
TEST_DESTINATION_DIR="$TARGET_DIR/tests"
DATA_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/data"
DATA_SOURCE_DIR="$MODULE_DIR/data"
DATA_DESTINATION_DIR="${TEST_DESTINATION_DIR}"
SUPPORT_SOURCE_DIR="$WEB_ROOT_DIR/$MODULE_DIR/playwright/support"
SUPPORT_SOURCE_DIR="$MODULE_DIR/playwright/support"
SUPPORT_DESTINATION_DIR="${TEST_DESTINATION_DIR}"
fi
......@@ -94,11 +97,11 @@ echo -e "Support destination: $SUPPORT_DESTINATION_DIR"
#
if [[ $DO_BACK == 0 ]]; then
if [ "$1" == "cypress" ]; then
echo "Copying cypress.atk.config.js to <project_root>/cypress.atk.config.js."
cp $MODULE_SUPPORT_DIR/cypress.atk.config.js .
echo "Copying cypress.atk.config.js to $TARGET_DIR/cypress.atk.config.js."
cp $MODULE_SUPPORT_DIR/cypress.atk.config.js $TARGET_DIR
else
echo "Copying playwright.atk.config.js to <project_root>/playwright.atk.config.js."
cp $MODULE_SUPPORT_DIR/playwright.atk.config.js .
echo "Copying playwright.atk.config.js to $TARGET_DIR/playwright.atk.config.js."
cp $MODULE_SUPPORT_DIR/playwright.atk.config.js $TARGET_DIR
fi
fi
......@@ -106,7 +109,7 @@ fi
# Copy, link or copy back framework tests.
#
if [[ $DO_COPY == 1 ]]; then
echo "Copying tests to <project_root>/$TEST_DESTINATION_DIR."
echo "Copying tests to $TEST_DESTINATION_DIR."
# Ensure the destination directory exists.
mkdir -p ${TEST_DESTINATION_DIR}
cp -R $TEST_SOURCE_DIR/* $TEST_DESTINATION_DIR
......@@ -116,7 +119,7 @@ elif [[ $DO_BACK == 1 ]]; then
cp -R $TEST_DESTINATION_DIR/atk** $TEST_SOURCE_DIR
elif [[ $DO_LINK == 1 ]]; then
echo "Linking tests to <project_root>/$TEST_DESTINATION_DIR."
echo "Linking tests to $TEST_DESTINATION_DIR."
# Can't link the parent source directory so need to iterate through
# just test directories to link individual tests.
TESTS=$(find "${TEST_SOURCE_DIR}" -mindepth 1 -type d)
......@@ -140,7 +143,7 @@ fi
# Copy, link or put back data files.
#
if [[ $DO_COPY == 1 ]]; then
echo "Copying data files to <project_root>/$DATA_DESTINATION_DIR."
echo "Copying data files to $DATA_DESTINATION_DIR."
cp -R $DATA_SOURCE_DIR $DATA_DESTINATION_DIR
elif [[ $DO_BACK == 1 ]]; then
......@@ -148,16 +151,15 @@ elif [[ $DO_BACK == 1 ]]; then
cp -R $DATA_DESTINATION_DIR/data/* $DATA_SOURCE_DIR
elif [[ $DO_LINK == 1 ]]; then
echo "Linking data files to <project_root>/$DATA_DESTINATION_DIR."
echo "Linking data files to $DATA_DESTINATION_DIR."
ln -s "$PWD/$DATA_SOURCE_DIR" "$PWD/$DATA_DESTINATION_DIR"
fi
#
# Copy, link or copy back testing framework support files.
#
if [[ $DO_COPY == 1 ]]; then
echo "Copying test framework support files to <project_root>/$SUPPORT_DESTINATION_DIR."
echo "Copying test framework support files to $SUPPORT_DESTINATION_DIR."
cp -R $SUPPORT_SOURCE_DIR $SUPPORT_DESTINATION_DIR
elif [[ $DO_BACK == 1 ]]; then
......@@ -165,6 +167,6 @@ elif [[ $DO_BACK == 1 ]]; then
cp -R $SUPPORT_DESTINATION_DIR/support/* $SUPPORT_SOURCE_DIR
elif [[ $DO_LINK == 1 ]]; then
echo "Linking test framework support files to <project_root>/$SUPPORT_DESTINATION_DIR."
echo "Linking test framework support files to $SUPPORT_DESTINATION_DIR."
ln -s "$PWD/$SUPPORT_SOURCE_DIR" "$PWD/$SUPPORT_DESTINATION_DIR"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment