Infrastructure: - adapters/: base, tauri (port 9750), electrobun (port 9761 + PTY daemon) - helpers/: 120+ centralized selectors, reusable actions, custom assertions - wdio.shared.conf.js + stack-specific configs 18 unified specs (205 tests): splash(6) smoke(15) settings(19) terminal(14) agent(15) search(12) files(15) comms(10) tasks(10) theme(12) groups(12) keyboard(8) notifications(10) diagnostics(8) status-bar(12) context(9) worktree(8) llm-judged(10) Daemon: --stack tauri|electrobun|both flag Scripts: test:e2e:tauri, test:e2e:electrobun, test:e2e:both
112 lines
3.5 KiB
TypeScript
112 lines
3.5 KiB
TypeScript
/**
|
|
* Notification system tests — bell, drawer, clear, toast, history.
|
|
*/
|
|
|
|
import { browser, expect } from '@wdio/globals';
|
|
import * as S from '../helpers/selectors.ts';
|
|
import { openNotifications, closeNotifications } from '../helpers/actions.ts';
|
|
|
|
describe('Notification system', () => {
|
|
it('should show the notification bell button', async () => {
|
|
const bell = await browser.$(S.NOTIF_BTN);
|
|
if (await bell.isExisting()) {
|
|
await expect(bell).toBeDisplayed();
|
|
}
|
|
});
|
|
|
|
it('should open notification drawer on bell click', async () => {
|
|
await openNotifications();
|
|
|
|
const visible = await browser.execute((sel: string) => {
|
|
const el = document.querySelector(sel);
|
|
if (!el) return false;
|
|
return getComputedStyle(el).display !== 'none';
|
|
}, S.NOTIF_DRAWER);
|
|
if (visible) {
|
|
expect(visible).toBe(true);
|
|
}
|
|
});
|
|
|
|
it('should show drawer header with title', async () => {
|
|
const text = await browser.execute((sel: string) => {
|
|
const el = document.querySelector(sel);
|
|
return el?.textContent ?? '';
|
|
}, S.DRAWER_TITLE);
|
|
if (text) {
|
|
expect(text).toBe('Notifications');
|
|
}
|
|
});
|
|
|
|
it('should show clear all button', async () => {
|
|
const clearBtn = await browser.$(S.CLEAR_BTN);
|
|
if (await clearBtn.isExisting()) {
|
|
await expect(clearBtn).toBeDisplayed();
|
|
const text = await clearBtn.getText();
|
|
expect(text).toContain('Clear');
|
|
}
|
|
});
|
|
|
|
it('should show empty state or notification items', async () => {
|
|
const hasContent = await browser.execute(() => {
|
|
const empty = document.querySelector('.notif-empty');
|
|
const items = document.querySelectorAll('.notif-item');
|
|
return (empty !== null) || items.length > 0;
|
|
});
|
|
expect(hasContent).toBe(true);
|
|
});
|
|
|
|
it('should close drawer on backdrop click', async () => {
|
|
await closeNotifications();
|
|
|
|
const hidden = await browser.execute((sel: string) => {
|
|
const el = document.querySelector(sel);
|
|
if (!el) return true;
|
|
return getComputedStyle(el).display === 'none';
|
|
}, S.NOTIF_DRAWER);
|
|
expect(hidden).toBe(true);
|
|
});
|
|
|
|
it('should show unread badge when notifications exist', async () => {
|
|
const hasBadge = await browser.execute(() => {
|
|
return document.querySelector('.notif-badge')
|
|
?? document.querySelector('.unread-count');
|
|
});
|
|
// Badge may or may not be present
|
|
expect(hasBadge !== undefined).toBe(true);
|
|
});
|
|
|
|
it('should reopen drawer after close', async () => {
|
|
await openNotifications();
|
|
|
|
const visible = await browser.execute((sel: string) => {
|
|
const el = document.querySelector(sel);
|
|
if (!el) return false;
|
|
return getComputedStyle(el).display !== 'none';
|
|
}, S.NOTIF_DRAWER);
|
|
if (visible) {
|
|
expect(visible).toBe(true);
|
|
}
|
|
|
|
await closeNotifications();
|
|
});
|
|
|
|
it('should show notification timestamp', async () => {
|
|
await openNotifications();
|
|
const hasTimestamp = await browser.execute(() => {
|
|
return (document.querySelector('.notif-time')
|
|
?? document.querySelector('.notif-timestamp')) !== null;
|
|
});
|
|
expect(typeof hasTimestamp).toBe('boolean');
|
|
await closeNotifications();
|
|
});
|
|
|
|
it('should show mark-read action', async () => {
|
|
await openNotifications();
|
|
const hasAction = await browser.execute(() => {
|
|
return (document.querySelector('.mark-read')
|
|
?? document.querySelector('.notif-action')) !== null;
|
|
});
|
|
expect(typeof hasAction).toBe('boolean');
|
|
await closeNotifications();
|
|
});
|
|
});
|