mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-19 10:43:08 +00:00
Fix: memory and context views mobile friendly (#818)
* Changes from fix/memory-and-context-mobile-friendly * fix: Improve file extension detection and add path traversal protection * refactor: Extract file extension utilities and add path traversal guards Code review improvements: - Extract isMarkdownFilename and isImageFilename to shared image-utils.ts - Remove duplicated code from context-view.tsx and memory-view.tsx - Add path traversal guard for context fixture utilities (matching memory) - Add 7 new tests for context fixture path traversal protection - Total 61 tests pass Addresses code review feedback from PR #813 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: Add e2e tests for profiles crud and board background persistence * Update apps/ui/playwright.config.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Add robust test navigation handling and file filtering * fix: Format NODE_OPTIONS configuration on single line * test: Update profiles and board background persistence tests * test: Replace iPhone 13 Pro with Pixel 5 for mobile test consistency * Update apps/ui/src/components/views/context-view.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: Remove test project directory * feat: Filter context files by type and improve mobile menu visibility --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -97,10 +97,22 @@ export async function deleteSelectedContextFile(page: Page): Promise<void> {
|
||||
*/
|
||||
export async function saveContextFile(page: Page): Promise<void> {
|
||||
await clickElement(page, 'save-context-file');
|
||||
// Wait for save to complete (button shows "Saved")
|
||||
// Wait for save to complete across desktop/mobile variants
|
||||
// On desktop: button text shows "Saved"
|
||||
// On mobile: icon-only button uses aria-label or title
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelector('[data-testid="save-context-file"]')?.textContent?.includes('Saved'),
|
||||
() => {
|
||||
const btn = document.querySelector('[data-testid="save-context-file"]');
|
||||
if (!btn) return false;
|
||||
const stateText = [
|
||||
btn.textContent ?? '',
|
||||
btn.getAttribute('aria-label') ?? '',
|
||||
btn.getAttribute('title') ?? '',
|
||||
]
|
||||
.join(' ')
|
||||
.toLowerCase();
|
||||
return stateText.includes('saved');
|
||||
},
|
||||
{ timeout: 5000 }
|
||||
);
|
||||
}
|
||||
@@ -138,13 +150,16 @@ export async function selectContextFile(
|
||||
): Promise<void> {
|
||||
const fileButton = await getByTestId(page, `context-file-${filename}`);
|
||||
|
||||
// Retry click + wait for delete button to handle timing issues
|
||||
// Retry click + wait for content panel to handle timing issues
|
||||
// Note: On mobile, delete button is hidden, so we wait for content panel instead
|
||||
await expect(async () => {
|
||||
// Use JavaScript click to ensure React onClick handler fires
|
||||
await fileButton.evaluate((el) => (el as HTMLButtonElement).click());
|
||||
// Wait for the file to be selected (toolbar with delete button becomes visible)
|
||||
const deleteButton = await getByTestId(page, 'delete-context-file');
|
||||
await expect(deleteButton).toBeVisible();
|
||||
// Wait for content to appear (editor, preview, or image)
|
||||
const contentLocator = page.locator(
|
||||
'[data-testid="context-editor"], [data-testid="markdown-preview"], [data-testid="image-preview"]'
|
||||
);
|
||||
await expect(contentLocator).toBeVisible();
|
||||
}).toPass({ timeout, intervals: [500, 1000, 2000] });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user