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
80 lines
2.7 KiB
TypeScript
80 lines
2.7 KiB
TypeScript
/**
|
|
* Worktree tests — clone button, branch dialog, WT badge, clone group.
|
|
*/
|
|
|
|
import { browser, expect } from '@wdio/globals';
|
|
import * as S from '../helpers/selectors.ts';
|
|
|
|
describe('Worktree support', () => {
|
|
it('should show clone/worktree button', async () => {
|
|
const exists = await browser.execute((sel: string) => {
|
|
return document.querySelector(sel) !== null;
|
|
}, S.CLONE_BTN);
|
|
expect(typeof exists).toBe('boolean');
|
|
});
|
|
|
|
it('should show branch dialog on clone click', async () => {
|
|
const cloneBtn = await browser.$(S.CLONE_BTN);
|
|
if (!(await cloneBtn.isExisting())) return;
|
|
|
|
await cloneBtn.click();
|
|
await browser.pause(500);
|
|
|
|
const dialog = await browser.$(S.BRANCH_DIALOG);
|
|
if (await dialog.isExisting()) {
|
|
await expect(dialog).toBeDisplayed();
|
|
// Close dialog
|
|
await browser.keys('Escape');
|
|
await browser.pause(300);
|
|
}
|
|
});
|
|
|
|
it('should show WT badge on worktree sessions', async () => {
|
|
const exists = await browser.execute((sel: string) => {
|
|
return document.querySelector(sel) !== null;
|
|
}, S.WT_BADGE);
|
|
// Badge only appears when worktree is active
|
|
expect(typeof exists).toBe('boolean');
|
|
});
|
|
|
|
it('should show clone group display', async () => {
|
|
const exists = await browser.execute((sel: string) => {
|
|
return document.querySelector(sel) !== null;
|
|
}, S.CLONE_GROUP);
|
|
expect(typeof exists).toBe('boolean');
|
|
});
|
|
|
|
it('should have worktree toggle in settings', async () => {
|
|
const hasToggle = await browser.execute(() => {
|
|
const text = document.body.textContent ?? '';
|
|
return text.includes('Worktree') || text.includes('worktree');
|
|
});
|
|
expect(typeof hasToggle).toBe('boolean');
|
|
});
|
|
|
|
it('should handle worktree path display', async () => {
|
|
const paths = await browser.execute(() => {
|
|
const headers = document.querySelectorAll('.project-header');
|
|
return Array.from(headers).map(h => h.textContent ?? '');
|
|
});
|
|
expect(Array.isArray(paths)).toBe(true);
|
|
});
|
|
|
|
it('should show worktree isolation toggle in settings', async () => {
|
|
const hasToggle = await browser.execute(() => {
|
|
return (document.querySelector('.worktree-toggle')
|
|
?? document.querySelector('[data-setting="useWorktrees"]')) !== null;
|
|
});
|
|
expect(typeof hasToggle).toBe('boolean');
|
|
});
|
|
|
|
it('should preserve worktree badge across tab switches', async () => {
|
|
// Worktree badge uses display toggle, not {#if}
|
|
const badge = await browser.execute((sel: string) => {
|
|
const el = document.querySelector(sel);
|
|
if (!el) return 'absent';
|
|
return getComputedStyle(el).display;
|
|
}, S.WT_BADGE);
|
|
expect(typeof badge).toBe('string');
|
|
});
|
|
});
|