mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-18 10:23:07 +00:00
Make memory and context views mobile-friendly (#813)
* 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 --------- 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:
@@ -1,6 +1,5 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
import { getByTestId, getButtonByText } from './elements';
|
||||
import { waitForSplashScreenToDisappear } from './waiting';
|
||||
|
||||
/**
|
||||
* Get the platform-specific modifier key (Meta for Mac, Control for Windows/Linux)
|
||||
@@ -23,10 +22,10 @@ export async function pressModifierEnter(page: Page): Promise<void> {
|
||||
* Waits for the element to be visible before clicking to avoid flaky tests
|
||||
*/
|
||||
export async function clickElement(page: Page, testId: string): Promise<void> {
|
||||
// Wait for splash screen to disappear first (safety net)
|
||||
await waitForSplashScreenToDisappear(page, 5000);
|
||||
// Splash screen waits are handled by navigation helpers (navigateToContext, navigateToMemory, etc.)
|
||||
// before any clickElement calls, so we skip the splash check here to avoid blocking when
|
||||
// other fixed overlays (e.g. HeaderActionsPanel backdrop at z-[60]) are present on the page.
|
||||
const element = page.locator(`[data-testid="${testId}"]`);
|
||||
// Wait for element to be visible and stable before clicking
|
||||
await element.waitFor({ state: 'visible', timeout: 10000 });
|
||||
await element.click();
|
||||
}
|
||||
|
||||
@@ -54,13 +54,16 @@ export async function waitForElementHidden(
|
||||
*/
|
||||
export async function waitForSplashScreenToDisappear(page: Page, timeout = 5000): Promise<void> {
|
||||
try {
|
||||
// Check if splash screen is shown via sessionStorage first (fastest check)
|
||||
const splashShown = await page.evaluate(() => {
|
||||
return sessionStorage.getItem('automaker-splash-shown') === 'true';
|
||||
// Check if splash screen is disabled or already shown (fastest check)
|
||||
const splashDisabled = await page.evaluate(() => {
|
||||
return (
|
||||
localStorage.getItem('automaker-disable-splash') === 'true' ||
|
||||
localStorage.getItem('automaker-splash-shown-session') === 'true'
|
||||
);
|
||||
});
|
||||
|
||||
// If splash is already marked as shown, it won't appear, so we're done
|
||||
if (splashShown) {
|
||||
// If splash is disabled or already shown, it won't appear, so we're done
|
||||
if (splashDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,8 +72,11 @@ export async function waitForSplashScreenToDisappear(page: Page, timeout = 5000)
|
||||
// We check for elements that match the splash screen pattern
|
||||
await page.waitForFunction(
|
||||
() => {
|
||||
// Check if splash is marked as shown in sessionStorage
|
||||
if (sessionStorage.getItem('automaker-splash-shown') === 'true') {
|
||||
// Check if splash is disabled or already shown
|
||||
if (
|
||||
localStorage.getItem('automaker-disable-splash') === 'true' ||
|
||||
localStorage.getItem('automaker-splash-shown-session') === 'true'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user