Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions dev-setup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off

if not "%OS%"=="Windows_NT" (
echo This script must be run on Windows only.
exit /b 1
)

set APP_NAME=ai-code-fusion
set APP_DATA=%APPDATA%\%APP_NAME%

echo === Cleaning app settings ===
if exist "%APP_DATA%" (
echo Removing %APP_DATA%...
rmdir /s /q "%APP_DATA%"
) else (
echo No settings found at %APP_DATA%, skipping.
)

echo.
echo === Installing dependencies ===
call npm install

echo.
echo === Starting in dev mode ===
call npm run dev
31 changes: 31 additions & 0 deletions dev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Detect OS and set app data path
case "$(uname -s)" in
Linux*)
APP_DATA="$HOME/.config/ai-code-fusion"
;;
Darwin*)
APP_DATA="$HOME/Library/Application Support/ai-code-fusion"
;;
*)
echo "Unsupported OS. Use dev-setup.bat on Windows."
exit 1
;;
esac

echo "=== Cleaning app settings ==="
if [ -d "$APP_DATA" ]; then
echo "Removing $APP_DATA..."
rm -rf "$APP_DATA"
else
echo "No settings found at $APP_DATA, skipping."
fi

echo ""
echo "=== Installing dependencies ==="
npm install

echo ""
echo "=== Starting in dev mode ==="
npm run dev
39 changes: 37 additions & 2 deletions scripts/capture-ui-screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,19 @@ const UI_SELECTORS = {
secretFileEntry: `[title="${MOCK_SECRET_FILE_PATH}"]`,
refreshFileListButton: 'button[title="Refresh the file list"]',
fileTreeScrollContainer: '.file-tree .overflow-auto',
processSelectedFilesButton: '[data-testid="process-selected-files-button"]',
};

async function setupMockElectronApi(page) {
await page.addInitScript(
({ mockRootPath, mockConfig, mockDirectoryTree, mockFilteredDirectoryTree, fixedMtime }) => {
localStorage.clear();
sessionStorage.clear();
localStorage.setItem('rootPath', mockRootPath);
localStorage.setItem('configContent', mockConfig);

const cloneTree = (treeItems) => JSON.parse(JSON.stringify(treeItems));
const delay = (durationMs) => new Promise((resolve) => window.setTimeout(resolve, durationMs));

window.electronAPI = {
getDefaultConfig: async () => mockConfig,
Expand Down Expand Up @@ -368,11 +372,14 @@ async function setupMockElectronApi(page) {
processedFiles: 0,
},
}),
countFilesTokens: async (files) => {
countFilesTokens: async (options) => {
const filePaths = Array.isArray(options?.filePaths) ? options.filePaths : [];
const results = {};
const stats = {};

for (const filePath of files) {
await delay(450);

for (const filePath of filePaths) {
results[filePath] = 120;
stats[filePath] = { mtime: fixedMtime, size: 1024 };
}
Expand Down Expand Up @@ -495,6 +502,34 @@ async function captureAppStateScreenshots(page) {
});
});

await runStep('Verify process button shows selecting state during token counting', async () => {
await page.waitForFunction((selector) => {
const button = document.querySelector(selector);
if (!(button instanceof HTMLButtonElement)) {
return false;
}

return (
button.disabled &&
/selecting files\.\.\./i.test(button.textContent || '') &&
Boolean(button.querySelector('svg.animate-spin'))
);
}, UI_SELECTORS.processSelectedFilesButton);
});

await runStep('Verify process button re-enables after token counting completes', async () => {
await page.waitForFunction((selector) => {
const button = document.querySelector(selector);
if (!(button instanceof HTMLButtonElement)) {
return false;
}

const buttonLabel = button.textContent || '';
const hasSpinner = Boolean(button.querySelector('svg.animate-spin'));
return !button.disabled && /process selected files/i.test(buttonLabel) && !hasSpinner;
}, UI_SELECTORS.processSelectedFilesButton);
});

await runStep('Capture selected file screenshot', async () => {
await page.screenshot({ path: SCREENSHOTS.sourceSelected, fullPage: true });
});
Expand Down
Loading
Loading