mirror of
https://github.com/expo/explore.git
synced 2026-11-15 13:18:16 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
258d3cd920 | ||
|
|
87b594545a | ||
|
|
0fc97294c0 | ||
|
|
e4c19d04f1 |
No files matched your search
@@ -1279,20 +1279,22 @@ test("a docs-only report with zero images and no EAS build opens Screens without
|
||||
await page.getByRole("button", { name: "Screens", exact: true }).click();
|
||||
await expect(page.locator(".screens-page .screens-cell")).toHaveCount(1);
|
||||
await expect(page.locator(".screens-page .diff-frame.diff-not-compared")).toHaveCount(1);
|
||||
// The Inspector's missing screenshot matches the canvas node: the icon above a short label,
|
||||
// centred in a phone-shaped preview frame.
|
||||
// The Inspector's missing screenshot matches the canvas node: the icon above a short label and
|
||||
// the report's reason for the gap, centred in a phone-shaped preview frame.
|
||||
await page.locator(".screens-page .screen-screenshot-target").click();
|
||||
const placeholder = page.locator(".inspector .inspector-preview .screenshot-placeholder");
|
||||
await expect(placeholder).toHaveText("No screenshot");
|
||||
await expect(placeholder.locator("span")).toHaveText("No screenshot");
|
||||
await expect(placeholder.locator(".screenshot-placeholder-detail")).toHaveText("Not compared; no capture was recorded");
|
||||
const layout = await placeholder.evaluate(node => {
|
||||
const box = element => element.getBoundingClientRect();
|
||||
const frame = box(node.closest(".inspector-preview"));
|
||||
const icon = box(node.querySelector("svg"));
|
||||
const label = box(node.querySelector("span"));
|
||||
const detail = box(node.querySelector(".screenshot-placeholder-detail"));
|
||||
return { frameRatio: frame.width / frame.height, iconSize: [icon.width, icon.height], iconAboveLabel: icon.bottom <= label.top,
|
||||
iconOffset: Math.abs(icon.left + icon.width / 2 - (frame.left + frame.width / 2)),
|
||||
labelOffset: Math.abs(label.left + label.width / 2 - (frame.left + frame.width / 2)),
|
||||
verticalOffset: Math.abs((icon.top + label.bottom) / 2 - (frame.top + frame.height / 2)),
|
||||
verticalOffset: Math.abs((icon.top + detail.bottom) / 2 - (frame.top + frame.height / 2)),
|
||||
labelSize: getComputedStyle(node.querySelector("span")).fontSize };
|
||||
});
|
||||
assert.deepEqual(layout.iconSize, [20, 20]);
|
||||
|
||||
@@ -839,7 +839,49 @@ test("an excluded route leaves the map with an accepted gap, like a redirect", (
|
||||
const gap = current.map.gaps.find(gap => gap.screenId === "games-pro");
|
||||
assert.equal(gap.status, "accepted");
|
||||
assert.equal(gap.message, "Excluded by exploration.exclude; never captured");
|
||||
assert.equal(
|
||||
indexMap(current.map).screenNotes.get("games-pro"),
|
||||
"Excluded by exploration.exclude; never captured",
|
||||
"the inspector's placeholder says why there is no screenshot",
|
||||
);
|
||||
const projection = publicReviewProjection(review);
|
||||
assert.equal(projection.runtimeEvidence["public:games-pro"].current.groups.capture.find((row) => row.label === "Capture").value,
|
||||
"Excluded by exploration.exclude; never captured");
|
||||
});
|
||||
|
||||
test("an unchanged excluded route outside the capture context still says it was excluded", () => {
|
||||
const review = navigationReview();
|
||||
const excluded = review.surfaces.find(surface => surface.id === "games-pro");
|
||||
excluded.excluded = true;
|
||||
for (const side of ["base", "head"]) { delete excluded[`${side}Image`]; delete excluded[`${side}Outcome`]; }
|
||||
const { current } = workspaceSides(publicReviewToWorkspace(review));
|
||||
const gap = current.map.gaps.find(gap => gap.screenId === "games-pro");
|
||||
assert.equal(gap.status, "accepted");
|
||||
assert.equal(gap.message, "Excluded by exploration.exclude; never captured");
|
||||
assert.equal(diffFor(review).index.screenNotes.get("games-pro"), "Excluded by exploration.exclude; never captured");
|
||||
});
|
||||
|
||||
test("a screen's note is its first open gap of any kind, and an accepted gap only when nothing is open", () => {
|
||||
// A redirect on base that became a screen whose head capture failed: the comparison carries both sides' gaps.
|
||||
const review = verifyImages(fixture());
|
||||
const home = review.surfaces.find(surface => surface.id === "home");
|
||||
home.status = "modified";
|
||||
home.head = entry("home", "/", "fresh");
|
||||
home.headOutcome = { status: "failed", attempts: 1, landing: "unverified", reason: "Configured UI prerequisites did not complete." };
|
||||
const diff = diffFor(review);
|
||||
const messages = diff.map.gaps.filter(gap => gap.screenId === "home").map(gap => [gap.status, gap.message]);
|
||||
assert.deepEqual(messages.map(([status]) => status), ["open", "accepted"]);
|
||||
assert.equal(indexMap(diff.map).screenNotes.get("home"), messages[0][1], "the head's failure, not the baseline's redirect");
|
||||
assert.equal(presentScreensByPath(diff.map).index.screenNotes.get("home"), messages[0][1]);
|
||||
|
||||
const { current } = workspaceSides(publicReviewToWorkspace(verifyImages(fixture())));
|
||||
const gap = (id, kind, status, message) => ({ id, kind, status, message, screenId: "games-free", createdAt: review.createdAt });
|
||||
const open = [gap("parse-1", "controller-parse", "open", "Unreadable element tree"), gap("parse-2", "controller-parse", "open", "Second warning")];
|
||||
const accepted = gap("accepted", "coverage", "accepted", "Not compared; no capture was recorded");
|
||||
const resolved = gap("resolved", "coverage", "resolved", "Captured on retry");
|
||||
for (const gaps of [[...open, accepted, resolved], [resolved, accepted, ...open]]) {
|
||||
assert.equal(indexMap({ ...current.map, gaps }).screenNotes.get("games-free"), "Unreadable element tree");
|
||||
}
|
||||
assert.equal(indexMap({ ...current.map, gaps: [resolved, accepted] }).screenNotes.get("games-free"), accepted.message);
|
||||
assert.equal(indexMap({ ...current.map, gaps: [resolved] }).screenNotes.has("games-free"), false);
|
||||
});
|
||||
@@ -366,7 +366,7 @@ function sidePayload(review: PublicReview, side: Side): { map: ExploreMap; cover
|
||||
screenId: surface.id,
|
||||
kind: "coverage",
|
||||
status: deliberatelyOmitted ? "accepted" : "open",
|
||||
message: deliberatelyOmitted && outsideCaptureContext && entry.kind !== "redirect"
|
||||
message: deliberatelyOmitted && outsideCaptureContext && entry.kind !== "redirect" && !surface.excluded
|
||||
? "Not compared; no capture was recorded" : captureStatus(review, surface, side),
|
||||
createdAt: review.createdAt,
|
||||
});
|
||||
|
||||
@@ -69,8 +69,11 @@ export function indexMap(map: ExploreMap): MapIndex {
|
||||
outgoing,
|
||||
incoming,
|
||||
plainTitles: map.run?.exploration === "black-box",
|
||||
// Why a screen has no screenshot, in the report's words: its first open gap, else its first accepted one.
|
||||
// The map keeps a screen's last entry, so the gaps are reversed and then open ones are sorted after accepted ones.
|
||||
screenNotes: new Map(
|
||||
(map.gaps ?? []).filter((gap) => gap.status === "open" && gap.screenId).reverse().map((gap) => [gap.screenId!, gap.message]),
|
||||
(map.gaps ?? []).filter((gap) => gap.status !== "resolved" && gap.screenId)
|
||||
.reverse().sort((a, b) => Number(a.status === "open") - Number(b.status === "open")).map((gap) => [gap.screenId!, gap.message]),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user