diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bfd06a1..8ea588c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -693,15 +693,10 @@ await table.generateConfigPrompt(); // Or see plugin docs ### 📚 Documentation -- Added AI-optimized migration guide (MIGRATION_v4.md) - Updated all examples to use `Strategies` object - Added TypeScript generic usage examples - Documented `revalidate()` method -### 🔧 Migration Guide - -See [MIGRATION_v4.md](./MIGRATION_v4.md) for detailed AI-assisted migration instructions. - **Quick Reference:** ```typescript // Before (v3.2) @@ -730,7 +725,7 @@ const data = await row.toJSON(); // Type: User --- -## [3.1.0] - 2024-12-XX +## [3.1.0] - 2025-12-29 ### 🚀 Major Changes @@ -829,7 +824,7 @@ const table = await useTable(page.locator('#example')).init(); --- -## [3.0.0] - 2024-12-XX +## [3.0.0] - 2025-12-29 ### 🚀 Major Changes diff --git a/src/presets/glide/headers.ts b/src/presets/glide/headers.ts index 615e9a0b..7d5d690d 100644 --- a/src/presets/glide/headers.ts +++ b/src/presets/glide/headers.ts @@ -1,4 +1,5 @@ import { StrategyContext, Selector } from '../../types'; +import { logDebug } from '../../utils/debugUtils'; /** * Scans for headers by finding a scrollable container and setting scrollLeft. @@ -50,11 +51,13 @@ export const scrollRightHeader = async (context: StrategyContext, options?: { li } } } else { - console.warn("HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers."); + logDebug(config, 'info', "HeaderStrategies.scrollRight: Could not find scroller. Returning visible headers."); } - await scrollerHandle.evaluate(el => el!.scrollLeft = 0); - await page.waitForTimeout(200); + if (isScrollerFound) { + await scrollerHandle.evaluate(el => el!.scrollLeft = 0); + await page.waitForTimeout(200); + } return Array.from(collectedHeaders); }; diff --git a/src/smartRow.ts b/src/smartRow.ts index 856c6e0f..c9f13326 100644 --- a/src/smartRow.ts +++ b/src/smartRow.ts @@ -181,40 +181,6 @@ const _navigateToCell = async (params: { throw new Error('Row index is required for navigation'); } - const navigateOnce = async () => { - // Get current position again to be sure - let currRow = 0; - let currCol = 0; - if (config.strategies.getActiveCell) { - const ac = await config.strategies.getActiveCell({ config, root: rootLocator, page, resolve }); - if (ac) { - currRow = ac.rowIndex; - currCol = ac.columnIndex; - } - } - - const rDiff = rowIndex - currRow; - const cDiff = index - currCol; - - // Move one step vertically - if (rDiff > 0 && nav.goDown) { - logDebug(config, 'verbose', '_navigateToCell: moving down'); - await nav.goDown(context); - } else if (rDiff < 0 && nav.goUp) { - logDebug(config, 'verbose', '_navigateToCell: moving up'); - await nav.goUp(context); - } - - // Move one step horizontally - if (cDiff > 0 && nav.goRight) { - logDebug(config, 'verbose', '_navigateToCell: moving right'); - await nav.goRight(context); - } else if (cDiff < 0 && nav.goLeft) { - logDebug(config, 'verbose', '_navigateToCell: moving left'); - await nav.goLeft(context); - } - }; - if (await targetReached()) { // Already there. If we have a barrier, check-in to stay in lock-step. if (barrier) await barrier.sync(index); diff --git a/src/strategies/fill.ts b/src/strategies/fill.ts index 9aceb837..7d51389d 100644 --- a/src/strategies/fill.ts +++ b/src/strategies/fill.ts @@ -75,7 +75,7 @@ export const FillStrategies = { const inputType = await inputLocator.getAttribute('type').catch(() => null); const isContentEditable = await inputLocator.getAttribute('contenteditable').catch(() => null); - // console.log(`[SmartTable] Filling "${columnName}" with value "${value}" (input: ${inputTag}, type: ${inputType})`); + if (inputType === 'checkbox' || inputType === 'radio') { // Boolean value for checkbox/radio diff --git a/src/strategies/headers.ts b/src/strategies/headers.ts index 1359c678..55b7a91d 100644 --- a/src/strategies/headers.ts +++ b/src/strategies/headers.ts @@ -1,5 +1,6 @@ // fallow-ignore-file circular-dependency import type { StrategyContext, Selector } from '../types'; +import { logDebug } from '../utils/debugUtils'; /** * Defines the contract for a header retrieval strategy. @@ -80,11 +81,13 @@ export const HeaderStrategies = { } } } else { - console.warn("HeaderStrategies.horizontalScroll: Could not find scroller. Returning visible headers."); + logDebug(config, 'info', "HeaderStrategies.horizontalScroll: Could not find scroller. Returning visible headers."); } - await scrollerHandle.evaluate(el => el!.scrollLeft = 0); - await page.waitForTimeout(200); + if (isScrollerFound) { + await scrollerHandle.evaluate(el => el!.scrollLeft = 0); + await page.waitForTimeout(200); + } return Array.from(collectedHeaders); }; diff --git a/src/strategies/pagination.ts b/src/strategies/pagination.ts index 387af94c..b764e5b6 100644 --- a/src/strategies/pagination.ts +++ b/src/strategies/pagination.ts @@ -1,6 +1,5 @@ // src/strategies/pagination.ts import type { PaginationStrategy, Selector, TableContext } from '../types'; -import { waitForCondition } from '../utils'; import { StabilizationStrategies, StabilizationStrategy } from './stabilization'; diff --git a/src/strategies/resolution.ts b/src/strategies/resolution.ts index e31acee3..91f2c117 100644 --- a/src/strategies/resolution.ts +++ b/src/strategies/resolution.ts @@ -1,5 +1,5 @@ // fallow-ignore-file circular-dependency -import { Locator, Page } from '@playwright/test'; +import { Locator } from '@playwright/test'; import { StrategyContext } from '../types'; // fallow-ignore-next-line unused-type diff --git a/src/useTable.ts b/src/useTable.ts index 7d1ae15b..ee48f41c 100644 --- a/src/useTable.ts +++ b/src/useTable.ts @@ -1,12 +1,8 @@ import type { Locator, Page } from '@playwright/test'; import { TableConfig, TableContext, Selector, TableResult, SmartRow as SmartRowType, FinalTableConfig, DedupeStrategy, PaginationStrategy, StrategyContext, TableStrategies as ITableStrategies, FilterValue } from './types'; -import { TYPE_CONTEXT } from './typeContext'; import { MINIMAL_CONFIG_CONTEXT } from './minimalConfigContext'; -import { SortingStrategies as ImportedSortingStrategies } from './strategies/sorting'; -import { PaginationStrategies as ImportedPaginationStrategies } from './strategies/pagination'; import { validatePaginationResult, validateSortingStrategy, validateFillStrategy } from './strategies/validation'; -import { DedupeStrategies as ImportedDedupeStrategies } from './strategies/dedupe'; import { LoadingStrategies as ImportedLoadingStrategies } from './strategies/loading'; import { FillStrategies } from './strategies/fill'; import { HeaderStrategies } from './strategies/headers';