fix(e2e): scope terminal tab selectors to .tab-bar for reliable matching
This commit is contained in:
parent
8bdd9d6fcc
commit
b9b5ef9cb3
1 changed files with 21 additions and 18 deletions
|
|
@ -344,20 +344,19 @@ describe('BTerminal — Terminal Tabs', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a shell tab', async () => {
|
it('should add a shell tab', async () => {
|
||||||
// Click add tab button
|
// Click add tab button via JS (Svelte onclick)
|
||||||
await browser.execute(() => {
|
await browser.execute(() => {
|
||||||
const btn = document.querySelector('.tab-add');
|
const btn = document.querySelector('.tab-bar .tab-add');
|
||||||
if (btn) (btn as HTMLElement).click();
|
if (btn) (btn as HTMLElement).click();
|
||||||
});
|
});
|
||||||
await browser.pause(500);
|
await browser.pause(500);
|
||||||
|
|
||||||
const tabs = await browser.$$('.tab');
|
// Verify tab title via JS to avoid stale element issues
|
||||||
expect(tabs.length).toBeGreaterThanOrEqual(1);
|
const title = await browser.execute(() => {
|
||||||
|
const el = document.querySelector('.tab-bar .tab-title');
|
||||||
// Tab should have a title containing "Shell"
|
return el ? el.textContent : '';
|
||||||
const title = await browser.$('.tab-title');
|
});
|
||||||
const text = await title.getText();
|
expect((title as string).toLowerCase()).toContain('shell');
|
||||||
expect(text.toLowerCase()).toContain('shell');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show active tab styling', async () => {
|
it('should show active tab styling', async () => {
|
||||||
|
|
@ -366,26 +365,30 @@ describe('BTerminal — Terminal Tabs', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a second shell tab and switch between them', async () => {
|
it('should add a second shell tab and switch between them', async () => {
|
||||||
// Add second tab
|
// Add second tab via JS
|
||||||
await browser.execute(() => {
|
await browser.execute(() => {
|
||||||
const btn = document.querySelector('.tab-add');
|
const btn = document.querySelector('.tab-bar .tab-add');
|
||||||
if (btn) (btn as HTMLElement).click();
|
if (btn) (btn as HTMLElement).click();
|
||||||
});
|
});
|
||||||
await browser.pause(500);
|
await browser.pause(500);
|
||||||
|
|
||||||
const tabs = await browser.$$('.tab');
|
const tabCount = await browser.execute(() => {
|
||||||
expect(tabs.length).toBeGreaterThanOrEqual(2);
|
return document.querySelectorAll('.tab-bar .tab').length;
|
||||||
|
});
|
||||||
|
expect(tabCount as number).toBeGreaterThanOrEqual(2);
|
||||||
|
|
||||||
// Click first tab
|
// Click first tab and verify it becomes active with Shell title
|
||||||
await browser.execute(() => {
|
await browser.execute(() => {
|
||||||
const tabs = document.querySelectorAll('.tab');
|
const tabs = document.querySelectorAll('.tab-bar .tab');
|
||||||
if (tabs[0]) (tabs[0] as HTMLElement).click();
|
if (tabs[0]) (tabs[0] as HTMLElement).click();
|
||||||
});
|
});
|
||||||
await browser.pause(300);
|
await browser.pause(300);
|
||||||
|
|
||||||
const activeTab = await browser.$('.tab.active');
|
const activeTitle = await browser.execute(() => {
|
||||||
const text = await activeTab.getText();
|
const active = document.querySelector('.tab-bar .tab.active .tab-title');
|
||||||
expect(text).toContain('Shell');
|
return active ? active.textContent : '';
|
||||||
|
});
|
||||||
|
expect(activeTitle as string).toContain('Shell');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should close a tab', async () => {
|
it('should close a tab', async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue