fix(e2e): dual-stack selector compatibility — 18/18 specs pass on Tauri

- selectors.ts: dual CSS selectors for all divergent class names
- actions.ts: fallback DOM queries (try primary, then alternatives)
- assertions.ts: waitUntil with dual selectors
- 12 spec files updated with graceful skip for stack-specific features
- 175 tests pass, 30 skip (expected: groups/diagnostics Tauri-absent)
This commit is contained in:
Hibryda 2026-03-22 05:56:01 +01:00
parent 77b9ce9f62
commit 3d74398fde
16 changed files with 482 additions and 236 deletions

View file

@ -1,3 +1,10 @@
/**
* Workspace & project tests grid, project cards, tabs, status bar.
*
* Supports both Tauri (.project-box, .ptab) and Electrobun (.project-card)
* via dual selectors.
*/
import { browser, expect } from '@wdio/globals';
describe('BTerminal — Workspace & Projects', () => {
@ -6,8 +13,8 @@ describe('BTerminal — Workspace & Projects', () => {
await expect(grid).toBeDisplayed();
});
it('should render at least one project box', async () => {
const boxes = await browser.$$('.project-box');
it('should render at least one project card', async () => {
const boxes = await browser.$$('.project-box, .project-card');
expect(boxes.length).toBeGreaterThanOrEqual(1);
});
@ -21,8 +28,9 @@ describe('BTerminal — Workspace & Projects', () => {
});
it('should show project-level tabs (Model, Docs, Context, Files, SSH, Memory, ...)', async () => {
const box = await browser.$('.project-box');
const tabs = await box.$$('.ptab');
const box = await browser.$('.project-box, .project-card');
// Tauri: .ptab | Electrobun: .project-tab or .tab-btn
const tabs = await box.$$('.ptab, .project-tab, .tab-btn');
// v3 has 6+ tabs: Model, Docs, Context, Files, SSH, Memory (+ role-specific)
expect(tabs.length).toBeGreaterThanOrEqual(6);
});
@ -31,17 +39,16 @@ describe('BTerminal — Workspace & Projects', () => {
const header = await browser.$('.project-header');
await header.click();
const activeBox = await browser.$('.project-box.active');
const activeBox = await browser.$('.project-box.active, .project-card.active');
await expect(activeBox).toBeDisplayed();
});
it('should switch project tabs', async () => {
// Use JS click — WebDriver clicks don't always trigger Svelte onclick
// on buttons inside complex components via WebKit2GTK/tauri-driver
const switched = await browser.execute(() => {
const box = document.querySelector('.project-box');
const box = document.querySelector('.project-box') ?? document.querySelector('.project-card');
if (!box) return false;
const tabs = box.querySelectorAll('.ptab');
const tabs = box.querySelectorAll('.ptab, .project-tab, .tab-btn');
if (tabs.length < 2) return false;
(tabs[1] as HTMLElement).click();
return true;
@ -49,15 +56,15 @@ describe('BTerminal — Workspace & Projects', () => {
expect(switched).toBe(true);
await browser.pause(500);
const box = await browser.$('.project-box');
const activeTab = await box.$('.ptab.active');
const box = await browser.$('.project-box, .project-card');
const activeTab = await box.$('.ptab.active, .project-tab.active, .tab-btn.active');
const text = await activeTab.getText();
// Tab[1] is "Docs" in v3 tab bar (Model, Docs, Context, Files, ...)
expect(text.toLowerCase()).toContain('docs');
// Switch back to Model tab
await browser.execute(() => {
const tab = document.querySelector('.project-box .ptab');
const box = document.querySelector('.project-box') ?? document.querySelector('.project-card');
const tab = box?.querySelector('.ptab, .project-tab, .tab-btn');
if (tab) (tab as HTMLElement).click();
});
await browser.pause(300);
@ -72,8 +79,6 @@ describe('BTerminal — Workspace & Projects', () => {
it('should display project and agent info in status bar', async () => {
const statusBar = await browser.$('.status-bar .left');
const text = await statusBar.getText();
// Status bar always shows project count; agent counts only when > 0
// (shows "X running", "X idle", "X stalled" — not the word "agents")
expect(text).toContain('projects');
});
});