diff --git a/.github/workflows/deploy-v2.yml b/.github/workflows/deploy-v2.yml index e73ea1ba..939079ff 100644 --- a/.github/workflows/deploy-v2.yml +++ b/.github/workflows/deploy-v2.yml @@ -41,16 +41,22 @@ on: required: false default: false type: boolean - run_e2e_tests: - description: 'Run End-to-End Tests' - required: false - default: true - type: boolean + cleanup_resources: description: 'Cleanup Deployed Resources' required: false default: false type: boolean + + run_e2e_tests: + description: 'Run End-to-End Tests' + required: false + default: 'GoldenPath-Testing' + type: choice + options: + - 'GoldenPath-Testing' + - 'Smoke-Testing' + - 'None' AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID: description: 'Log Analytics Workspace ID (Optional)' @@ -78,7 +84,7 @@ env: WAF_ENABLED: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.waf_enabled || false) || false }} EXP: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.EXP || false) || false }} CLEANUP_RESOURCES: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.cleanup_resources || true) || true }} - RUN_E2E_TESTS: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.run_e2e_tests || true) || true }} + RUN_E2E_TESTS: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.run_e2e_tests || 'GoldenPath-Testing') || 'GoldenPath-Testing' }} BUILD_DOCKER_IMAGE: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build_docker_image || false) || false }} jobs: @@ -418,8 +424,8 @@ jobs: elif [[ "$BRANCH_NAME" == "dependabotchanges" ]]; then BASE_TAG="dependabotchanges" else - IMAGE_TAG="pullrequest-ignore" - echo "Using default for branch '$BRANCH_NAME' - image tag: pullrequest-ignore" + IMAGE_TAG="latest" + echo "Using default for branch '$BRANCH_NAME' - image tag: latest" fi echo "Using existing Docker image tag: $IMAGE_TAG" @@ -564,7 +570,7 @@ jobs: # Export variables only after successful deploy - export CONTAINER_API_APPURL=$(echo "$DEPLOY_OUTPUT" | jq -r '.CONTAINER_API_APP_FQDN // empty') + export CONTAINER_API_APPURL="https://$(echo "$DEPLOY_OUTPUT" | jq -r '.CONTAINER_API_APP_FQDN // empty')" echo "CONTAINER_API_APPURL=$CONTAINER_API_APPURL" >> $GITHUB_ENV export CONTAINER_API_APPNAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.CONTAINER_API_APP_NAME // empty') @@ -648,11 +654,12 @@ jobs: fi e2e-test: - if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.CONTAINER_WEB_APPURL != '') || (github.event.inputs.existing_webapp_url != '' && github.event.inputs.existing_webapp_url != null)) && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null) + if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.CONTAINER_WEB_APPURL != '') || (github.event.inputs.existing_webapp_url != '' && github.event.inputs.existing_webapp_url != null)) && (github.event_name != 'workflow_dispatch' || (github.event.inputs.run_e2e_tests != 'none' && github.event.inputs.run_e2e_tests != '' && github.event.inputs.run_e2e_tests != null)) needs: [docker-build, deploy] uses: ./.github/workflows/test-automation-v2.yml with: CP_WEB_URL: ${{ needs.deploy.outputs.CONTAINER_WEB_APPURL || github.event.inputs.existing_webapp_url }} + TEST_SUITE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.run_e2e_tests || 'GoldenPath-Testing' }} secrets: inherit cleanup-deployment: diff --git a/.github/workflows/test-automation-v2.yml b/.github/workflows/test-automation-v2.yml index b143c58c..e865a348 100644 --- a/.github/workflows/test-automation-v2.yml +++ b/.github/workflows/test-automation-v2.yml @@ -7,6 +7,11 @@ on: required: true type: string description: "Web URL for Content Processing" + TEST_SUITE: + required: false + type: string + default: "GoldenPath-Testing" + description: "Test suite to run: 'Smoke-Testing', 'GoldenPath-Testing' " secrets: EMAILNOTIFICATION_LOGICAPP_URL_TA: required: false @@ -22,6 +27,7 @@ on: env: url: ${{ inputs.CP_WEB_URL }} accelerator_name: "Content Processing" + test_suite: ${{ inputs.TEST_SUITE }} jobs: test: @@ -58,6 +64,7 @@ jobs: exit 1 fi echo "Testing URL: ${{ env.url }}" + echo "Test Suite: ${{ env.test_suite }}" - name: Wait for Application to be Ready @@ -87,7 +94,11 @@ jobs: - name: Run tests(1) id: test1 run: | - xvfb-run pytest --headed --html=report/report.html --self-contained-html + if [ "${{ env.test_suite }}" == "GoldenPath-Testing" ]; then + xvfb-run pytest -m gp --headed --html=report/report.html --self-contained-html + else + xvfb-run pytest --headed --html=report/report.html --self-contained-html + fi working-directory: tests/e2e-test continue-on-error: true @@ -100,7 +111,11 @@ jobs: id: test2 if: ${{ steps.test1.outcome == 'failure' }} run: | - xvfb-run pytest --headed --html=report/report.html --self-contained-html + if [ "${{ env.test_suite }}" == "GoldenPath-Testing" ]; then + xvfb-run pytest -m gp --headed --html=report/report.html --self-contained-html + else + xvfb-run pytest --headed --html=report/report.html --self-contained-html + fi working-directory: tests/e2e-test continue-on-error: true @@ -113,7 +128,11 @@ jobs: id: test3 if: ${{ steps.test2.outcome == 'failure' }} run: | - xvfb-run pytest --headed --html=report/report.html --self-contained-html + if [ "${{ env.test_suite }}" == "GoldenPath-Testing" ]; then + xvfb-run pytest -m gp --headed --html=report/report.html --self-contained-html + else + xvfb-run pytest --headed --html=report/report.html --self-contained-html + fi working-directory: tests/e2e-test - name: Upload test report @@ -127,7 +146,12 @@ jobs: - name: Generate E2E Test Summary if: always() run: | - echo "## 🧪 E2E Test Job Summary" >> $GITHUB_STEP_SUMMARY + # Determine test suite type for title + if [ "${{ env.test_suite }}" == "GoldenPath-Testing" ]; then + echo "## 🧪 E2E Test Job Summary : Golden Path Testing" >> $GITHUB_STEP_SUMMARY + else + echo "## 🧪 E2E Test Job Summary : Smoke Testing" >> $GITHUB_STEP_SUMMARY + fi echo "" >> $GITHUB_STEP_SUMMARY echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY @@ -141,6 +165,7 @@ jobs: fi echo "| **Target URL** | [${{ env.url }}](${{ env.url }}) |" >> $GITHUB_STEP_SUMMARY + echo "| **Test Suite** | \`${{ env.test_suite }}\` |" >> $GITHUB_STEP_SUMMARY echo "| **Test Report** | [Download Artifact](${{ steps.upload_report.outputs.artifact-url }}) |" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY diff --git a/tests/e2e-test/pytest.ini b/tests/e2e-test/pytest.ini index 05b7f91c..31a3bee1 100644 --- a/tests/e2e-test/pytest.ini +++ b/tests/e2e-test/pytest.ini @@ -5,3 +5,5 @@ log_file = logs/tests.log log_file_level = INFO addopts = -p no:warnings --tb=short +markers = + gp: Golden Path tests \ No newline at end of file diff --git a/tests/e2e-test/tests/test_contentProcessing_gp_tc.py b/tests/e2e-test/tests/test_contentProcessing_gp_tc.py index c8914988..e5af6f87 100644 --- a/tests/e2e-test/tests/test_contentProcessing_gp_tc.py +++ b/tests/e2e-test/tests/test_contentProcessing_gp_tc.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) - +@pytest.mark.gp def test_content_processing_golden_path(login_logout, request): """ Content Processing - Validate Golden path works as expected