Skip to content

Commit

Permalink
test: report skipped e2e tests to qa channel weekly (#5379)
Browse files Browse the repository at this point in the history
### Intent
Ensure the QA team stays informed about skipped tests to prevent
oversight and avoid accumulating technical debt.

### Approach
Implement a cron job that scans (using grep) the test suite to identify
any skipped tests. The results are formatted in a clear, user-friendly
manner and posted to the positron QA channel every Tuesday morning. The
workflow can also be dispatched manually at any time.

### QA
Confirmed (in private channel) reports as expected.
<img width="605" alt="Screenshot 2024-11-15 at 9 39 39 AM"
src="https://github.com/user-attachments/assets/0e9f772a-a9e6-4d2b-a0fd-1a2b5a8ca737">
  • Loading branch information
midleman authored Nov 15, 2024
1 parent 9ab8369 commit 3e98f63
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/slack-skipped-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Slack Skipped Tests

on:
schedule:
# Run every Tuesday at 2pm UTC / 8am CST / 9am EST
- cron: '0 14 * * 2'
workflow_dispatch:

jobs:
slack-skipped-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run Slack Skipped Tests Script
run: node scripts/slack-skipped-tests.js ${{ secrets.SLACK_E2E_TEST_WEBHOOK }}
38 changes: 38 additions & 0 deletions scripts/slack-skipped-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

const { execSync } = require('child_process');

const slackSkippedTests = (slackWebhookUrl) => {
try {
const skippedTests = execSync(
`grep -r --include \\*.test.ts -E "describe\\.skip|it\\.skip" test/smoke/src/areas/positron | sed 's/\\.test\\.ts.*$/.test.ts/'`
).toString();

const slackMessage = {
attachments: [
{
mrkdwn_in: ['text'],
color: skippedTests === '' ? '#CCCCCC' : '#FF0000',
pretext: ':skipping:*Skipped Tests*',
text: skippedTests === '' ? 'There are no skipped tests. :tada:' : skippedTests,
},
],
};

console.log(skippedTests);
console.log(JSON.stringify(slackMessage, null, 2));

execSync(
`curl -X POST -H 'Content-type: application/json' --data '${JSON.stringify(
slackMessage
)}' ${slackWebhookUrl}`
);
} catch (error) {
console.error(`Error: ${error}`);
}
};

slackSkippedTests(process.argv[2]);

0 comments on commit 3e98f63

Please sign in to comment.