Make notifications action sweep wait for cold-load shell

This commit is contained in:
master
2026-03-11 21:19:54 +02:00
parent 66e67f1a97
commit ebc70a3611
2 changed files with 60 additions and 0 deletions

View File

@@ -161,6 +161,19 @@ async function navigate(page, route) {
return url;
}
async function waitForNotificationsPanel(page, timeoutMs = 12_000) {
await page.waitForFunction(() => {
if (document.querySelector('.notify-panel')) {
return true;
}
return Array.from(document.querySelectorAll('h1, h2, [data-testid="page-title"], .page-title'))
.map((node) => (node.textContent || '').trim().toLowerCase())
.some((text) => text.includes('notify control plane') || text === 'channels' || text === 'rules');
}, { timeout: timeoutMs }).catch(() => {});
await page.waitForTimeout(500);
}
async function findNavigationTarget(page, name, index = 0) {
const candidates = [
{ role: 'link', locator: page.getByRole('link', { name }) },
@@ -461,6 +474,7 @@ async function notificationsFormProbe(context, page) {
actions.push(await runAction(page, route, 'flow:New channel', async () => {
await navigate(page, route);
await waitForNotificationsPanel(page);
const newChannel = page.getByRole('button', { name: 'New channel' }).first();
if ((await newChannel.count()) === 0) {
return {
@@ -516,6 +530,7 @@ async function notificationsFormProbe(context, page) {
actions.push(await runAction(page, route, 'flow:New rule', async () => {
await navigate(page, route);
await waitForNotificationsPanel(page);
const newRule = page.getByRole('button', { name: 'New rule' }).first();
if ((await newRule.count()) === 0) {
return {