Report on Playwright flakes in the merge queue (#33750)
This commit is contained in:
@@ -293,8 +293,8 @@ jobs:
|
|||||||
--config=playwright-merge.config.ts \
|
--config=playwright-merge.config.ts \
|
||||||
./all-blob-reports
|
./all-blob-reports
|
||||||
env:
|
env:
|
||||||
# Only pass creds to the flaky-reporter on main branch runs
|
# Only pass creds to the flaky-reporter on main branch runs, or in merge queues (knowing these may be false positives)
|
||||||
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}
|
GITHUB_TOKEN: ${{ case(github.event_name == 'merge_group' || github.ref_name == 'develop', secrets.ELEMENT_BOT_TOKEN, '') }}
|
||||||
PLAYWRIGHT_HTML_TITLE: ${{ case(github.event_name == 'pull_request', format('Playwright Report PR-{0}', env.PR_NUMBER), 'Playwright Report') }}
|
PLAYWRIGHT_HTML_TITLE: ${{ case(github.event_name == 'pull_request', format('Playwright Report PR-{0}', env.PR_NUMBER), 'Playwright Report') }}
|
||||||
|
|
||||||
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
|
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ class FlakyReporter implements Reporter {
|
|||||||
console.log(flake);
|
console.log(flake);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { GITHUB_TOKEN, GITHUB_API_URL, GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID } = process.env;
|
const { GITHUB_TOKEN, GITHUB_API_URL, GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_EVENT_NAME } =
|
||||||
|
process.env;
|
||||||
if (!GITHUB_TOKEN) return;
|
if (!GITHUB_TOKEN) return;
|
||||||
|
|
||||||
const issues = await this.getAllIssues();
|
const issues = await this.getAllIssues();
|
||||||
@@ -147,13 +148,17 @@ class FlakyReporter implements Reporter {
|
|||||||
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
|
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
|
||||||
const existingIssue = issues.find((issue) => issue.title === title);
|
const existingIssue = issues.find((issue) => issue.title === title);
|
||||||
const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
|
const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
|
||||||
const body = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`;
|
let body = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`;
|
||||||
|
|
||||||
|
if (GITHUB_EVENT_NAME === "merge_group") {
|
||||||
|
body += " (merge queue run, may be a false positive)";
|
||||||
|
}
|
||||||
|
|
||||||
const labels = [LABEL, ...results.map((test) => `${LABEL}-${test.parent.project()?.name}`)];
|
const labels = [LABEL, ...results.map((test) => `${LABEL}-${test.parent.project()?.name}`)];
|
||||||
|
|
||||||
if (existingIssue) {
|
if (existingIssue) {
|
||||||
console.log(`Found issue ${existingIssue.number} for ${flake}, adding comment...`);
|
console.log(`Found issue ${existingIssue.number} for ${flake}, adding comment...`);
|
||||||
// Ensure that the test is open
|
// Ensure that the issue is open
|
||||||
await fetch(existingIssue.url, {
|
await fetch(existingIssue.url, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers,
|
headers,
|
||||||
|
|||||||
Reference in New Issue
Block a user