Make notifications action sweep wait for cold-load shell
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user