Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: report skipped e2e tests to qa channel weekly #5379

Merged
merged 7 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]);