Skip to content

Commit d099ffa

Browse files
captainbrossetundefined
andauthored
Avoid failing when there's no Edge-only OTs (#3678)
Co-authored-by: undefined <undefined@users.noreply.github.com>
1 parent c3beeb2 commit d099ffa

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/web-platform-release-notes.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
// Script runs daily.
1+
// This script generates the web platform release notes draft for the next Microsoft Edge Beta version.
2+
// This script runs daily.
23

34
import github from '@actions/github';
45
import Eleventy from "@11ty/eleventy";
56
import fs from "fs/promises";
67
import playwright from "playwright";
78
import { execSync } from 'child_process';
89

10+
// Where to find Edge-only origin trials info.
911
const EDGE_OT_ROOT = "https://developer.microsoft.com/en-us";
1012
const EDGE_OT_PAGE = `${EDGE_OT_ROOT}/microsoft-edge/origin-trials/trials`;
1113
// If Beta becomes stable within the next N coming days, generate the release notes for Canary.
1214
// This way, the release notes are ready for when Canary becomes Beta.
1315
const DAYS_NUMBER_BEFORE_RELNOTES_NOTICE = 15;
16+
// The prefix to use when creating a new git branch for the release notes draft.
1417
const BRANCH_NAME_PREFIX = "web-platform-release-notes-";
1518

1619
async function fetchChromeStatusAPI(url) {
@@ -82,12 +85,21 @@ async function getActiveEdgeOTs() {
8285
// Wait for the OTs to have loaded. We check for the existence of a trial-card
8386
// that has a __tags element in it. This element is used to display the
8487
// "Microsoft Edge Only" tag.
85-
await page.waitForSelector(".trial-card .trial-card__tags");
88+
const tagsLocator = page.locator(".trial-card .trial-card__tags");
89+
try {
90+
await tagsLocator.waitFor({ timeout: 15000 });
91+
console.log("Edge-only OT tags are present, proceeding.");
92+
} catch (e) {
93+
console.error("Timed out waiting for Edge-only OT tags to appear.");
94+
await page.close();
95+
await scrapingBrowser.close();
96+
return [];
97+
}
8698

8799
// Get the list of all origin trial elements
88100
const microsoftOriginTrialEls = await page.locator("css=.trial-card", { hasText: "Microsoft Edge Only" });
89101
const otCards = await microsoftOriginTrialEls.all();
90-
console.log(`Found ${otCards.length} MS-only origin trials`);
102+
console.log(`Found ${otCards.length} Edge-only OTs.`);
91103

92104
const otLinks = [];
93105
for (const otCard of otCards) {

0 commit comments

Comments
 (0)