56 lines
2.6 KiB
PowerShell
56 lines
2.6 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$html = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $PSScriptRoot '..\assets\app.js')
|
|
$pickView = [regex]::Match($html, '(?s)pickView=function\(\).*?(?=function togglePickDetails)').Value
|
|
|
|
if (-not $pickView) { throw 'Could not locate pickView source' }
|
|
|
|
$scanAt = $pickView.IndexOf('class="scan-box"')
|
|
$progressAt = $pickView.IndexOf('class="progress"')
|
|
$detailsAt = $pickView.IndexOf('pick-order-details')
|
|
if ($scanAt -lt 0 -or $progressAt -lt 0 -or $detailsAt -lt 0) {
|
|
throw 'Pick page is missing the scan, progress, or order details sections'
|
|
}
|
|
if ($scanAt -gt $progressAt -or $progressAt -gt $detailsAt) {
|
|
throw 'Pick page order must be scan, progress, then order details'
|
|
}
|
|
|
|
if (-not $html.Contains('state.pickDetailsCollapsed=false')) {
|
|
throw 'Pick detail collapse state is not initialized'
|
|
}
|
|
if (-not $html.Contains('function togglePickDetails()')) {
|
|
throw 'Pick detail collapse action is missing'
|
|
}
|
|
if (-not $html.Contains('pick-order-summary hidden')) {
|
|
throw 'Pick order summary should be hidden'
|
|
}
|
|
if (-not $html.Contains('basePickViewForOrderDisplay') -or -not $html.Contains('t(''outboundOrderNo'')')) {
|
|
throw 'Pick details heading should show the outbound order number label'
|
|
}
|
|
if (-not $html.Contains('const orderTitleMarkup=`<h2>${t(''outboundOrderNo'')}</h2>`')) {
|
|
throw 'Pick details title should be replaced with the outbound order number'
|
|
}
|
|
$hasLabeledDestination = $html.Contains('const labeledDestinationSub=')
|
|
$hasDestinationLabel = $html.Contains("t('destinationWarehouseShort')")
|
|
$hasDestinationValue = $html.Contains('${esc(task.destination)}</p>')
|
|
if (-not ($hasLabeledDestination -and $hasDestinationLabel -and $hasDestinationValue)) {
|
|
throw 'Pick details subtitle should label the destination warehouse'
|
|
}
|
|
if (-not $html.Contains("replace(redundantDestinationRow,'')")) {
|
|
throw 'Expanded pick details should not repeat the destination warehouse row'
|
|
}
|
|
if (-not $html.Contains('linkedInboundCode')) {
|
|
throw 'Linked inbound code label is missing'
|
|
}
|
|
if (-not $html.Contains("replace(hiddenInboundCodeRow,'')")) {
|
|
throw 'Standalone inbound code row should be hidden'
|
|
}
|
|
if (-not $html.Contains('const linkedInboundCodeRow=') -or -not $html.Contains('esc(task.inboundCode)')) {
|
|
throw 'Linked inbound code row should display the task inbound code'
|
|
}
|
|
|
|
$requiredSummaryLabels = @('outboundOrderNo', 'status', 'customer', 'destinationWarehouseShort')
|
|
$missing = $requiredSummaryLabels | Where-Object { -not $pickView.Contains("t('$_')") }
|
|
if ($missing) { throw "Missing collapsed summary labels: $($missing -join ', ')" }
|
|
|
|
Write-Output 'PASS: pick layout and collapse contract'
|