Skip to content

Commit

Permalink
TC-47 test cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Jan 9, 2025
1 parent 82f982c commit cd6df8a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/oxid-esales/cypress.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

function create_network() {
echo "Creating Docker network..."
docker network create app-network || echo "Network app-network already exists."
Expand Down Expand Up @@ -32,17 +37,19 @@ function start_cypress() {
-e CYPRESS_WORKDIR=/var/www \
-e CYPRESS_CONFIG=/var/www/cypress.config.js \
cypress/included:latest bash -c "apt-get update && apt-get install -y iputils-ping curl && npx cypress run --config-file /var/www/cypress.config.js"
}

function test_connectivity() {
echo "Testing connectivity from Cypress to Apache..."
docker logs telecash-module-apache-1
docker network inspect app-network
# Wait for Cypress to start running tests
sleep 5

# Show Cypress logs
echo "Cypress is running tests..."
docker logs -f cypress-container | tee cypress-test-output.log

if docker exec cypress-container curl -I http://oxideshop.local; then
echo "Cypress successfully connected to Apache at http://oxideshop.local."
# Check Cypress run result
if grep -q "All specs passed!" cypress-test-output.log; then
echo -e "${GREEN}All Cypress tests passed successfully!${NC}"
else
echo "Error: Cypress could not connect to Apache."
echo -e "${RED}Cypress tests failed. Check the logs for details.${NC}"
exit 1
fi
}
Expand Down

0 comments on commit cd6df8a

Please sign in to comment.