diff --git a/.github/oxid-esales/cypress.sh b/.github/oxid-esales/cypress.sh index 8ce0988..d5617c9 100755 --- a/.github/oxid-esales/cypress.sh +++ b/.github/oxid-esales/cypress.sh @@ -152,12 +152,21 @@ else echo -e "${GREEN}Skipping 'make up' as per user request (--no_make_up=true).${NC}" fi +docker compose logs cypress > cypress_output.log -# Exit with the Cypress exit code -if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}Cypress tests passed successfully!${NC}" +# Check for failure indicators in the logs +if grep -iE "AssertionError|Failing:\s+1|failed" cypress_output.log > /dev/null; then + echo -e "${RED} Tests failed! Found error indicators in Cypress logs${NC}" + cat cypress_output.log + rm cypress_output.log + exit 1 +elif grep -i "All specs passed!" cypress_output.log > /dev/null; then + echo -e "${GREEN} All tests passed successfully!${NC}" + rm cypress_output.log exit 0 else - echo -e "${RED}Cypress tests failed with exit code: $EXIT_CODE ${NC}" - exit $EXIT_CODE + echo -e "${RED} Unable to determine test status - checking logs for details: ${NC}" + cat cypress_output.log + rm cypress_output.log + exit 1 fi diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index 2dc8eae..03ceb92 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -1122,7 +1122,7 @@ jobs: github_token: ${{ secrets.enterprise_github_token || github.token }} cypress: - needs: [ 'init', 'install', 'runscript' ] + needs: ['init', 'install', 'runscript'] strategy: matrix: php: ${{ fromJSON(needs.init.outputs.runscript_matrix_php) }} @@ -1166,11 +1166,13 @@ jobs: - name: Set Cypress Variables run: | - echo "cypress_composer_transform=some_value" >> $GITHUB_ENV - echo "cypress_composer_early=false" >> $GITHUB_ENV - echo "cypress_container_name=php" >> $GITHUB_ENV - echo "cypress_container_options=" >> $GITHUB_ENV - echo "cypress_path=/var/www/html" >> $GITHUB_ENV + { + echo "cypress_composer_transform=some_value" + echo "cypress_composer_early=false" + echo "cypress_container_name=php" + echo "cypress_container_options=" + echo "cypress_path=/var/www/html" + } >> "${GITHUB_ENV}" - name: Convert variables id: cy @@ -1249,7 +1251,6 @@ jobs: wait_for_selenium: false debug: ${{ needs.init.outputs.debug }} - - name: Run composer run: | # run composer @@ -1262,7 +1263,6 @@ jobs: ${{ steps.cy.outputs.cypress_container_options }} \ ${{ steps.cy.outputs.cypress_container_name }} \ composer update --no-interaction -d "/var/www/${{ steps.cy.outputs.cypress_path }}" - - name: Run custom scripts uses: 'OXID-eSales/github-actions/run_custom_scripts@v4'