mobile: harden real-device smoke

This commit is contained in:
2026-05-25 22:22:26 +08:00
parent d0b44615ea
commit 6ed1e7ea58
3 changed files with 99 additions and 4 deletions
+10 -1
View File
@@ -89,6 +89,9 @@ The summary prints:
Current blocker meanings:
- `wireless_adb_unavailable`
- the workstation cannot discover or connect to the phone's wireless ADB endpoint
- re-enable or re-pair Wireless debugging on the phone, then rerun the smoke command
- `device_locked`
- the phone is still behind the OEM lockscreen / pattern unlock surface
- `login_required`
@@ -132,13 +135,19 @@ powershell -ExecutionPolicy Bypass -File D:\ai-contract-platform\mobile\tools\re
powershell -ExecutionPolicy Bypass -File D:\ai-contract-platform\mobile\tools\real-device-smoke.ps1 -ExpectedIp 192.168.3. -SkipInstall -SmokeDepth documents-workspace
```
When the phone's current wireless-debug port is already known, bypass mDNS discovery with `-DeviceSerial`:
```powershell
powershell -ExecutionPolicy Bypass -File D:\ai-contract-platform\mobile\tools\real-device-smoke.ps1 -DeviceSerial 192.168.3.93:44421 -ConfigureDevice -SkipInstall -SmokeDepth documents-workspace
```
## Validation Notes
- Real-device attachment picking is validated through system `DocumentsUI`
- Report download is validated
- Contract download is validated
- Contract template taxonomy filtering is validated through `contract-taxonomy` smoke depth
- Legal-document types, schema loading, and draft persistence are now wired into the mobile app; the `documents-workspace` smoke depth currently proves the workspace/list path on the signed-in X60PRO session, and builder navigation still needs one more round of device-side tuning
- Legal-document types, schema loading, and draft persistence are now wired into the mobile app; the `documents-workspace` smoke depth now proves the workspace, type list, and builder entry path on the signed-in X60PRO session
- External open/share behavior is OEM-dependent and may route into vendor apps such as the default browser or WeChat
- Lightweight mobile notifications now exist for:
- review status transitions (`completed / partial / failed`)
+6
View File
@@ -103,6 +103,12 @@ Created on 2026-04-18.
- filtered results stayed active and excluded `property_service`
- `tools/real-device-smoke.ps1 -ExpectedIp 192.168.3. -ConfigureDevice -SkipInstall -SmokeDepth contract-taxonomy` returned `SMOKE_OK=True`
- artifact bundle: `mobile/qa-artifacts/real-device-smoke/2026-05-25T15-51-23-045/`
- Android true-device validation continued on the wireless X60PRO:
- connected serial: `192.168.3.93:44421`
- `tools/real-device-smoke.ps1` now supports `-DeviceSerial` for known wireless-debug ports
- `documents-workspace` now passes through signed-in shell -> AI tools -> legal-document workspace -> type list -> builder
- `tools/real-device-smoke.ps1 -DeviceSerial 192.168.3.93:44421 -ConfigureDevice -SkipInstall -SmokeDepth documents-workspace -LoginAccount <member-account> -LoginPassword <member-password>` returned `SMOKE_OK=True`
- artifact bundle: `mobile/qa-artifacts/real-device-smoke/2026-05-25T21-26-28-369/`
## Phase 0/1 mobile structure progress
+83 -3
View File
@@ -3,6 +3,7 @@ param(
[switch]$ConfigureDevice,
[switch]$SkipInstall,
[switch]$SkipServerChecks,
[string]$DeviceSerial = "",
[string]$LoginAccount = "",
[string]$LoginPassword = "",
[ValidateSet("login-only", "shell-only", "share-proof", "contract-taxonomy", "documents-workspace")]
@@ -464,12 +465,21 @@ function Invoke-DocumentsWorkspaceProof {
$attemptVisibleCodes += $code
}
}
foreach ($marker in @("legal-documents-workspace", "open-legal-document-", "legal-document-type")) {
if ($workspaceListState.UiDump -match [regex]::Escape($marker)) {
$attemptVisibleCodes += $marker
}
}
foreach ($code in $attemptVisibleCodes) {
if ($visibleCodes -notcontains $code) {
$visibleCodes += $code
}
}
$typeListOk = $visibleCodes.Count -gt 0
$typeListOk = $visibleCodes.Count -gt 0 -and (
$workspaceListState.UiDump -match 'open-legal-document-' -or
$workspaceListState.UiDump -match 'legal-document-type' -or
$workspaceListState.UiDump -match 'legal-documents-workspace'
)
$startButtons = Get-ContentDescBounds -UiDump $workspaceListState.UiDump
$startButton = $startButtons |
@@ -482,7 +492,7 @@ function Invoke-DocumentsWorkspaceProof {
Select-Object -First 1
if (-not $startButton) {
$startButton = Get-ButtonBounds -UiDump $workspaceListState.UiDump |
Where-Object { $_.Top -gt 1200 -and $_.Bottom -lt 2100 } |
Where-Object { $_.Top -gt 1500 -and $_.Bottom -lt 2100 -and $_.ContentDesc -ne "刷新入口" -and $_.ContentDesc -ne "搜索" } |
Sort-Object Top |
Select-Object -First 1
}
@@ -597,7 +607,77 @@ $artifactBase = if ([string]::IsNullOrWhiteSpace($ArtifactRoot)) {
$artifactDir = Join-Path $artifactBase (Get-Date -Format "yyyy-MM-ddTHH-mm-ss-fff")
New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null
$serial = Get-ConnectedSerial -ReconnectScript $reconnectScript -ExpectedIpPrefix $ExpectedIp -ShouldConfigureDevice:$ConfigureDevice.IsPresent
$serial = ""
try {
if (-not [string]::IsNullOrWhiteSpace($DeviceSerial)) {
$serial = $DeviceSerial.Trim()
$connectOutput = & $adb connect $serial 2>&1
$connectOutput | ForEach-Object { Write-Host $_ }
$connectedDevices = & $adb devices 2>$null
$isConnected = $connectedDevices |
ForEach-Object { $_.ToString().Trim() } |
Where-Object { $_ -match "^$([regex]::Escape($serial))\s+device$" } |
Select-Object -First 1
if ($LASTEXITCODE -ne 0 -or -not $isConnected) {
throw "Failed to connect to specified device serial '$serial'."
}
if ($ConfigureDevice) {
& $adb -s $serial shell settings put system screen_off_timeout 1800000 | Out-Null
& $adb -s $serial shell settings put global stay_on_while_plugged_in 3 | Out-Null
}
} else {
$serial = Get-ConnectedSerial -ReconnectScript $reconnectScript -ExpectedIpPrefix $ExpectedIp -ShouldConfigureDevice:$ConfigureDevice.IsPresent
}
} catch {
$connectionError = ($_.Exception.Message -replace '\s+', ' ').Trim()
$connectionError | Set-Content -Path (Join-Path $artifactDir "reconnect-error.txt")
& $adb mdns services 2>&1 | Set-Content -Path (Join-Path $artifactDir "mdns-services.txt")
& $adb devices -l 2>&1 | Set-Content -Path (Join-Path $artifactDir "adb-devices.txt")
$blockedApiStatus = $null
$blockedWebStatus = $null
if (-not $SkipServerChecks) {
$blockedApiStatus = Invoke-StatusCheck -Url $ApiHealthUrl
$blockedWebStatus = Invoke-StatusCheck -Url $WebUrl
}
$blockedApiStatusCode = if ($blockedApiStatus) { $blockedApiStatus.StatusCode } else { "" }
$blockedWebStatusCode = if ($blockedWebStatus) { $blockedWebStatus.StatusCode } else { "" }
$blockedApkPath = Get-ApkPath
$summaryLines = @(
"CONNECTED_SERIAL=",
"SMOKE_DEPTH=$SmokeDepth",
"SERVER_API_STATUS=$blockedApiStatusCode",
"SERVER_WEB_STATUS=$blockedWebStatusCode",
"APK_PATH=$blockedApkPath",
"APK_INSTALLED=False",
"TOP_ACTIVITY=",
"APP_SURFACE=",
"SMOKE_BLOCKER=wireless_adb_unavailable",
"WIRELESS_ADB_ERROR=$connectionError",
"SHARE_PROOF_OK=",
"SHARE_CHOOSER_ACTIVITY=",
"SHARE_PDF_PREVIEW_OK=",
"SHARE_REPORT_SECTION_REACHED=",
"TAXONOMY_PROOF_OK=",
"TAXONOMY_TARGET_CARD_OK=",
"TAXONOMY_FILTER_ACTIVE_OK=",
"TAXONOMY_VISIBLE_KEYS=",
"DOCUMENTS_PROOF_OK=",
"DOCUMENTS_WORKSPACE_READY=",
"DOCUMENTS_TYPE_LIST_OK=",
"DOCUMENTS_BUILDER_OK=",
"DOCUMENTS_VISIBLE_CODES=",
"ARTIFACT_DIR=$artifactDir",
"SMOKE_OK=False"
)
$summaryFile = Join-Path $artifactDir "summary.txt"
$summaryLines | Set-Content -Path $summaryFile
$summaryLines | ForEach-Object { Write-Output $_ }
throw "Environment blocker: wireless ADB is unavailable. Re-enable or re-pair wireless debugging on the phone, then rerun this smoke. See $artifactDir"
}
$apiStatus = $null
$webStatus = $null