Skip to content

Commit

Permalink
TC-47 Test cypress e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Jan 16, 2025
1 parent ce5ee27 commit 238969c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/oxid-esales/cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ cat <<EOF >> docker-compose.yml
condition: service_healthy
EOF

"$SCRIPT_DIR/set_shop_url.sh" http://apache

echo "Validating docker-compose.yml..."
docker compose config || {
Expand All @@ -128,6 +129,7 @@ echo "Waiting for services to stabilize..."
sleep 30

#"$SCRIPT_DIR/db_backup.sh" restore
"$SCRIPT_DIR/set_shop_url.sh" https://oxideshop.local

echo "Displaying Cypress logs..."
docker compose logs cypress || echo "No logs available for Cypress."
Expand Down
42 changes: 42 additions & 0 deletions .github/oxid-esales/set_shop_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

replace_shop_url_custom() {
local config_file="source/source/config.inc.php"
local new_url="$1"

# Check if URL argument is provided
if [ -z "$new_url" ]; then
echo "Error: Please provide a URL as an argument"
echo "Usage: $0 <new_url>"
echo "Example: $0 http://example.com/"
exit 1
fi;

# Check if file exists
if [ ! -f "$config_file" ]; then
echo "Error: Config file not found at $config_file"
exit 1
fi;

# Add debug output
echo "Replacing shop URL with '$new_url' in: $config_file"

# Create a backup of the original file
cp "$config_file" "${config_file}.bak"

# Replace the shop URL using sed
sed -i "s|\$this->sShopURL\s*=\s*'[^']*';|\$this->sShopURL = '$new_url';|" "$config_file"

# Verify the replacement
if grep -q "\$this->sShopURL = '$new_url';" "$config_file"; then
echo "Shop URL successfully replaced with: $new_url"
else
echo "Error: Shop URL replacement failed"
# Restore from backup
mv "${config_file}.bak" "$config_file"
exit 1
fi
}

# Run the function with the provided argument
replace_shop_url_custom "$1"
2 changes: 1 addition & 1 deletion .github/workflows/universal_workflow_light.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ jobs:
github_token: ${{ secrets.enterprise_github_token || github.token }}

cypress:
needs: ['init', 'install', 'runscript']
needs: ['init', 'install']
strategy:
matrix:
php: ${{ fromJSON(needs.init.outputs.runscript_matrix_php) }}
Expand Down

0 comments on commit 238969c

Please sign in to comment.