MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / expandViewsFolder

Function expandViewsFolder

e2e/tasknotes.spec.ts:147–175  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

145test.describe('TaskNotes Views', () => {
146 // Helper to expand TaskNotes and Views folders if needed
147 async function expandViewsFolder(page: Page): Promise<void> {
148 // First ensure the sidebar is expanded
149 await ensureSidebarExpanded(page);
150
151 // First expand TaskNotes folder if collapsed
152 // The folder structure is: .nav-folder > .nav-folder-title (clickable) + .nav-folder-children
153 // When collapsed, .nav-folder has class 'is-collapsed'
154 const tasknotesFolder = page.locator('.nav-folder-title').filter({ hasText: /^TaskNotes$/ }).first();
155 if (await tasknotesFolder.isVisible({ timeout: 5000 }).catch(() => false)) {
156 // Check if the parent .nav-folder has is-collapsed
157 const parentFolder = tasknotesFolder.locator('xpath=ancestor::div[contains(@class, "nav-folder")][1]');
158 const isTasknotesCollapsed = await parentFolder.evaluate(el => el.classList.contains('is-collapsed')).catch(() => true);
159 if (isTasknotesCollapsed) {
160 await tasknotesFolder.click();
161 await page.waitForTimeout(500);
162 }
163 }
164
165 // Then expand Views folder if collapsed
166 const viewsFolder = page.locator('.nav-folder-title').filter({ hasText: /^Views$/ });
167 if (await viewsFolder.isVisible({ timeout: 5000 }).catch(() => false)) {
168 const parentFolder = viewsFolder.locator('xpath=ancestor::div[contains(@class, "nav-folder")][1]');
169 const isCollapsed = await parentFolder.evaluate(el => el.classList.contains('is-collapsed')).catch(() => true);
170 if (isCollapsed) {
171 await viewsFolder.click();
172 await page.waitForTimeout(500);
173 }
174 }
175 }
176
177 test('should open kanban board via sidebar', async () => {
178 const page = getPage();

Callers 1

tasknotes.spec.tsFile · 0.70

Calls 2

ensureSidebarExpandedFunction · 0.85
containsMethod · 0.80

Tested by

no test coverage detected