Skip to content
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
2 changes: 1 addition & 1 deletion .github/playwright/timing-baseline.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions .github/scripts/build_playwright_shards.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,46 @@ def write_plan(
}


# The workflow passes one `--history` per downloaded full-run artifact and only
# falls back to the checked-in baseline when *no* artifact could be downloaded
# (see the `history_args` block in playwright-e2e-reusable.yml). A newly added
# spec file exists in the baseline -- its author seeds the durations there, as
# the stale-baseline gate below instructs -- but in no artifact yet, so a single
# successful download silently dropped those seeded timings and the gate fired
# on a file that *does* have history. Fold the baseline in at the lowest
# precedence instead: an artifact weight always wins where one exists, and the
# baseline only backfills tests no artifact has ever observed.
CHECKED_IN_BASELINE = Path(".github/playwright/timing-baseline.json")


def backfill_from_checked_in_baseline(
paths: list[Path],
weights: dict[str, int],
identity_weights: dict[tuple[str, str], int],
) -> None:
baseline = next(
(
candidate
for candidate in (root / CHECKED_IN_BASELINE for root in SPEC_ROOT_CANDIDATES)
if candidate.is_file()
),
None,
)
if baseline is None or any(path.resolve() == baseline.resolve() for path in paths):
return
fallback_weights, fallback_identity = load_history([baseline])
for test_id, weight in fallback_weights.items():
weights.setdefault(test_id, weight)
for identity, weight in fallback_identity.items():
identity_weights.setdefault(identity, weight)


def main() -> None:
args = parse_args()
report = json.loads(args.test_list.read_text(encoding="utf-8"))
selection = json.loads(args.selection.read_text(encoding="utf-8"))
test_weights, identity_weights = load_history(args.history)
backfill_from_checked_in_baseline(args.history, test_weights, identity_weights)
discovered_units = discover_units(report)
unmatched_selectors = [
selector["spec"]
Expand Down
Loading
Loading