Harden live route ownership verification
This commit is contained in:
@@ -190,6 +190,16 @@ async function runSidebarCheck(page) {
|
||||
}
|
||||
|
||||
async function runWatchlistLabelCheck(page, returnTo, expectedLabel) {
|
||||
const evaluate = async () => {
|
||||
const labelVisible = await page.getByText(`Return to ${expectedLabel}`, { exact: false }).first().isVisible().catch(() => false);
|
||||
const snapshot = await captureSnapshot(page, `watchlist-return:${expectedLabel}`);
|
||||
|
||||
return {
|
||||
ok: labelVisible,
|
||||
snapshot,
|
||||
};
|
||||
};
|
||||
|
||||
await page.goto(
|
||||
`https://stella-ops.local/setup/trust-signing/watchlist/alerts?${scopeQuery}&alertId=alert-001&scope=tenant&tab=alerts&returnTo=${encodeURIComponent(returnTo)}`,
|
||||
{
|
||||
@@ -199,14 +209,22 @@ async function runWatchlistLabelCheck(page, returnTo, expectedLabel) {
|
||||
);
|
||||
await settle(page);
|
||||
|
||||
const labelVisible = await page.getByText(`Return to ${expectedLabel}`, { exact: false }).first().isVisible().catch(() => false);
|
||||
let result = await evaluate();
|
||||
if (
|
||||
!result.ok
|
||||
&& new URL(page.url()).pathname === '/setup/trust-signing/watchlist/alerts'
|
||||
&& (result.snapshot.title === 'StellaOps' || !result.snapshot.heading)
|
||||
) {
|
||||
await page.waitForTimeout(2_000);
|
||||
result = await evaluate();
|
||||
}
|
||||
|
||||
return {
|
||||
kind: 'watchlist-return',
|
||||
route: page.url(),
|
||||
ok: labelVisible,
|
||||
ok: result.ok,
|
||||
expectedLabel,
|
||||
snapshot: await captureSnapshot(page, `watchlist-return:${expectedLabel}`),
|
||||
snapshot: result.snapshot,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user