diff --git a/.github/oxid-esales/cypress.sh b/.github/oxid-esales/cypress.sh index 1866d57..af9eb3b 100755 --- a/.github/oxid-esales/cypress.sh +++ b/.github/oxid-esales/cypress.sh @@ -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." @@ -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 }