Skip to content

Commit c7c7c18

Browse files
authored
chore: Add a try around evaluate in integration tests for elements that flicker (commontoolsinc#2213)
chore: Add a try around evaluate in integration tests for elements that flicker.
1 parent 7773b02 commit c7c7c18

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/patterns/integration/ct-checkbox.test.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,20 @@ function clickCtCheckbox(page: Page) {
107107
});
108108
}
109109

110-
async function getFeatureStatus(page: Page): Promise<string | undefined> {
110+
async function getFeatureStatus(
111+
page: Page,
112+
): Promise<string | undefined | null> {
111113
const featureStatus = await page.waitForSelector("#feature-status", {
112114
strategy: "pierce",
113115
});
114-
const statusText = await featureStatus.evaluate((el: HTMLElement) =>
115-
el.textContent
116-
);
117-
return statusText?.trim();
116+
// This could throw due to lacking a box model to click on.
117+
// Catch in lieu of handling time sensitivity.
118+
try {
119+
const statusText = await featureStatus.evaluate((el: HTMLElement) =>
120+
el.textContent
121+
);
122+
return statusText?.trim();
123+
} catch (_) {
124+
return null;
125+
}
118126
}

0 commit comments

Comments
 (0)