2023-04-17 12:01:41 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-08-22 10:32:05 +00:00
|
|
|
# Extract the relative path from the plugin root to this script directory.
|
|
|
|
# By doing so, we can run this script from anywhere.
|
2023-04-17 12:01:41 +00:00
|
|
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2023-08-22 10:32:05 +00:00
|
|
|
head_dir=$(cd "$(dirname "$script_dir")" && cd ../../.. && pwd)
|
|
|
|
relative_path=${script_dir#$head_dir/}
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2024-02-27 12:46:31 +00:00
|
|
|
# Generate the child themes zip files before running the tests.
|
|
|
|
# By doing so, we ensure that the zip files are up-to-date.
|
|
|
|
themes_dir="$script_dir/themes"
|
|
|
|
themes=("storefront-child" "twentytwentyfour-child")
|
|
|
|
for theme in "${themes[@]}"; do
|
|
|
|
# Define the path to the theme directory and the zip file.
|
|
|
|
theme_dir="$themes_dir/$theme"
|
|
|
|
zip_file="$themes_dir/$theme.zip"
|
|
|
|
|
|
|
|
# Check if the zip file exists. If it does, delete it.
|
|
|
|
if [ -f "$zip_file" ]; then
|
|
|
|
echo "Deleting existing zip file for $theme."
|
|
|
|
rm "$zip_file"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Navigate to the themes directory to ensure the zip contains only the theme folder name.
|
|
|
|
# Then, create a fresh zip file.
|
|
|
|
echo "Creating zip file for $theme."
|
|
|
|
(cd "$themes_dir" && zip -r "$zip_file" "$theme" -x "*.git*" -x "*node_modules*")
|
|
|
|
done
|
|
|
|
|
2023-08-22 10:32:05 +00:00
|
|
|
# Run the main script in the container for better performance.
|
2023-12-15 17:34:29 +00:00
|
|
|
wp-env run tests-cli -- bash wp-content/plugins/woocommerce/blocks-bin/playwright/scripts/index.sh
|