From 5d8aeed0d18cac9e016b3693fc3e267cb14ca46c Mon Sep 17 00:00:00 2001 From: Daniil Tkachev Date: Thu, 16 Jan 2025 12:32:49 +0100 Subject: [PATCH] TC-47 Test cypress e2e --- .../workflows/universal_workflow_light.yaml | 68 +++++++++++-------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index 8a5f2f8..51bac4a 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) }} @@ -1164,60 +1164,68 @@ jobs: logfile: load_testplan_runscript.log token: ${{ secrets.enterprise_github_token || github.token }} + - 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}" + - name: Convert variables id: cy shell: bash run: | echo "Debugging environment variables:" - env | grep "^cypress_" + env | grep "^cypress_" || true echo "Setting outputs..." # Rest of the script... - ${{ needs.init.outputs.debug }} + "${{ needs.init.outputs.debug }}" set +x - E=$(env|grep -e "^cypress_") + E="$(env | grep -e "^cypress_")" MATRIX_SCRIPT='osc_telecash:cypress' - if [[ ${MATRIX_SCRIPT} != *":"* ]]; then - echo -e "\033[0;31m ${X} does not contain a ':'. You need to specify scripts as ':'" - exit 1 + if [[ "${MATRIX_SCRIPT}" != *":"* ]]; then + echo -e "\033[0;31m Script does not contain a ':'. You need to specify scripts as ':'" + exit 1 fi IFS=':' read -r -a S <<< "${MATRIX_SCRIPT}" PREFIX="${S[0]//-/_}" SCRIPT="${S[1]}" - echo "cypress_script=${SCRIPT}" >> $GITHUB_OUTPUT + echo "cypress_script=${SCRIPT}" >> "${GITHUB_OUTPUT}" for KEY in docker_login load_shop \ - container_name container_options container_method \ - cache_bucket \ - composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ - custom_script custom_script_container \ - path install_options \ - output_prefix coverage_prefix; do - VAR="cypress_${PREFIX}_${KEY}" - if [[ "${E}" != *"${VAR}"* ]]; then - VAR="cypress_${KEY}" - fi - echo "cypress_${KEY}=${!VAR}" >> $GITHUB_OUTPUT - export "cypress_${KEY}"="${!VAR}" + container_name container_options container_method \ + cache_bucket \ + composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ + custom_script custom_script_container \ + path install_options \ + output_prefix coverage_prefix; do + VAR="cypress_${PREFIX}_${KEY}" + if [[ "${E}" != *"${VAR}"* ]]; then + VAR="cypress_${KEY}" + fi + echo "cypress_${KEY}=${!VAR}" >> "${GITHUB_OUTPUT}" + export "cypress_${KEY}=${!VAR}" done - if [ "${cypress_composer_early}" == 'false' ]; then - echo 'cypress_run_composer_install=true' >> $GITHUB_OUTPUT + if [ "${cypress_composer_early}" = 'false' ]; then + echo 'cypress_run_composer_install=true' >> "${GITHUB_OUTPUT}" fi # If cypress_workdir is ~, it will be set to the value of cypress_path VAR="cypress_${PREFIX}_workdir" if [[ "${E}" != *"${VAR}"* ]]; then - VAR='cypress_workdir' + VAR='cypress_workdir' fi - if [ "${!VAR}" == '~' ]; then - echo "cypress_workdir=${cypress_path}" >> $GITHUB_OUTPUT + if [ "${!VAR}" = '~' ]; then + echo "cypress_workdir=${cypress_path}" >> "${GITHUB_OUTPUT}" else - echo "cypress_workdir=${!VAR}" >> $GITHUB_OUTPUT + echo "cypress_workdir=${!VAR}" >> "${GITHUB_OUTPUT}" fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "cypress_suffix=${SUFFIX}" | \ - sed -E 's#\s|\~|"|,|:|<|>|\||\*|\?|\/|\\#_#g' | \ - sed -e 's#\-\-*#-#' -e 's#\_\_*#_#g' >> $GITHUB_OUTPUT + sed -E 's#\s|\~|"|,|:|<|>|\||\*|\?|\/|\\#_#g' | \ + sed -e 's#\-\-*#-#' -e 's#\_\_*#_#g' >> "${GITHUB_OUTPUT}" echo "cypress_title=${PREFIX}_${SCRIPT}" | \ - sed -E 's#\s|\~|"|,|:|<|>|\||\*|\?|\/|\\#_#g' | \ - sed -e 's#\-\-*#-#' -e 's#\_\_*#_#g' >> $GITHUB_OUTPUT + sed -E 's#\s|\~|"|,|:|<|>|\||\*|\?|\/|\\#_#g' | \ + sed -e 's#\-\-*#-#' -e 's#\_\_*#_#g' >> "${GITHUB_OUTPUT}" - name: Debug Outputs run: |