Skip to content

Commit

Permalink
starting adding Teams notifications to scheduled tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goulter committed Jan 15, 2025
1 parent c95c258 commit 106d4ac
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 4 deletions.
104 changes: 102 additions & 2 deletions .github/workflows/scheduled-idp-web-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: No Slack - Scheduled UW IdP Test Matrix
name: Scheduled UW IdP Test Matrix

on:
push:
Expand Down Expand Up @@ -76,7 +76,50 @@ jobs:
- uses: UWIT-IAM/actions/[email protected]
with:
gcloud-token: ${{ secrets.TEST_RUNNER_GOOGLE_TOKEN }}
# {"title": "IdP Web Tests running on ", "value": "'${{ env.IDP_ENV }}'"},
# {"title": "Reason for Test Run", "value": "${{ env.INPUT_REASON }}"},
# {"title": "Initiated By:", "value": "'"${{ github.actor }}"'"}
# "'Glen Hardcoded Reason'"

- name: Notify Teams of Test Run Start
env:
IDP_ENV: ${{ steps.configure.outputs.idp-env }}
INPUT_REASON: ${{ steps.configure.outputs.input-reason }}
run: |
curl -H "Content-Type: application/json" \
-d '{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "IDP Test Run Notification"
},
{
"type": "TextBlock",
"text": "Starting - IDP Tests ⏳",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{"title": "Reason for Test Run", "value": "'Glen Hardcoded Reason'"}
]
}
]
}
}
]
}' \
"${{ env.TEAMS_INTEGRATIONS_DAILY_WEB_TESTS }}"
- name: Run tests
run: ./scripts/run-tests.sh -- --env ${{ matrix.idp_env }}
Expand Down Expand Up @@ -105,9 +148,66 @@ jobs:

- if: >
always()
&& steps.post-run.outputs.upload_storyboards =='true'
&& steps.post-run.outputs.upload_storyboards == 'true'
&& steps.upload-storyboards.outcome == 'success'
name: Set notices on workflow
env:
storyboard_link: ${{ steps.config.outputs.storyboard_link }}
run: echo "::notice::Storyboards located at ${{ env.storyboard_link }}"
- name: Notify Teams of Test Run Completion
env:
TEST_STATUS: ${{ steps.run-tests.outputs.test-status }}
REPORT_URL: ${{ steps.configure.outputs.report-url }}
INPUT_REASON: ${{ steps.configure.outputs.input-reason }}
IDP_ENV: ${{ steps.configure.outputs.idp-env }}
if: always()
run: |
# {"title": "IdP Web Tests ran on ", "value": "'${{ env.IDP_ENV }}'"},
# {"title": "Reason for Test Run was ", "value": "${{ env.INPUT_REASON }}"},
# {"title": "Storyboards:", "value": "['"$REPORT_URL"']('"$REPORT_URL"')"},
# {"title": "Initiated By:", "value": "'"${{ github.actor }}"'"}
# Set the message body dynamically based on TEST_STATUS
echo "TEST_STATUS=${{ env.TEST_STATUS }}"
if [ "$TEST_STATUS" = "succeeded" ]; then
test_result="Test run for IDP passed successfully ✅"
else
test_result="Test run for IDP failed ❌"
fi
# Notify Teams with the status of the test run
curl -H "Content-Type: application/json" \
-d '{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "Completed - IDP Test Run Notification"
},
{
"type": "TextBlock",
"text": "'"$test_result"'",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{"title": "Reason for Test Run", "value": "'Glen Hardcoded Reason'"}
]
}
]
}
}
]
}' \
"${{ secrets.TEAMS_INTEGRATIONS_DAILY_WEB_TESTS }}"
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ services:
volumes:
- ${CREDENTIAL_MOUNT_POINT}:/secrets:ro
- ${REPORT_MOUNT_POINT}:/tmp/webdriver-report
command: pytest ${PYTEST_ARGS} --selenium-server selenium:4444
# command: echo "The test would start here" #If you don't want the tests to run, and test other things like notifications, use this command instead of the above.
# command: pytest ${PYTEST_ARGS} --selenium-server selenium:4444
command: echo "The test would start here" #If you don't want the tests to run, and test other things like notifications, use this command instead of the above.

selenium:
image: selenium/standalone-chrome:4
Expand Down

0 comments on commit 106d4ac

Please sign in to comment.