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 90d3aca commit ee9fcba
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions .github/oxid-esales/cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ function create_network() {

function start_services() {
echo "Starting services with Docker Compose..."
docker-compose up -d php mysql selenium mailpit
docker compose up -d php mysql selenium mailpit

echo "Stopping and removing any existing Apache container..."
docker rm -f telecash-module-apache-1 || echo "No existing Apache container to remove."

echo "Starting Apache with explicit hostname and ServerName..."
docker run -d --name telecash-module-apache-1 \
--hostname oxideshop.local \
Expand All @@ -18,13 +22,6 @@ function start_services() {
httpd:latest bash -c 'echo "ServerName oxideshop.local" >> /usr/local/apache2/conf/httpd.conf && httpd-foreground'
}

function connect_services_to_network() {
echo "Connecting services to app-network..."
for service in telecash-module-php-1 telecash-module-mysql-1 telecash-module-mailpit-1 telecash-module-selenium-1; do
docker network connect app-network $service || echo "Service $service already connected to app-network."
done
}

function start_cypress() {
echo "Starting Cypress container..."
docker run -d --name cypress-container \
Expand All @@ -35,9 +32,6 @@ 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"

docker exec cypress-container ping oxideshop.local
docker exec cypress-container curl -I http://oxideshop.local
}

function test_connectivity() {
Expand All @@ -62,7 +56,6 @@ function cleanup() {
# Main script execution
create_network
start_services
connect_services_to_network
start_cypress
test_connectivity
cleanup

0 comments on commit ee9fcba

Please sign in to comment.