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 863bd03 commit 5b53dc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
19 changes: 14 additions & 5 deletions .github/oxid-esales/cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions .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', 'runscript']
strategy:
matrix:
php: ${{ fromJSON(needs.init.outputs.runscript_matrix_php) }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1249,7 +1251,6 @@ jobs:
wait_for_selenium: false
debug: ${{ needs.init.outputs.debug }}


- name: Run composer
run: |
# run composer
Expand All @@ -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'
Expand Down

0 comments on commit 5b53dc0

Please sign in to comment.