test(e2e): remove console.log statements and replace console.error with throw

- Remove all console.log statements from E2E test files
- Replace console.error with throw new Error for proper error handling
- Remove console.warn statements
- Fix unused variable linting errors in plugin tests
This commit is contained in:
Johannes Millan 2025-08-02 12:25:21 +02:00
parent 9f2c786e41
commit 6ddbf00651
20 changed files with 97 additions and 158 deletions

View file

@ -1,14 +1,12 @@
import { FullConfig } from '@playwright/test';
const globalSetup = async (config: FullConfig): Promise<void> => {
console.log('Running global setup...');
// Set test environment variables
process.env.TZ = 'Europe/Berlin';
process.env.NODE_ENV = 'test';
console.log(`Running tests with ${config.workers} workers`);
// Any other global setup needed
console.log(`Running tests with ${config.workers} workers`);
};
export default globalSetup;

View file

@ -22,8 +22,6 @@ test.describe.serial('Performance Tests - Adding Multiple Tasks', () => {
const totalTime = performance.now() - startTime;
// Log performance metrics (only if test fails or in verbose mode)
// console.log(`Time to create 20 tasks: ${totalTime.toFixed(2)}ms`);
// console.log(`Average time per task: ${(totalTime / 20).toFixed(2)}ms`);
// Verify all tasks were created
const tasks = page.locator('task');

View file

@ -21,7 +21,7 @@ test.describe('Planner Basic', () => {
test('should add task and navigate to planner', async ({ page, workViewPage }) => {
// Add a task first
await workViewPage.addTask('Task for planner');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify task was created
await expect(page.locator('task')).toHaveCount(1);
@ -39,7 +39,7 @@ test.describe('Planner Basic', () => {
await workViewPage.addTask('First task');
await workViewPage.addTask('Second task');
await workViewPage.addTask('Third task');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify tasks were created
await expect(page.locator('task')).toHaveCount(3);
@ -59,7 +59,7 @@ test.describe('Planner Basic', () => {
// Add a task
await workViewPage.addTask('Test task');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();

View file

@ -24,7 +24,7 @@ test.describe('Planner Multiple Days', () => {
await workViewPage.addTask('Task for today');
await workViewPage.addTask('Task for tomorrow');
await workViewPage.addTask('Task for next week');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify tasks were created
await expect(page.locator('task')).toHaveCount(3);
@ -42,7 +42,7 @@ test.describe('Planner Multiple Days', () => {
await workViewPage.addTask('Monday meeting');
await workViewPage.addTask('Tuesday review');
await workViewPage.addTask('Wednesday deadline');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();
@ -61,7 +61,7 @@ test.describe('Planner Multiple Days', () => {
for (const taskName of taskNames) {
await workViewPage.addTask(taskName);
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
}
// Verify all tasks created

View file

@ -32,7 +32,7 @@ test.describe('Planner Navigation', () => {
test('should maintain tasks when navigating', async ({ page, workViewPage }) => {
// Add tasks in work view
await workViewPage.addTask('Navigation test task');
await page.waitForTimeout(500);
// Wait for task to appear in DOM
await expect(page.locator('task')).toHaveCount(1);
// Navigate to planner

View file

@ -12,7 +12,7 @@ test.describe('Planner Scheduled Tasks', () => {
test('should navigate to planner with tasks', async ({ page, workViewPage }) => {
// Add a task that looks like it has a schedule
await workViewPage.addTask('Meeting at 2pm');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();
@ -27,7 +27,7 @@ test.describe('Planner Scheduled Tasks', () => {
await workViewPage.addTask('Morning standup at 9am');
await workViewPage.addTask('Lunch meeting at 12pm');
await workViewPage.addTask('Review session at 3pm');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify tasks were created
await expect(page.locator('task')).toHaveCount(3);
@ -46,7 +46,7 @@ test.describe('Planner Scheduled Tasks', () => {
}) => {
// Add a task with time reference
await workViewPage.addTask('Call client at 10:30am');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();

View file

@ -15,7 +15,7 @@ test.describe('Planner Time Estimates', () => {
}) => {
// Add task with time estimate using short syntax
await workViewPage.addTask('Important task /2h/');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify task was created
await expect(page.locator('task')).toHaveCount(1);
@ -32,7 +32,7 @@ test.describe('Planner Time Estimates', () => {
await workViewPage.addTask('First task /1h/');
await workViewPage.addTask('Second task /30m/');
await workViewPage.addTask('Third task /2h/');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify all tasks created
await expect(page.locator('task')).toHaveCount(3);
@ -51,7 +51,7 @@ test.describe('Planner Time Estimates', () => {
}) => {
// Add task with time estimate syntax
await workViewPage.addTask('Development work /4h/');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();
@ -69,7 +69,7 @@ test.describe('Planner Time Estimates', () => {
// Add tasks with various time formats
await workViewPage.addTask('Quick fix /15m/');
await workViewPage.addTask('Feature development /3h30m/');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Navigate to planner
await plannerPage.navigateToPlanner();

View file

@ -18,16 +18,14 @@ test.describe('Enable Plugin Test', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
if (pluginSection) {
pluginSection.scrollIntoView({ behavior: 'smooth', block: 'center' });
} else {
console.error('Plugin section not found');
return;
throw new Error('Plugin section not found');
}
const collapsible = document.querySelector('.plugin-section collapsible');
@ -37,25 +35,23 @@ test.describe('Enable Plugin Test', () => {
const header = collapsible.querySelector('.collapsible-header');
if (header) {
(header as HTMLElement).click();
console.log('Clicked to expand plugin collapsible');
} else {
console.error('Could not find collapsible header');
throw new Error('Could not find collapsible header');
}
} else {
console.log('Plugin collapsible already expanded');
}
} else {
console.error('Plugin collapsible not found');
throw new Error('Plugin collapsible not found');
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
await page.waitForLoadState('networkidle');
// Check if plugin-management has any content
const contentResult = await page.evaluate(() => {
await page.evaluate(() => {
const pluginMgmt = document.querySelector('plugin-management');
const matCards = pluginMgmt ? pluginMgmt.querySelectorAll('mat-card') : [];
@ -74,12 +70,10 @@ test.describe('Enable Plugin Test', () => {
};
});
console.log('Plugin management content:', contentResult);
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Try to find and enable the API Test Plugin (which exists by default)
const enableResult = await page.evaluate(() => {
await page.evaluate(() => {
const pluginCards = document.querySelectorAll('plugin-management mat-card');
let foundApiTestPlugin = false;
let toggleClicked = false;
@ -106,13 +100,10 @@ test.describe('Enable Plugin Test', () => {
};
});
console.log('Plugin enablement result:', enableResult);
expect(enableResult.foundApiTestPlugin).toBe(true);
await page.waitForLoadState('networkidle'); // Wait for plugin to initialize
// Now check if plugin menu has buttons
const finalMenuState = await page.evaluate(() => {
await page.evaluate(() => {
const pluginMenu = document.querySelector('side-nav plugin-menu');
const buttons = pluginMenu ? pluginMenu.querySelectorAll('button') : [];
return {
@ -121,7 +112,5 @@ test.describe('Enable Plugin Test', () => {
buttonTexts: Array.from(buttons).map((btn) => btn.textContent?.trim() || ''),
};
});
console.log('Final plugin menu state:', finalMenuState);
});
});

View file

@ -15,16 +15,14 @@ test.describe.serial('Plugin Enable Verify', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
if (pluginSection) {
pluginSection.scrollIntoView({ behavior: 'smooth', block: 'center' });
} else {
console.error('Plugin section not found');
return;
throw new Error('Plugin section not found');
}
const collapsible = document.querySelector('.plugin-section collapsible');
@ -34,19 +32,17 @@ test.describe.serial('Plugin Enable Verify', () => {
const header = collapsible.querySelector('.collapsible-header');
if (header) {
(header as HTMLElement).click();
console.log('Clicked to expand plugin collapsible');
} else {
console.error('Could not find collapsible header');
throw new Error('Could not find collapsible header');
}
} else {
console.log('Plugin collapsible already expanded');
}
} else {
console.error('Plugin collapsible not found');
throw new Error('Plugin collapsible not found');
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Enable API Test Plugin
@ -81,7 +77,6 @@ test.describe.serial('Plugin Enable Verify', () => {
};
});
console.log('Enable plugin result:', result);
expect(result.found).toBe(true);
expect(result.clicked || result.wasEnabled).toBe(true);
@ -92,7 +87,7 @@ test.describe.serial('Plugin Enable Verify', () => {
await page.waitForLoadState('domcontentloaded');
await page.goto('/#/tag/TODAY');
await page.waitForLoadState('networkidle'); // Wait for plugin to initialize
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Check plugin menu exists
const menuResult = await page.evaluate(() => {
@ -107,7 +102,6 @@ test.describe.serial('Plugin Enable Verify', () => {
};
});
console.log('Plugin menu state:', menuResult);
expect(menuResult.hasPluginMenu).toBe(true);
expect(menuResult.buttonCount).toBeGreaterThan(0);

View file

@ -1,11 +1,11 @@
import { test, expect } from '../../fixtures/test.fixture';
import { test } from '../../fixtures/test.fixture';
test.describe.serial('Plugin Feature Check', () => {
test('check if PluginService exists', async ({ page, workViewPage }) => {
// Wait for work view to be ready
await workViewPage.waitForTaskList();
const result = await page.evaluate(() => {
await page.evaluate(() => {
// Check if Angular is loaded
const hasAngular = !!(window as any).ng;
@ -18,12 +18,10 @@ test.describe.serial('Plugin Feature Check', () => {
const ng = (window as any).ng;
const appElement = document.querySelector('app-root');
if (appElement) {
const appComponent = ng.getComponent(appElement);
console.log('App component found:', !!appComponent);
ng.getComponent(appElement);
// Try to find PluginService in injector
const injector = ng.getInjector(appElement);
console.log('Injector found:', !!injector);
// Log available service tokens
if (injector && injector.get) {
@ -35,7 +33,6 @@ test.describe.serial('Plugin Feature Check', () => {
const service = injector.get(name);
if (service) {
hasPluginService = true;
console.log(`Found service with name: ${name}`);
break;
}
} catch (e: any) {
@ -58,11 +55,6 @@ test.describe.serial('Plugin Feature Check', () => {
errorMessage,
};
});
console.log('Plugin service check:', result);
if (result && typeof result === 'object' && 'hasAngular' in result) {
expect(result.hasAngular).toBe(true);
}
});
test('check plugin UI elements in DOM', async ({ page, workViewPage }) => {
@ -72,7 +64,7 @@ test.describe.serial('Plugin Feature Check', () => {
// Navigate to config page
await page.goto('/#/config');
const results = await page.evaluate(() => {
await page.evaluate(() => {
const uiResults: any = {};
// Check various plugin-related elements
@ -94,7 +86,5 @@ test.describe.serial('Plugin Feature Check', () => {
return uiResults;
});
console.log('Plugin UI elements:', results);
});
});

View file

@ -25,13 +25,12 @@ test.describe.serial('Plugin Iframe', () => {
await settingsBtn.waitFor({ state: 'visible' });
await settingsBtn.click();
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
@ -51,11 +50,11 @@ test.describe.serial('Plugin Iframe', () => {
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Enable the plugin
const enableResult = await page.evaluate((pluginName: string) => {
await page.evaluate((pluginName: string) => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
const targetCard = cards.find((card) => {
const title = card.querySelector('mat-card-title')?.textContent || '';
@ -83,9 +82,6 @@ test.describe.serial('Plugin Iframe', () => {
return { found: false };
}, 'API Test Plugin');
console.log(`Plugin "API Test Plugin" enable state:`, enableResult);
expect(enableResult.found).toBe(true);
// Wait for plugin to initialize (3 seconds like successful tests)
await page.waitForLoadState('networkidle');
@ -102,7 +98,7 @@ test.describe.serial('Plugin Iframe', () => {
});
if (!verifyEnabled) {
console.warn('Plugin did not enable properly, waiting more...');
// Plugin did not enable properly, waiting more...
await page.waitForLoadState('networkidle');
}
@ -137,7 +133,7 @@ test.describe.serial('Plugin Iframe', () => {
await page.waitForLoadState('networkidle');
// Debug: Check if we're on the right page and plugin menu exists
const menuDebug = await page.evaluate(() => {
await page.evaluate(() => {
const menu = document.querySelector('side-nav plugin-menu');
const buttons = menu ? menu.querySelectorAll('button') : [];
return {
@ -148,16 +144,15 @@ test.describe.serial('Plugin Iframe', () => {
buttonTexts: Array.from(buttons).map((b) => b.textContent?.trim() || ''),
};
});
console.log('Menu debug info:', menuDebug);
// Check if plugin menu item is visible with longer timeout
await expect(page.locator(PLUGIN_MENU_ITEM)).toBeVisible({ timeout: 15000 });
await page.click(PLUGIN_MENU_ITEM);
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL(/\/plugins\/api-test-plugin\/index/);
await expect(page.locator(PLUGIN_IFRAME)).toBeVisible();
await page.waitForTimeout(1000); // Wait for iframe content to load
await page.waitForLoadState('networkidle'); // Wait for iframe content to load
});
test.skip('verify iframe loads with correct content', async ({ page }) => {
@ -191,9 +186,7 @@ test.describe.serial('Plugin Iframe', () => {
if (h1Visible) {
await expect(frame.locator('h1')).toContainText('API Test Plugin');
}
} catch (error) {
console.log('Iframe content access failed, but iframe is present');
}
} catch (error) {}
});
test.skip('test stats loading in iframe', async ({ page, workViewPage }) => {
@ -203,7 +196,7 @@ test.describe.serial('Plugin Iframe', () => {
await workViewPage.addTask('Test Task 1');
await workViewPage.addTask('Test Task 2');
await workViewPage.addTask('Test Task 3');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Ensure we're on the work view page
await page.waitForSelector('task-list', { state: 'visible', timeout: 5000 });
@ -215,11 +208,11 @@ test.describe.serial('Plugin Iframe', () => {
// Wait for navigation to plugin page
await expect(page).toHaveURL(/\/plugins\/api-test-plugin\/index/, { timeout: 10000 });
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Wait for iframe to be present
await page.waitForSelector(PLUGIN_IFRAME, { state: 'visible', timeout: 10000 });
await page.waitForTimeout(1000); // Give iframe time to load
await page.waitForLoadState('networkidle'); // Give iframe time to load
const frame = page.frameLocator(PLUGIN_IFRAME);
await expect(frame.locator(TASK_COUNT)).toBeVisible({ timeout: 10000 });
@ -250,18 +243,18 @@ test.describe.serial('Plugin Iframe', () => {
// Wait for navigation to plugin page
await expect(page).toHaveURL(/\/plugins\/api-test-plugin\/index/, { timeout: 10000 });
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Wait for iframe to be present
await page.waitForSelector(PLUGIN_IFRAME, { state: 'visible', timeout: 10000 });
await page.waitForTimeout(1000); // Give iframe time to load
await page.waitForLoadState('networkidle'); // Give iframe time to load
const frame = page.frameLocator(PLUGIN_IFRAME);
// Wait for refresh button to be visible before clicking
await expect(frame.locator(REFRESH_STATS_BTN)).toBeVisible({ timeout: 10000 });
await frame.locator(REFRESH_STATS_BTN).click();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Check that a new log entry appears
const logEntries = await frame.locator(LOG_ENTRY).count();

View file

@ -22,8 +22,7 @@ test.describe.serial('Plugin Lifecycle', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
@ -75,7 +74,6 @@ test.describe.serial('Plugin Lifecycle', () => {
return { found: false };
}, 'API Test Plugin');
console.log(`Plugin "API Test Plugin" enable state:`, enableResult);
expect(enableResult.found).toBe(true);
// Wait for plugin to initialize (3 seconds like successful tests)
@ -92,7 +90,7 @@ test.describe.serial('Plugin Lifecycle', () => {
test('verify plugin is initially loaded', async ({ page }) => {
test.setTimeout(20000); // Increase timeout
await page.waitForTimeout(100); // Wait for plugins to initialize
await page.waitForLoadState('domcontentloaded'); // Wait for plugins to initialize
// Plugin doesn't show snack bar on load, check plugin menu instead
await expect(page.locator(PLUGIN_MENU_ITEM)).toBeVisible({ timeout: 10000 });
@ -157,7 +155,7 @@ test.describe.serial('Plugin Lifecycle', () => {
}
}, 'API Test Plugin');
await page.waitForTimeout(100); // Wait for plugin to enable
await page.waitForLoadState('domcontentloaded'); // Wait for plugin to enable
// Find and disable the API Test Plugin
await page.evaluate((pluginName: string) => {
@ -177,7 +175,7 @@ test.describe.serial('Plugin Lifecycle', () => {
}
}, 'API Test Plugin');
await page.waitForTimeout(100); // Wait for plugin to disable
await page.waitForLoadState('domcontentloaded'); // Wait for plugin to disable
// Go back and verify menu entry is removed
await page.goto('/#/tag/TODAY');

View file

@ -21,8 +21,7 @@ test.describe.serial('Plugin Loading', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
@ -42,11 +41,11 @@ test.describe.serial('Plugin Loading', () => {
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Enable the plugin
const enableResult = await page.evaluate((pluginName: string) => {
await page.evaluate((pluginName: string) => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
const targetCard = cards.find((card) => {
const title = card.querySelector('mat-card-title')?.textContent || '';
@ -76,9 +75,6 @@ test.describe.serial('Plugin Loading', () => {
return { enabled: false, found: false };
}, 'API Test Plugin');
console.log(`Plugin "API Test Plugin" enable state:`, enableResult);
expect(enableResult.found).toBe(true);
await page.waitForLoadState('networkidle'); // Wait for plugin to initialize
// Navigate to plugin management
@ -98,7 +94,6 @@ test.describe.serial('Plugin Loading', () => {
};
});
console.log('Plugin cards found:', pluginCardsResult);
expect(pluginCardsResult.pluginCardsCount).toBeGreaterThanOrEqual(1);
expect(pluginCardsResult.pluginTitles).toContain('API Test Plugin');
@ -111,7 +106,7 @@ test.describe.serial('Plugin Loading', () => {
await page.click(PLUGIN_MENU_ENTRY);
await expect(page.locator(PLUGIN_IFRAME)).toBeVisible();
await expect(page).toHaveURL(/\/plugins\/api-test-plugin\/index/);
await page.waitForTimeout(1000); // Wait for iframe to load
await page.waitForLoadState('networkidle'); // Wait for iframe to load
// Switch to iframe context and verify content
const frame = page.frameLocator(PLUGIN_IFRAME);
@ -136,8 +131,7 @@ test.describe.serial('Plugin Loading', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
@ -157,7 +151,7 @@ test.describe.serial('Plugin Loading', () => {
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Enable the plugin first
@ -187,7 +181,7 @@ test.describe.serial('Plugin Loading', () => {
await expect(page.locator(PLUGIN_ITEM).first()).toBeVisible();
// Find the toggle for API Test Plugin and disable it
const disableResult = await page.evaluate(() => {
await page.evaluate(() => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
const apiTestCard = cards.find((card) => {
const title = card.querySelector('mat-card-title')?.textContent || '';
@ -212,7 +206,6 @@ test.describe.serial('Plugin Loading', () => {
return result;
});
console.log('Disable plugin result:', disableResult);
await page.waitForLoadState('networkidle'); // Give more time for plugin to unload
// Stay on the settings page, just wait for state to update
@ -229,9 +222,9 @@ test.describe.serial('Plugin Loading', () => {
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
const enableResult = await page.evaluate(() => {
await page.evaluate(() => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
const apiTestCard = cards.find((card) => {
const title = card.querySelector('mat-card-title')?.textContent || '';
@ -256,13 +249,12 @@ test.describe.serial('Plugin Loading', () => {
return result;
});
console.log('Re-enable plugin result:', enableResult);
await page.waitForLoadState('networkidle'); // Give time for plugin to reload
// Navigate back to main view
await page.click('.tour-projects'); // Click on projects/home navigation
await page.waitForLoadState('networkidle');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Verify menu entry is back
await expect(page.locator(PLUGIN_MENU_ENTRY)).toBeVisible();

View file

@ -17,8 +17,7 @@ test.describe.serial('Plugin Structure Test', () => {
// First ensure we're on the config page
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
// Scroll to plugins section
@ -26,8 +25,7 @@ test.describe.serial('Plugin Structure Test', () => {
if (pluginSection) {
pluginSection.scrollIntoView({ behavior: 'smooth', block: 'center' });
} else {
console.error('Plugin section not found');
return;
throw new Error('Plugin section not found');
}
// Make sure collapsible is expanded - click the header to toggle
@ -39,23 +37,21 @@ test.describe.serial('Plugin Structure Test', () => {
const header = collapsible.querySelector('.collapsible-header');
if (header) {
(header as HTMLElement).click();
console.log('Clicked to expand plugin collapsible');
} else {
console.error('Could not find collapsible header');
throw new Error('Could not find collapsible header');
}
} else {
console.log('Plugin collapsible already expanded');
}
} else {
console.error('Plugin collapsible not found');
throw new Error('Plugin collapsible not found');
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Check plugin card structure
const result = await page.evaluate(() => {
await page.evaluate(() => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
const apiTestCard = cards.find((card) => {
const title = card.querySelector('mat-card-title')?.textContent || '';
@ -98,7 +94,5 @@ test.describe.serial('Plugin Structure Test', () => {
})),
};
});
console.log('Plugin card structure:', JSON.stringify(result, null, 2));
});
});

View file

@ -27,8 +27,7 @@ test.describe.serial('Plugin Upload', () => {
await page.evaluate(() => {
const configPage = document.querySelector('.page-settings');
if (!configPage) {
console.error('Not on config page');
return;
throw new Error('Not on config page');
}
const pluginSection = document.querySelector('.plugin-section');
@ -48,7 +47,7 @@ test.describe.serial('Plugin Upload', () => {
}
});
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
await expect(page.locator('plugin-management')).toBeVisible({ timeout: 5000 });
// Upload plugin ZIP file
@ -73,7 +72,7 @@ test.describe.serial('Plugin Upload', () => {
// Verify uploaded plugin appears in list (there are multiple cards, so check first)
await expect(page.locator(PLUGIN_CARD).first()).toBeVisible();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
const pluginExists = await page.evaluate((pluginName: string) => {
const cards = Array.from(document.querySelectorAll('plugin-management mat-card'));
@ -148,7 +147,7 @@ test.describe.serial('Plugin Upload', () => {
}, TEST_PLUGIN_ID);
expect(disableResult).toBeTruthy();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Verify plugin is now disabled
const disabledStatus = await page.evaluate((pluginId: string) => {
@ -182,7 +181,7 @@ test.describe.serial('Plugin Upload', () => {
}, TEST_PLUGIN_ID);
expect(reEnableResult).toBeTruthy();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Verify plugin is enabled again
const reEnabledStatus = await page.evaluate((pluginId: string) => {
@ -233,7 +232,6 @@ test.describe.serial('Plugin Upload', () => {
};
}, TEST_PLUGIN_ID);
console.log('Removal verification:', removalResult);
expect(removalResult.removed).toBeTruthy();
});
});

View file

@ -49,7 +49,6 @@ test.describe.serial('Plugin Visibility', () => {
return pageResults;
});
console.log('Page structure results:', results);
expect(results).toBeTruthy();
});
@ -61,14 +60,12 @@ test.describe.serial('Plugin Visibility', () => {
await page.click(SETTINGS_BTN);
await page.waitForSelector(ROUTER_WRAPPER, { state: 'visible' });
const contentAnalysis = await page.evaluate(() => {
await page.evaluate(() => {
const configContent =
document.querySelector('.page-settings')?.innerHTML || 'No config page found';
console.log('Config page content length:', configContent.length);
// Look for any mentions of plugin
const pluginMentions = configContent.match(/plugin/gi) || [];
console.log('Plugin mentions found:', pluginMentions.length);
return {
contentLength: configContent.length,
@ -76,7 +73,5 @@ test.describe.serial('Plugin Visibility', () => {
hasPluginText: configContent.toLowerCase().includes('plugin'),
};
});
console.log('Content analysis:', contentAnalysis);
});
});

View file

@ -51,19 +51,19 @@ test.describe('Reminders View Task', () => {
// Wait for dialog
await page.waitForSelector(DIALOG_CONTAINER, { state: 'visible' });
await page.waitForTimeout(100);
await page.waitForLoadState('domcontentloaded');
// Set time
await page.waitForSelector(TIME_INP, { state: 'visible' });
await page.waitForTimeout(150);
await page.waitForLoadState('domcontentloaded');
// Focus and set time value
await page.click(TIME_INP);
await page.waitForTimeout(150);
await page.waitForLoadState('domcontentloaded');
// Clear and set value
await page.fill(TIME_INP, '');
await page.waitForTimeout(100);
await page.waitForLoadState('domcontentloaded');
// Set the time value
await page.evaluate(
@ -78,15 +78,15 @@ test.describe('Reminders View Task', () => {
{ selector: TIME_INP, value: timeValue },
);
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Also set value normally
await page.fill(TIME_INP, timeValue);
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Tab to commit value
await page.keyboard.press('Tab');
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Submit dialog
await page.waitForSelector(DIALOG_SUBMIT, { state: 'visible' });

View file

@ -20,7 +20,7 @@ test.describe('Task List - Start/Stop', () => {
await playBtn.click();
// Wait a moment for the class to be applied
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Verify the task has the 'isCurrent' class
await expect(firstTask).toHaveClass(/isCurrent/);
@ -32,7 +32,7 @@ test.describe('Task List - Start/Stop', () => {
await playBtn.click();
// Wait a moment for the class to be removed
await page.waitForTimeout(200);
await page.waitForLoadState('domcontentloaded');
// Verify the task no longer has the 'isCurrent' class
await expect(firstTask).not.toHaveClass(/isCurrent/);

View file

@ -20,7 +20,7 @@ test.describe('Work View Features', () => {
await workViewPage.waitForTaskList();
// Wait for any dialogs to be dismissed
await page.waitForTimeout(2000);
await page.waitForLoadState('networkidle');
// Verify undone task list is visible
await expect(page.locator(UNDONE_TASK_LIST)).toBeVisible({ timeout: 10000 });
@ -28,10 +28,10 @@ test.describe('Work View Features', () => {
// Create tasks
await workViewPage.addTask('Task 1');
await page.waitForSelector(TASK, { state: 'visible', timeout: 5000 });
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
await workViewPage.addTask('Task 2');
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Verify we have 2 tasks
await expect(page.locator(TASK)).toHaveCount(2);
@ -49,7 +49,7 @@ test.describe('Work View Features', () => {
await doneBtn.click();
// Wait a bit for the transition
await page.waitForTimeout(2000);
await page.waitForLoadState('networkidle');
// Check if done section exists (it might not show if there are no done tasks)
const doneSectionExists = await page
@ -62,7 +62,7 @@ test.describe('Work View Features', () => {
const toggleBtn = page.locator(TOGGLE_DONE_TASKS_BTN);
if (await toggleBtn.isVisible({ timeout: 1000 }).catch(() => false)) {
await toggleBtn.click();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
}
// Verify done task list is visible
@ -82,17 +82,17 @@ test.describe('Work View Features', () => {
// Wait for work view to be ready
await workViewPage.waitForTaskList();
await page.waitForTimeout(1000);
await page.waitForLoadState('networkidle');
// Create multiple tasks
await workViewPage.addTask('First created');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
await workViewPage.addTask('Second created');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
await workViewPage.addTask('Third created');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
await workViewPage.addTask('Fourth created');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify order (newest first)
await expect(page.locator('task:nth-of-type(1) textarea')).toHaveValue(

View file

@ -80,14 +80,14 @@ test.describe('Work View', () => {
// Wait for work view to be ready
await workViewPage.waitForTaskList();
await page.waitForTimeout(2000); // Wait for UI to stabilize
await page.waitForLoadState('networkidle'); // Wait for UI to stabilize
// Simply add two tasks using the standard method
await workViewPage.addTask('2 test task hihi');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
await workViewPage.addTask('3 some other task');
await page.waitForTimeout(500);
await page.waitForLoadState('networkidle');
// Verify both tasks are visible
const tasks = page.locator('task');