From 42792aec85033bbcea169ef84eba83ef12ad74ae Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:08:56 +0800 Subject: [PATCH 1/7] test: add remote real-component mobile groups layout checkpoint --- .../scripts/mobile-groups-search-browser.mjs | 174 ++++++++++++++++++ .github/workflows/mobile-groups-search.yml | 84 +++++++++ 2 files changed, 258 insertions(+) create mode 100644 .github/scripts/mobile-groups-search-browser.mjs create mode 100644 .github/workflows/mobile-groups-search.yml diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs new file mode 100644 index 000000000000..56ab3207e7d4 --- /dev/null +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -0,0 +1,174 @@ +// Remote CI only. Real GroupsView, AppLayout, AppHeader, TablePageLayout, +// DataTable, Select, Pagination, dialogs, API client and compiled project CSS. +// Only authentication/settings, unrelated navigation/onboarding and API responses are synthetic. +import assert from 'node:assert/strict' +import { execFileSync } from 'node:child_process' +import fs from 'node:fs/promises' +import { createRequire } from 'node:module' +import path from 'node:path' +import { pathToFileURL } from 'node:url' + +const root = process.cwd(), appRoot = process.env.GROUPS_APP_ROOT || root +const frontend = path.join(appRoot, 'frontend'), out = process.env.GROUPS_EVIDENCE_DIR +assert(process.env.CI && out, 'Application execution is allowed only on remote CI') +const head = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim() +assert.equal(head, process.env.GROUPS_EXPECTED_HEAD) +const baseline = '338528c48fc480fa998c984d923b049841e20039' +const scope = appRoot === root ? 'head' : 'baseline' +await fs.mkdir(out, { recursive: true }) +const fixture = path.join(frontend, '.mobile-groups-fixture') +await fs.mkdir(fixture, { recursive: true }) +const stores = `import {reactive} from 'vue'; +const auth=reactive({user:{id:41,role:'admin',username:'演示管理员',balance:0},isAdmin:true,isSimpleMode:false}); +const app=reactive({sidebarCollapsed:false,cachedPublicSettings:{subscription_enabled:false,model_plaza_enabled:false},docUrl:'',contactInfo:'',showError:m=>{throw Error(m)},showSuccess:()=>{},toggleMobileSidebar:()=>{}}); +export const useAuthStore=()=>auth;export const useAppStore=()=>app; +export const useAdminSettingsStore=()=>({customMenuItems:[]}); +export const useOnboardingStore=()=>({setReplayCallback:()=>{},isCurrentStep:()=>false,nextStep:()=>{},replay:()=>{}});` +await fs.writeFile(path.join(fixture, 'stores.js'), stores) +await fs.writeFile(path.join(fixture, 'empty.js'), 'export default {render:()=>null};') +await fs.writeFile(path.join(fixture, 'tour.js'), 'export const useOnboardingTour=()=>({replayTour:()=>{}});') +await fs.writeFile(path.join(fixture, 'index.html'), `
`) +const requireFrontend = createRequire(path.join(frontend, 'package.json')) +const { createServer } = requireFrontend('vite') +const vueModule = requireFrontend('@vitejs/plugin-vue') +const tailwind = requireFrontend('tailwindcss'), autoprefixer = requireFrontend('autoprefixer') +const { default: theme } = await import(pathToFileURL(path.join(frontend, 'tailwind.config.js'))) +const { chromium } = createRequire(path.join(process.env.PLAYWRIGHT_ROOT, 'package.json'))('playwright') +const alias = (find, name) => ({ find, replacement: path.join(fixture, `${name}.js`) }) +const server = await createServer({ root: frontend, configFile: false, envFile: false, + plugins: [vueModule.default ? vueModule.default() : vueModule(), { + name: 'synthetic-unrelated-sidebar', enforce: 'pre', + resolveId(source, importer) { + if (source === './AppSidebar.vue' && importer?.endsWith('/AppLayout.vue')) return path.join(fixture, 'empty.js') + }, + }], + resolve: { alias: [ + alias(/^@\/stores$/, 'stores'), ...['app','auth','adminSettings','onboarding'].map(name => alias(`@/stores/${name}`, 'stores')), + alias('@/composables/useOnboardingTour', 'tour'), alias('@/components/common/AnnouncementBell.vue', 'empty'), + { find: '@', replacement: path.join(frontend, 'src') }, + { find: 'vue-i18n', replacement: 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js' }, + ] }, + css: { postcss: { plugins: [tailwind({ ...theme, content: [path.join(frontend, 'src/**/*.{vue,js,ts}'), path.join(fixture, '*.{html,js}')] }), autoprefixer()] } }, + define: { __INTLIFY_JIT_COMPILATION__: true }, + server: { host: '127.0.0.1', port: 4187, strictPort: true, fs: { allow: [root, appRoot] } }, + optimizeDeps: { entries: [path.join(fixture, 'index.html')], include: ['vue','pinia','vue-router','vue-i18n','axios'] }, +}) +const groups = Array.from({ length: 20 }, (_, i) => ({ + id: i + 1, name: i === 0 ? '搜索目标演示组' : `演示分组 ${String(i + 1).padStart(2, '0')}`, + platform: i % 2 ? 'anthropic' : 'openai', status: 'active', subscription_type: 'standard', + rate_multiplier: 1, is_exclusive: false, account_count: 3, active_account_count: 3, + sort_order: i, supported_model_scopes: [], created_at: '2026-11-01T00:00:00Z', updated_at: '2026-11-01T00:00:00Z', +})) +const measurements = [], requests = [], errors = [], external = [], violations = [], screenshots = [] +let browser, page +function check(value, message) { if (!value) violations.push(message) } +async function shot(name) { + await page.screenshot({ path: path.join(out, `${name}.png`), fullPage: false, animations: 'disabled' }) + screenshots.push({ name, viewport: page.viewportSize() }) +} +async function geometry(label) { + const value = await page.evaluate(() => { + const rect = el => { + if (!el) return null + const r = el.getBoundingClientRect(), s = getComputedStyle(el) + return { top:r.top,bottom:r.bottom,left:r.left,right:r.right,height:r.height,width:r.width, + scrollTop:el.scrollTop,scrollHeight:el.scrollHeight,clientHeight:el.clientHeight,scrollWidth:el.scrollWidth,clientWidth:el.clientWidth, + position:s.position,overflowX:s.overflowX,overflowY:s.overflowY,flexShrink:s.flexShrink,display:s.display } + } + const search = document.querySelector('.layout-section-fixed input'), r = search.getBoundingClientRect() + const hit = document.elementFromPoint(r.left+r.width/2, r.top+r.height/2) + return { viewport:{width:innerWidth,height:innerHeight},scrollX,scrollY,document:rect(document.documentElement), + header:rect(document.querySelector('header')),main:rect(document.querySelector('main')),layout:rect(document.querySelector('.table-page-layout')), + toolbar:rect(document.querySelector('.layout-section-fixed')),content:rect(document.querySelector('.layout-section-scrollable')), + table:rect(document.querySelector('.table-wrapper')),search:rect(search),searchHit:hit===search,hitTag:hit?.tagName,hitClass:hit?.className, + ancestors:[...function*(el){while(el){yield el;el=el.parentElement}}(search)].map(el=>({tag:el.tagName,class:el.className,...rect(el)})), + scrollContainers:[...document.querySelectorAll('body *')].filter(el=>el.clientHeight>0&&el.scrollHeight>el.clientHeight+1&&/(auto|scroll|hidden)/.test(getComputedStyle(el).overflowY)).map(el=>({tag:el.tagName,class:el.className,...rect(el)})), + } + }) + measurements.push({label,...value});return value +} +async function top() { + await page.evaluate(() => window.scrollTo({top:0,left:0,behavior:'instant'})) + await page.waitForFunction(() => scrollY===0) +} +async function searchUsable(label) { + const g = await geometry(label) + check(g.search.top>=g.header.bottom && g.search.bottom<=g.viewport.height && g.search.left>=0 && g.search.right<=g.viewport.width && g.searchHit, `${label}: search must be fully visible and hit-testable; ${JSON.stringify({search:g.search,header:g.header,hit:g.hitTag})}`) + check(g.document.scrollWidth<=g.viewport.width && g.scrollX===0, `${label}: document must not overflow horizontally`) + return g +} +try { + await server.listen();browser=await chromium.launch({headless:true}) + const context=await browser.newContext({viewport:{width:375,height:667},timezoneId:'UTC'}) + await context.route('**/*', async route => { + const url=new URL(route.request().url()) + if(url.origin!=='http://127.0.0.1:4187'){external.push(url.origin);return route.abort()} + if(!url.pathname.startsWith('/api/'))return route.continue() + const request={path:url.pathname,query:Object.fromEntries(url.searchParams),method:route.request().method()};requests.push(request) + assert.equal(request.method,'GET','No API mutations in this browser fixture') + let data + if(url.pathname==='/api/v1/admin/groups'){ + const search=url.searchParams.get('search')||'', platform=url.searchParams.get('platform') + const items=groups.filter(g=>g.name.includes(search)&&(!platform||g.platform===platform)) + data={items,total:items.length,page:1,page_size:20,pages:1} + } else if(url.pathname==='/api/v1/admin/groups/all')data=groups + else if(/\/groups\/(usage-summary|capacity-summary)$/.test(url.pathname))data=[] + else if(url.pathname==='/api/v1/admin/groups/live-capability')data={supported:false,reason:'synthetic'} + else if(/\/groups\/\d+\/model-allowlist-candidates$/.test(url.pathname))data=[] + else {errors.push('Unexpected API '+url.pathname);return route.fulfill({status:500,json:{code:500,message:'Unexpected fixture API'}})} + return route.fulfill({json:{code:0,message:'',data}}) + }) + page=await context.newPage();page.setDefaultTimeout(15000) + page.on('pageerror',e=>errors.push(e.message)) + await page.goto('http://127.0.0.1:4187/.mobile-groups-fixture/index.html',{waitUntil:'networkidle'}) + await page.getByText('搜索目标演示组',{exact:true}).first().waitFor() + await page.evaluate(()=>document.fonts.ready) + // Guard against an unstyled fixture before treating any assertion as a behavioral RED. + const css=await page.evaluate(()=>({header:getComputedStyle(document.querySelector('header')).position,headerHeight:document.querySelector('header>div').getBoundingClientRect().height,padding:getComputedStyle(document.querySelector('main')).paddingTop,toolbarShrink:getComputedStyle(document.querySelector('.layout-section-fixed')).flexShrink,display:getComputedStyle(document.querySelector('.table-page-layout')).display})) + assert.deepEqual(css,{header:'sticky',headerHeight:64,padding:'16px',toolbarShrink:'0',display:'flex'},'CSS_SETUP: actual Tailwind utilities must be compiled') + for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:375,height:400},{width:1280,height:900}]){ + await page.setViewportSize(viewport);await top() + const label=`${viewport.width}x${viewport.height}` + const g=await searchUsable(`${label}-top`) + await shot(`${label}-top`) + if(viewport.width<1024){ + check(g.layout.bottom>=g.content.bottom-1,`${label}: mobile layout must contain card content so the header sticky boundary follows the document; layout.bottom=${g.layout.bottom}, content.bottom=${g.content.bottom}`) + await page.evaluate(()=>window.scrollTo({top:Math.round((document.documentElement.scrollHeight-innerHeight)/2),behavior:'instant'})) + const mid=await geometry(`${label}-middle`) + check(Math.abs(mid.header.top)<1,`${label}: header must remain at document top while scrolling cards; header.top=${mid.header.top}, scrollY=${mid.scrollY}`) + await shot(`${label}-middle`) + } else { + assert.equal(await page.locator('table').count(),1,'Desktop list must render') + await page.locator('.table-wrapper').evaluate(el=>{el.scrollTop=el.scrollHeight/2}) + await geometry(`${label}-table-middle`) + await page.locator('.table-wrapper').evaluate(el=>{el.scrollTop=0}) + } + await top();await searchUsable(`${label}-returned-top`) + } + await page.setViewportSize({width:375,height:667});await top() + const search=page.locator('.layout-section-fixed input') + // Keyboard traversal, actual debounced API request and rendered filtering. + await page.getByRole('button',{name:'Select option'}).first().focus();await page.keyboard.press('Shift+Tab') + assert(await search.evaluate(el=>el===document.activeElement),'Search must be reachable by keyboard') + await page.keyboard.type('搜索目标') + await page.waitForFunction(()=>document.querySelectorAll('[data-field="name"]').length===1) + assert(requests.some(r=>r.path==='/api/v1/admin/groups'&&r.query.search==='搜索目标'),'Typed search must reach the real API client') + await searchUsable('filtered-search') + await search.fill('');await page.waitForFunction(()=>document.querySelectorAll('[data-field="name"]').length===20) + assert.deepEqual(errors,[],'No setup/runtime errors accepted as behavioral RED');assert.deepEqual(external,[]) + if(violations.length)throw new Error('GROUPS_LAYOUT_REGRESSION\n'+violations.join('\n')) + console.log('GROUPS_BROWSER_GREEN: real components, compiled CSS, scroll/resize and search assertions passed') +} catch(error) { + if(page)await shot('failure').catch(()=>{}) + await fs.writeFile(path.join(out,'failure.txt'),String(error.stack||error)) + throw error +} finally { + await fs.writeFile(path.join(out,'manifest.json'),JSON.stringify({head,baseline,scope,productionSHA:scope==='baseline'?baseline:head,synthetic:true,browser:'Playwright Chromium; viewport emulation, not physical mobile/keyboard',actualComponents:['GroupsView','AppLayout','AppHeader','TablePageLayout','DataTable','Select','Pagination','BaseDialog'],screenshots,measurements,requests,errors,external,violations},null,2)) + if(browser)await browser.close();await server.close() + await fs.rm(fixture,{recursive:true,force:true}) +} diff --git a/.github/workflows/mobile-groups-search.yml b/.github/workflows/mobile-groups-search.yml new file mode 100644 index 000000000000..82f124695a5a --- /dev/null +++ b/.github/workflows/mobile-groups-search.yml @@ -0,0 +1,84 @@ +name: Mobile groups search + +on: + push: + branches: [fix/mobile-groups-search] + pull_request: + paths: + - 'frontend/src/views/admin/GroupsView.vue' + - 'frontend/src/components/layout/TablePageLayout.vue' + - 'frontend/src/components/layout/AppLayout.vue' + - 'frontend/src/components/layout/AppHeader.vue' + - 'frontend/src/components/common/DataTable.vue' + - 'frontend/src/style.css' + - '.github/scripts/mobile-groups-search-browser.mjs' + - '.github/workflows/mobile-groups-search.yml' + +permissions: + contents: read + +concurrency: + group: mobile-groups-search-${{ github.event.pull_request.head.ref || github.ref_name }} + cancel-in-progress: true + +jobs: + browser: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + - uses: pnpm/action-setup@v6 + with: + version: 9 + - uses: actions/setup-node@v6 + with: + node-version: '22' + cache: pnpm + cache-dependency-path: frontend/pnpm-lock.yaml + - run: pnpm --dir frontend install --frozen-lockfile + - name: Install isolated browser + run: | + npm install --prefix "$RUNNER_TEMP/groups-browser" --no-save --ignore-scripts playwright@1.56.1 + "$RUNNER_TEMP/groups-browser/node_modules/.bin/playwright" install --with-deps chromium + sudo apt-get install -y fonts-noto-cjk + - name: Pinned baseline behavioral RED + env: + GROUPS_EXPECTED_HEAD: ${{ github.event.pull_request.head.sha || github.sha }} + GROUPS_EVIDENCE_DIR: ${{ runner.temp }}/groups-evidence/baseline + GROUPS_APP_ROOT: ${{ runner.temp }}/groups-baseline + PLAYWRIGHT_ROOT: ${{ runner.temp }}/groups-browser/node_modules/playwright + run: | + mkdir -p "$GROUPS_APP_ROOT" "$GROUPS_EVIDENCE_DIR" + git archive 338528c48fc480fa998c984d923b049841e20039 | tar -x -C "$GROUPS_APP_ROOT" + ln -s "$GITHUB_WORKSPACE/frontend/node_modules" "$GROUPS_APP_ROOT/frontend/node_modules" + set +e + node .github/scripts/mobile-groups-search-browser.mjs 2>&1 | tee "$GROUPS_EVIDENCE_DIR/browser.log" + result=${PIPESTATUS[0]} + set -e + test "$result" -ne 0 + grep -q 'GROUPS_LAYOUT_REGRESSION' "$GROUPS_EVIDENCE_DIR/browser.log" + - name: Current head browser acceptance + env: + GROUPS_EXPECTED_HEAD: ${{ github.event.pull_request.head.sha || github.sha }} + GROUPS_EVIDENCE_DIR: ${{ runner.temp }}/groups-evidence/head + PLAYWRIGHT_ROOT: ${{ runner.temp }}/groups-browser/node_modules/playwright + run: | + mkdir -p "$GROUPS_EVIDENCE_DIR" + node .github/scripts/mobile-groups-search-browser.mjs 2>&1 | tee "$GROUPS_EVIDENCE_DIR/browser.log" + - name: Focused Groups and layout regressions + run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/GroupsView.columnSettings.spec.ts src/views/admin/__tests__/GroupsView.duplicate.spec.ts src/views/admin/__tests__/GroupsView.streamOnly.spec.ts src/views/admin/__tests__/GroupsView.compositePlatforms.spec.ts src/views/admin/__tests__/GroupsView.codexCLIOnly.spec.ts src/views/admin/__tests__/GroupsView.codexManifest.spec.ts src/components/common/__tests__/DataTable.spec.ts + - name: Production frontend build and type check + run: pnpm --dir frontend run build + - name: Evidence checksums + if: always() + run: | + cd "$RUNNER_TEMP/groups-evidence" + find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS + - uses: actions/upload-artifact@v7 + if: always() + with: + name: mobile-groups-search-${{ github.event.pull_request.head.sha || github.sha }} + path: ${{ runner.temp }}/groups-evidence From 68e5efc2095b620b98d4802f17bc3c4464273c49 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:14:15 +0800 Subject: [PATCH 2/7] test: isolate unrelated navigation and complete groups interactions --- .../scripts/mobile-groups-search-browser.mjs | 27 ++++++++++++++----- .github/workflows/mobile-groups-search.yml | 5 +++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index 56ab3207e7d4..4c21394bfd4f 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -41,15 +41,11 @@ const { default: theme } = await import(pathToFileURL(path.join(frontend, 'tailw const { chromium } = createRequire(path.join(process.env.PLAYWRIGHT_ROOT, 'package.json'))('playwright') const alias = (find, name) => ({ find, replacement: path.join(fixture, `${name}.js`) }) const server = await createServer({ root: frontend, configFile: false, envFile: false, - plugins: [vueModule.default ? vueModule.default() : vueModule(), { - name: 'synthetic-unrelated-sidebar', enforce: 'pre', - resolveId(source, importer) { - if (source === './AppSidebar.vue' && importer?.endsWith('/AppLayout.vue')) return path.join(fixture, 'empty.js') - }, - }], + plugins: [vueModule.default ? vueModule.default() : vueModule()], resolve: { alias: [ alias(/^@\/stores$/, 'stores'), ...['app','auth','adminSettings','onboarding'].map(name => alias(`@/stores/${name}`, 'stores')), alias('@/composables/useOnboardingTour', 'tour'), alias('@/components/common/AnnouncementBell.vue', 'empty'), + alias(/(?:.*\/)?AppSidebar\.vue$/, 'empty'), alias('@/components/common/SubscriptionProgressMini.vue', 'empty'), { find: '@', replacement: path.join(frontend, 'src') }, { find: 'vue-i18n', replacement: 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js' }, ] }, @@ -159,7 +155,26 @@ try { await page.waitForFunction(()=>document.querySelectorAll('[data-field="name"]').length===1) assert(requests.some(r=>r.path==='/api/v1/admin/groups'&&r.query.search==='搜索目标'),'Typed search must reach the real API client') await searchUsable('filtered-search') + await page.setViewportSize({width:375,height:320}) + await searchUsable('focused-search-simulated-keyboard') + assert(await search.evaluate(el=>el===document.activeElement),'Viewport resize must retain search focus') + await page.setViewportSize({width:375,height:667}) await search.fill('');await page.waitForFunction(()=>document.querySelectorAll('[data-field="name"]').length===20) + await page.locator('.layout-section-fixed .select-trigger').first().click() + await page.getByRole('option',{name:'OpenAI',exact:true}).click() + await page.waitForFunction(()=>document.querySelectorAll('[data-field="name"]').length===10) + assert(requests.some(r=>r.query.platform==='openai'),'Platform filter must reach the API') + const response=page.waitForResponse(r=>new URL(r.url()).pathname==='/api/v1/admin/groups') + await page.getByTitle('刷新',{exact:true}).click();await response + const sortResponse=page.waitForResponse(r=>new URL(r.url()).pathname==='/api/v1/admin/groups'&&new URL(r.url()).searchParams.get('sort_by')==='name') + await page.locator('[data-test="mobile-sort-controls"] select').selectOption('name');await sortResponse + await page.getByTitle('排序',{exact:true}).click() + const sortDialog=page.getByRole('dialog',{name:'排序',exact:true}) + await sortDialog.waitFor();await sortDialog.getByLabel('Close modal').click();await sortDialog.waitFor({state:'hidden'}) + await page.locator('[data-tour="groups-create-btn"]').click() + const createDialog=page.getByRole('dialog',{name:'创建分组',exact:true}) + await createDialog.waitFor();await createDialog.getByLabel('Close modal').click();await createDialog.waitFor({state:'hidden'}) + await top();await searchUsable('toolbar-actions-returned-top') assert.deepEqual(errors,[],'No setup/runtime errors accepted as behavioral RED');assert.deepEqual(external,[]) if(violations.length)throw new Error('GROUPS_LAYOUT_REGRESSION\n'+violations.join('\n')) console.log('GROUPS_BROWSER_GREEN: real components, compiled CSS, scroll/resize and search assertions passed') diff --git a/.github/workflows/mobile-groups-search.yml b/.github/workflows/mobile-groups-search.yml index 82f124695a5a..dda1f325cb9d 100644 --- a/.github/workflows/mobile-groups-search.yml +++ b/.github/workflows/mobile-groups-search.yml @@ -69,12 +69,15 @@ jobs: mkdir -p "$GROUPS_EVIDENCE_DIR" node .github/scripts/mobile-groups-search-browser.mjs 2>&1 | tee "$GROUPS_EVIDENCE_DIR/browser.log" - name: Focused Groups and layout regressions - run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/GroupsView.columnSettings.spec.ts src/views/admin/__tests__/GroupsView.duplicate.spec.ts src/views/admin/__tests__/GroupsView.streamOnly.spec.ts src/views/admin/__tests__/GroupsView.compositePlatforms.spec.ts src/views/admin/__tests__/GroupsView.codexCLIOnly.spec.ts src/views/admin/__tests__/GroupsView.codexManifest.spec.ts src/components/common/__tests__/DataTable.spec.ts + run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/GroupsView.columnSettings.spec.ts src/views/admin/__tests__/GroupsView.duplicate.spec.ts src/views/admin/__tests__/GroupsView.streamOnly.spec.ts src/views/admin/__tests__/GroupsView.compositePlatforms.spec.ts src/views/admin/__tests__/GroupsView.codexCLIOnly.spec.ts src/views/admin/__tests__/GroupsView.codexManifest.spec.ts src/components/common/__tests__/DataTable.spec.ts src/components/layout/__tests__/TablePageLayout.spec.ts + - name: Check changed component lint + run: pnpm --dir frontend exec eslint src/components/layout/TablePageLayout.vue src/views/admin/GroupsView.vue - name: Production frontend build and type check run: pnpm --dir frontend run build - name: Evidence checksums if: always() run: | + mkdir -p "$RUNNER_TEMP/groups-evidence" cd "$RUNNER_TEMP/groups-evidence" find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS - uses: actions/upload-artifact@v7 From 988338ca973c17da654c0d2fa228f873f7036a8d Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:19:53 +0800 Subject: [PATCH 3/7] fix: let mobile table pages grow with their scrollable content --- .../scripts/mobile-groups-search-browser.mjs | 14 ++++++++++---- .github/workflows/mobile-groups-search.yml | 17 +++++++++-------- .../src/components/layout/TablePageLayout.vue | 5 +++++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index 4c21394bfd4f..ce89fabfc3e6 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -3,6 +3,7 @@ // Only authentication/settings, unrelated navigation/onboarding and API responses are synthetic. import assert from 'node:assert/strict' import { execFileSync } from 'node:child_process' +import { createHash } from 'node:crypto' import fs from 'node:fs/promises' import { createRequire } from 'node:module' import path from 'node:path' @@ -61,7 +62,11 @@ const groups = Array.from({ length: 20 }, (_, i) => ({ sort_order: i, supported_model_scopes: [], created_at: '2026-11-01T00:00:00Z', updated_at: '2026-11-01T00:00:00Z', })) const measurements = [], requests = [], errors = [], external = [], violations = [], screenshots = [] -let browser, page +let browser, page, css, outcome = 'setup-or-interaction-failure' +const sourceHashes = {} +for (const file of ['src/views/admin/GroupsView.vue','src/components/layout/AppLayout.vue','src/components/layout/AppHeader.vue','src/components/layout/TablePageLayout.vue','src/components/common/DataTable.vue','src/style.css','tailwind.config.js']) { + sourceHashes[file] = createHash('sha256').update(await fs.readFile(path.join(frontend,file))).digest('hex') +} function check(value, message) { if (!value) violations.push(message) } async function shot(name) { await page.screenshot({ path: path.join(out, `${name}.png`), fullPage: false, animations: 'disabled' }) @@ -125,9 +130,9 @@ try { await page.getByText('搜索目标演示组',{exact:true}).first().waitFor() await page.evaluate(()=>document.fonts.ready) // Guard against an unstyled fixture before treating any assertion as a behavioral RED. - const css=await page.evaluate(()=>({header:getComputedStyle(document.querySelector('header')).position,headerHeight:document.querySelector('header>div').getBoundingClientRect().height,padding:getComputedStyle(document.querySelector('main')).paddingTop,toolbarShrink:getComputedStyle(document.querySelector('.layout-section-fixed')).flexShrink,display:getComputedStyle(document.querySelector('.table-page-layout')).display})) + css=await page.evaluate(()=>({header:getComputedStyle(document.querySelector('header')).position,headerHeight:document.querySelector('header>div').getBoundingClientRect().height,padding:getComputedStyle(document.querySelector('main')).paddingTop,toolbarShrink:getComputedStyle(document.querySelector('.layout-section-fixed')).flexShrink,display:getComputedStyle(document.querySelector('.table-page-layout')).display})) assert.deepEqual(css,{header:'sticky',headerHeight:64,padding:'16px',toolbarShrink:'0',display:'flex'},'CSS_SETUP: actual Tailwind utilities must be compiled') - for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:375,height:400},{width:1280,height:900}]){ + for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:844,height:390},{width:1023,height:768},{width:375,height:400},{width:1280,height:900}]){ await page.setViewportSize(viewport);await top() const label=`${viewport.width}x${viewport.height}` const g=await searchUsable(`${label}-top`) @@ -176,6 +181,7 @@ try { await createDialog.waitFor();await createDialog.getByLabel('Close modal').click();await createDialog.waitFor({state:'hidden'}) await top();await searchUsable('toolbar-actions-returned-top') assert.deepEqual(errors,[],'No setup/runtime errors accepted as behavioral RED');assert.deepEqual(external,[]) + outcome=violations.length?'behavioral-red':'green' if(violations.length)throw new Error('GROUPS_LAYOUT_REGRESSION\n'+violations.join('\n')) console.log('GROUPS_BROWSER_GREEN: real components, compiled CSS, scroll/resize and search assertions passed') } catch(error) { @@ -183,7 +189,7 @@ try { await fs.writeFile(path.join(out,'failure.txt'),String(error.stack||error)) throw error } finally { - await fs.writeFile(path.join(out,'manifest.json'),JSON.stringify({head,baseline,scope,productionSHA:scope==='baseline'?baseline:head,synthetic:true,browser:'Playwright Chromium; viewport emulation, not physical mobile/keyboard',actualComponents:['GroupsView','AppLayout','AppHeader','TablePageLayout','DataTable','Select','Pagination','BaseDialog'],screenshots,measurements,requests,errors,external,violations},null,2)) + await fs.writeFile(path.join(out,'manifest.json'),JSON.stringify({head,baseline,scope,productionSHA:scope==='baseline'?baseline:head,outcome,sourceHashes,css,synthetic:true,browser:`Playwright Chromium ${browser?.version()}; viewport emulation, not physical mobile/keyboard`,actualComponents:['GroupsView','AppLayout','AppHeader','TablePageLayout','DataTable','Select','Pagination','BaseDialog'],screenshots,measurements,requests,errors,external,violations},null,2)) if(browser)await browser.close();await server.close() await fs.rm(fixture,{recursive:true,force:true}) } diff --git a/.github/workflows/mobile-groups-search.yml b/.github/workflows/mobile-groups-search.yml index dda1f325cb9d..5eb90f0af50a 100644 --- a/.github/workflows/mobile-groups-search.yml +++ b/.github/workflows/mobile-groups-search.yml @@ -1,8 +1,6 @@ name: Mobile groups search on: - push: - branches: [fix/mobile-groups-search] pull_request: paths: - 'frontend/src/views/admin/GroupsView.vue' @@ -25,6 +23,9 @@ jobs: browser: runs-on: ubuntu-latest timeout-minutes: 20 + defaults: + run: + shell: bash steps: - uses: actions/checkout@v6 with: @@ -68,12 +69,6 @@ jobs: run: | mkdir -p "$GROUPS_EVIDENCE_DIR" node .github/scripts/mobile-groups-search-browser.mjs 2>&1 | tee "$GROUPS_EVIDENCE_DIR/browser.log" - - name: Focused Groups and layout regressions - run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/GroupsView.columnSettings.spec.ts src/views/admin/__tests__/GroupsView.duplicate.spec.ts src/views/admin/__tests__/GroupsView.streamOnly.spec.ts src/views/admin/__tests__/GroupsView.compositePlatforms.spec.ts src/views/admin/__tests__/GroupsView.codexCLIOnly.spec.ts src/views/admin/__tests__/GroupsView.codexManifest.spec.ts src/components/common/__tests__/DataTable.spec.ts src/components/layout/__tests__/TablePageLayout.spec.ts - - name: Check changed component lint - run: pnpm --dir frontend exec eslint src/components/layout/TablePageLayout.vue src/views/admin/GroupsView.vue - - name: Production frontend build and type check - run: pnpm --dir frontend run build - name: Evidence checksums if: always() run: | @@ -85,3 +80,9 @@ jobs: with: name: mobile-groups-search-${{ github.event.pull_request.head.sha || github.sha }} path: ${{ runner.temp }}/groups-evidence + - name: Focused Groups and layout regressions + run: pnpm --dir frontend exec vitest run src/views/admin/__tests__/GroupsView.columnSettings.spec.ts src/views/admin/__tests__/GroupsView.duplicate.spec.ts src/views/admin/__tests__/GroupsView.streamOnly.spec.ts src/views/admin/__tests__/GroupsView.compositePlatforms.spec.ts src/views/admin/__tests__/GroupsView.codexCLIOnly.spec.ts src/views/admin/__tests__/GroupsView.codexManifest.spec.ts src/components/common/__tests__/DataTable.spec.ts src/components/layout/__tests__/TablePageLayout.spec.ts + - name: Check changed component lint + run: pnpm --dir frontend exec eslint src/components/layout/TablePageLayout.vue src/views/admin/GroupsView.vue + - name: Production frontend build and type check + run: pnpm --dir frontend run build diff --git a/frontend/src/components/layout/TablePageLayout.vue b/frontend/src/components/layout/TablePageLayout.vue index 3620697add36..0b264d922232 100644 --- a/frontend/src/components/layout/TablePageLayout.vue +++ b/frontend/src/components/layout/TablePageLayout.vue @@ -92,6 +92,11 @@ onUnmounted(() => { } /* 移动端:恢复正常滚动 */ +.table-page-layout.mobile-mode { + /* 卡片随文档滚动时,父布局也必须随内容增高,避免提前结束顶栏的 sticky 范围。 */ + height: auto; +} + .table-page-layout.mobile-mode .table-scroll-container { @apply h-auto overflow-visible border-none shadow-none bg-transparent; } From d56129a3469ae348dbe9f5f1a87bf85babffba45 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:20:52 +0800 Subject: [PATCH 4/7] test: wait for responsive layout transitions before measuring --- .github/scripts/mobile-groups-search-browser.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index ce89fabfc3e6..beeb58da16b5 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -73,6 +73,14 @@ async function shot(name) { screenshots.push({ name, viewport: page.viewportSize() }) } async function geometry(label) { + // AppLayout animates its desktop sidebar margin for 300ms after crossing lg. + // Measure the settled layout, including after Vue handles the resize event. + await page.evaluate(async () => { + await new Promise(requestAnimationFrame) + await Promise.allSettled(document.getAnimations() + .filter(animation => animation.effect?.getTiming().iterations !== Infinity) + .map(animation => animation.finished)) + }) const value = await page.evaluate(() => { const rect = el => { if (!el) return null From 851da18e165de5ec6884644146ec131dd0d342b4 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:24:33 +0800 Subject: [PATCH 5/7] test: reproduce search occlusion after scroll return and restored offsets --- .../scripts/mobile-groups-search-browser.mjs | 46 ++++++++++++++++--- .github/workflows/mobile-groups-search.yml | 18 ++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index beeb58da16b5..6c145c9cc041 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -15,7 +15,8 @@ assert(process.env.CI && out, 'Application execution is allowed only on remote C const head = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim() assert.equal(head, process.env.GROUPS_EXPECTED_HEAD) const baseline = '338528c48fc480fa998c984d923b049841e20039' -const scope = appRoot === root ? 'head' : 'baseline' +const scope = process.env.GROUPS_SCOPE || (appRoot === root ? 'head' : 'baseline') +const productionSHA = process.env.GROUPS_APP_SHA || (appRoot === root ? head : baseline) await fs.mkdir(out, { recursive: true }) const fixture = path.join(frontend, '.mobile-groups-fixture') await fs.mkdir(fixture, { recursive: true }) @@ -61,7 +62,7 @@ const groups = Array.from({ length: 20 }, (_, i) => ({ rate_multiplier: 1, is_exclusive: false, account_count: 3, active_account_count: 3, sort_order: i, supported_model_scopes: [], created_at: '2026-11-01T00:00:00Z', updated_at: '2026-11-01T00:00:00Z', })) -const measurements = [], requests = [], errors = [], external = [], violations = [], screenshots = [] +const measurements = [], requests = [], errors = [], external = [], violations = [], searchViolations = [], screenshots = [] let browser, page, css, outcome = 'setup-or-interaction-failure' const sourceHashes = {} for (const file of ['src/views/admin/GroupsView.vue','src/components/layout/AppLayout.vue','src/components/layout/AppHeader.vue','src/components/layout/TablePageLayout.vue','src/components/common/DataTable.vue','src/style.css','tailwind.config.js']) { @@ -87,7 +88,7 @@ async function geometry(label) { const r = el.getBoundingClientRect(), s = getComputedStyle(el) return { top:r.top,bottom:r.bottom,left:r.left,right:r.right,height:r.height,width:r.width, scrollTop:el.scrollTop,scrollHeight:el.scrollHeight,clientHeight:el.clientHeight,scrollWidth:el.scrollWidth,clientWidth:el.clientWidth, - position:s.position,overflowX:s.overflowX,overflowY:s.overflowY,flexShrink:s.flexShrink,display:s.display } + position:s.position,overflowX:s.overflowX,overflowY:s.overflowY,flexShrink:s.flexShrink,display:s.display,scrollMarginTop:s.scrollMarginTop } } const search = document.querySelector('.layout-section-fixed input'), r = search.getBoundingClientRect() const hit = document.elementFromPoint(r.left+r.width/2, r.top+r.height/2) @@ -107,10 +108,26 @@ async function top() { } async function searchUsable(label) { const g = await geometry(label) - check(g.search.top>=g.header.bottom && g.search.bottom<=g.viewport.height && g.search.left>=0 && g.search.right<=g.viewport.width && g.searchHit, `${label}: search must be fully visible and hit-testable; ${JSON.stringify({search:g.search,header:g.header,hit:g.hitTag})}`) + const usable=g.search.top>=g.header.bottom && g.search.bottom<=g.viewport.height && g.search.left>=0 && g.search.right<=g.viewport.width && g.searchHit + const failure=`${label}: search must be fully visible and hit-testable; ${JSON.stringify({scrollY:g.scrollY,search:g.search,header:g.header,hit:g.hitTag})}` + check(usable,failure) + if(!usable)searchViolations.push(failure) check(g.document.scrollWidth<=g.viewport.width && g.scrollX===0, `${label}: document must not overflow horizontally`) return g } +async function middle() { + await page.locator('.layout-section-fixed input').evaluate(el=>el.blur()) + await page.evaluate(()=>window.scrollTo({top:Math.round((document.documentElement.scrollHeight-innerHeight)/2),behavior:'instant'})) +} +async function returnToSearch(label, block) { + await page.locator('.layout-section-fixed input').evaluate((el,block)=>{ + if(block)el.scrollIntoView({block,behavior:'instant'}) + el.focus() + },block) + assert(await page.locator('.layout-section-fixed input').evaluate(el=>el===document.activeElement),'Search return must actually focus the input') + await searchUsable(label) + await shot(label) +} try { await server.listen();browser=await chromium.launch({headless:true}) const context=await browser.newContext({viewport:{width:375,height:667},timezoneId:'UTC'}) @@ -140,7 +157,7 @@ try { // Guard against an unstyled fixture before treating any assertion as a behavioral RED. css=await page.evaluate(()=>({header:getComputedStyle(document.querySelector('header')).position,headerHeight:document.querySelector('header>div').getBoundingClientRect().height,padding:getComputedStyle(document.querySelector('main')).paddingTop,toolbarShrink:getComputedStyle(document.querySelector('.layout-section-fixed')).flexShrink,display:getComputedStyle(document.querySelector('.table-page-layout')).display})) assert.deepEqual(css,{header:'sticky',headerHeight:64,padding:'16px',toolbarShrink:'0',display:'flex'},'CSS_SETUP: actual Tailwind utilities must be compiled') - for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:844,height:390},{width:1023,height:768},{width:375,height:400},{width:1280,height:900}]){ + for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:844,height:390},{width:1023,height:768},{width:375,height:400},{width:375,height:320},{width:1280,height:900}]){ await page.setViewportSize(viewport);await top() const label=`${viewport.width}x${viewport.height}` const g=await searchUsable(`${label}-top`) @@ -151,6 +168,21 @@ try { const mid=await geometry(`${label}-middle`) check(Math.abs(mid.header.top)<1,`${label}: header must remain at document top while scrolling cards; header.top=${mid.header.top}, scrollY=${mid.scrollY}`) await shot(`${label}-middle`) + // Native DOM scrolling does not account for a sticky header by default. + await returnToSearch(`${label}-search-start-from-middle`,'start') + await middle();await returnToSearch(`${label}-search-focus-from-middle`,null) + await top() + // Recreate the supplied screenshot's scroll state: exclusive filter just + // below the header, with search/platform/status above it. This is a saved + // scroll offset simulation, not a claim about native browser history. + const savedY=await page.evaluate(()=>{ + const filter=document.querySelectorAll('.layout-section-fixed .select-trigger')[2] + return Math.max(0,filter.getBoundingClientRect().top+scrollY-document.querySelector('header').getBoundingClientRect().height) + }) + await middle() + await page.evaluate(y=>window.scrollTo({top:y,behavior:'instant'}),savedY) + await geometry(`${label}-restored-filter-offset`);await shot(`${label}-restored-filter-offset`) + await returnToSearch(`${label}-search-nearest-after-restore`,'nearest') } else { assert.equal(await page.locator('table').count(),1,'Desktop list must render') await page.locator('.table-wrapper').evaluate(el=>{el.scrollTop=el.scrollHeight/2}) @@ -190,14 +222,14 @@ try { await top();await searchUsable('toolbar-actions-returned-top') assert.deepEqual(errors,[],'No setup/runtime errors accepted as behavioral RED');assert.deepEqual(external,[]) outcome=violations.length?'behavioral-red':'green' - if(violations.length)throw new Error('GROUPS_LAYOUT_REGRESSION\n'+violations.join('\n')) + if(violations.length)throw new Error('GROUPS_LAYOUT_REGRESSION\n'+(searchViolations.length?'GROUPS_SEARCH_OCCLUSION\n':'')+violations.join('\n')) console.log('GROUPS_BROWSER_GREEN: real components, compiled CSS, scroll/resize and search assertions passed') } catch(error) { if(page)await shot('failure').catch(()=>{}) await fs.writeFile(path.join(out,'failure.txt'),String(error.stack||error)) throw error } finally { - await fs.writeFile(path.join(out,'manifest.json'),JSON.stringify({head,baseline,scope,productionSHA:scope==='baseline'?baseline:head,outcome,sourceHashes,css,synthetic:true,browser:`Playwright Chromium ${browser?.version()}; viewport emulation, not physical mobile/keyboard`,actualComponents:['GroupsView','AppLayout','AppHeader','TablePageLayout','DataTable','Select','Pagination','BaseDialog'],screenshots,measurements,requests,errors,external,violations},null,2)) + await fs.writeFile(path.join(out,'manifest.json'),JSON.stringify({head,baseline,scope,productionSHA,outcome,sourceHashes,css,synthetic:true,browser:`Playwright Chromium ${browser?.version()}; viewport emulation, not physical mobile/keyboard or native history restoration`,actualComponents:['GroupsView','AppLayout','AppHeader','TablePageLayout','DataTable','Select','Pagination','BaseDialog'],screenshots,measurements,requests,errors,external,violations,searchViolations},null,2)) if(browser)await browser.close();await server.close() await fs.rm(fixture,{recursive:true,force:true}) } diff --git a/.github/workflows/mobile-groups-search.yml b/.github/workflows/mobile-groups-search.yml index 5eb90f0af50a..18b2597dfbd8 100644 --- a/.github/workflows/mobile-groups-search.yml +++ b/.github/workflows/mobile-groups-search.yml @@ -61,6 +61,24 @@ jobs: set -e test "$result" -ne 0 grep -q 'GROUPS_LAYOUT_REGRESSION' "$GROUPS_EVIDENCE_DIR/browser.log" + - name: Search RED with header boundary already repaired + env: + GROUPS_EXPECTED_HEAD: ${{ github.event.pull_request.head.sha || github.sha }} + GROUPS_EVIDENCE_DIR: ${{ runner.temp }}/groups-evidence/layout-only + GROUPS_APP_ROOT: ${{ runner.temp }}/groups-layout-only + GROUPS_APP_SHA: d56129a3469ae348dbe9f5f1a87bf85babffba45 + GROUPS_SCOPE: layout-only + PLAYWRIGHT_ROOT: ${{ runner.temp }}/groups-browser/node_modules/playwright + run: | + mkdir -p "$GROUPS_APP_ROOT" "$GROUPS_EVIDENCE_DIR" + git archive "$GROUPS_APP_SHA" | tar -x -C "$GROUPS_APP_ROOT" + ln -s "$GITHUB_WORKSPACE/frontend/node_modules" "$GROUPS_APP_ROOT/frontend/node_modules" + set +e + node .github/scripts/mobile-groups-search-browser.mjs 2>&1 | tee "$GROUPS_EVIDENCE_DIR/browser.log" + result=${PIPESTATUS[0]} + set -e + test "$result" -ne 0 + grep -q 'GROUPS_SEARCH_OCCLUSION' "$GROUPS_EVIDENCE_DIR/browser.log" - name: Current head browser acceptance env: GROUPS_EXPECTED_HEAD: ${{ github.event.pull_request.head.sha || github.sha }} From 6868db36937d09e914a2ea3eaaf34ee19aaaaf75 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:28:42 +0800 Subject: [PATCH 6/7] fix: keep returned group search below the sticky header --- .github/scripts/mobile-groups-search-browser.mjs | 10 ++++++++++ frontend/src/views/admin/GroupsView.vue | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index 6c145c9cc041..c72465d85851 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -81,6 +81,15 @@ async function geometry(label) { await Promise.allSettled(document.getAnimations() .filter(animation => animation.effect?.getTiming().iterations !== Infinity) .map(animation => animation.finished)) + // Native focus can start smooth document scrolling (html.scroll-smooth). + // That scroll is not returned by getAnimations(); do not measure mid-flight. + let previous=scrollY,stable=0 + for(let frame=0;frame<180 && stable<8;frame++){ + await new Promise(requestAnimationFrame) + stable=Math.abs(scrollY-previous)<0.1?stable+1:0 + previous=scrollY + } + if(stable<8)throw Error('SCROLL_SETUP: document scrolling did not settle') }) const value = await page.evaluate(() => { const rect = el => { @@ -193,6 +202,7 @@ try { } await page.setViewportSize({width:375,height:667});await top() const search=page.locator('.layout-section-fixed input') + await middle();await returnToSearch('375x667-interactive-search-after-scroll','nearest') // Keyboard traversal, actual debounced API request and rendered filtering. await page.getByRole('button',{name:'Select option'}).first().focus();await page.keyboard.press('Shift+Tab') assert(await search.evaluate(el=>el===document.activeElement),'Search must be reachable by keyboard') diff --git a/frontend/src/views/admin/GroupsView.vue b/frontend/src/views/admin/GroupsView.vue index d02c64b6a36e..367a0d924c7e 100644 --- a/frontend/src/views/admin/GroupsView.vue +++ b/frontend/src/views/admin/GroupsView.vue @@ -17,7 +17,7 @@ v-model="searchQuery" type="text" :placeholder="t('admin.groups.searchGroups')" - class="input pl-10" + class="input scroll-mt-20 pl-10" @input="handleSearch" /> From 9d4be856c06daa1e25e694c75831b427aa3122b3 Mon Sep 17 00:00:00 2001 From: ranxi2001 Date: Fri, 13 Nov 2026 14:33:38 +0800 Subject: [PATCH 7/7] fix: reveal focused group search when restored beneath the header --- .github/scripts/mobile-groups-search-browser.mjs | 2 ++ frontend/src/views/admin/GroupsView.vue | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/scripts/mobile-groups-search-browser.mjs b/.github/scripts/mobile-groups-search-browser.mjs index c72465d85851..354dcb699e2c 100644 --- a/.github/scripts/mobile-groups-search-browser.mjs +++ b/.github/scripts/mobile-groups-search-browser.mjs @@ -166,6 +166,8 @@ try { // Guard against an unstyled fixture before treating any assertion as a behavioral RED. css=await page.evaluate(()=>({header:getComputedStyle(document.querySelector('header')).position,headerHeight:document.querySelector('header>div').getBoundingClientRect().height,padding:getComputedStyle(document.querySelector('main')).paddingTop,toolbarShrink:getComputedStyle(document.querySelector('.layout-section-fixed')).flexShrink,display:getComputedStyle(document.querySelector('.table-page-layout')).display})) assert.deepEqual(css,{header:'sticky',headerHeight:64,padding:'16px',toolbarShrink:'0',display:'flex'},'CSS_SETUP: actual Tailwind utilities must be compiled') + await page.locator('.layout-section-fixed input').focus() + assert.equal((await searchUsable('initial-visible-search-focus')).scrollY,0,'Focusing an already visible search must not move the page') for(const viewport of [{width:375,height:667},{width:390,height:844},{width:320,height:667},{width:667,height:375},{width:844,height:390},{width:1023,height:768},{width:375,height:400},{width:375,height:320},{width:1280,height:900}]){ await page.setViewportSize(viewport);await top() const label=`${viewport.width}x${viewport.height}` diff --git a/frontend/src/views/admin/GroupsView.vue b/frontend/src/views/admin/GroupsView.vue index 367a0d924c7e..0ba03ccdb727 100644 --- a/frontend/src/views/admin/GroupsView.vue +++ b/frontend/src/views/admin/GroupsView.vue @@ -18,6 +18,7 @@ type="text" :placeholder="t('admin.groups.searchGroups')" class="input scroll-mt-20 pl-10" + @focus="handleSearchFocus" @input="handleSearch" /> @@ -5920,6 +5921,15 @@ const loadCapacitySummary = async () => { } }; +const handleSearchFocus = (event: FocusEvent) => { + const input = event.target as HTMLInputElement; + const topInset = parseFloat(getComputedStyle(input).scrollMarginTop) || 0; + // Nearest scrolling can leave an input inside the viewport but behind AppHeader. + if (input.getBoundingClientRect().top < topInset) { + input.scrollIntoView({ block: "start", behavior: "auto" }); + } +}; + let searchTimeout: ReturnType; const handleSearch = () => { clearTimeout(searchTimeout);