Skip to content

chore: temporary source snapshot for manual reconstruction #3

chore: temporary source snapshot for manual reconstruction

chore: temporary source snapshot for manual reconstruction #3

name: Temporary soft copyright stateful capture
on:
pull_request:
branches: [develop]
paths:
- '.github/workflows/temporary-soft-copyright-stateful-capture.yml'
- 'tests/scenario/manual/software-manual-capture.scenario.test.ts'
permissions:
contents: read
packages: read
jobs:
capture:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN || github.token }}
SCENARIO_DATABASE_ADMIN_URL: postgresql://postgres:postgres@localhost:5432/postgres
VITE_TENCENT_LBS_JS_KEY: manual-scenario-key
VITE_WECHAT_ABILITY_MOCKING_ENABLED: "true"
VITE_WECHAT_MINIPROGRAM_WEBVIEW_MOCKING_ENABLED: "false"
WECHAT_ABILITY_MOCKING_ENABLED: "true"
WECHAT_OFFICIAL_ACCOUNT_APP_ID: wx-manual-scenario
WECHAT_OFFICIAL_ACCOUNT_APP_SECRET: manual-wechat-secret
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Tighten temporary capture locators
run: |
python - <<'PY'
from pathlib import Path
import re
p = Path("tests/scenario/manual/software-manual-capture.scenario.test.ts")
s = p.read_text()
s, count = re.subn(
r''' await page\.goto\("/prd"\);\n await page\.getByText\("羽毛球约球", \{ exact: true \}\)\.waitFor\(\{\n state: "visible",\n timeout: 15_000,\n \}\);\n await page\.getByText\("羽毛球约球", \{ exact: true \}\)\.scrollIntoViewIfNeeded\(\);''',
''' await page.goto("/prd");
const catalogItem = page
.getByTestId("prd.catalog.item")
.filter({ hasText: "羽毛球约球" })
.first();
await catalogItem.waitFor({ state: "visible", timeout: 15_000 });
await catalogItem.scrollIntoViewIfNeeded();''',
s,
)
if count != 1:
raise SystemExit(f"catalog locator replacement count was {count}, expected 1")
s = s.replace(
'page.getByText("周六下午羽毛球双打", { exact: true }).waitFor(',
'page.getByText("周六下午羽毛球双打", { exact: true }).first().waitFor(',
)
s = s.replace(
'page.getByText("林晓", { exact: true }).waitFor(',
'page.getByText("林晓", { exact: true }).first().waitFor(',
)
s = s.replace(
'page.getByText("陈然", { exact: true }).waitFor(',
'page.getByText("陈然", { exact: true }).first().waitFor(',
)
s = s.replace(
'await page.getByTestId("pr-detail.share.open").click();\n await captureViewport(page, "11-share-sheet");',
'await page.getByTestId("pr-detail.share.open").click();\n await page.locator(\'[role="dialog"]\').first().waitFor({ state: "visible", timeout: 15_000 });\n await captureViewport(page, "11-share-sheet");',
)
p.write_text(s)
PY
grep -n -A10 -B2 'catalogItem' tests/scenario/manual/software-manual-capture.scenario.test.ts
- name: Capture stateful mobile workflows
shell: bash
run: |
set -o pipefail
rm -rf soft-copyright-manual-capture
pnpm exec vitest run \
--project system-scenario \
tests/scenario/manual/software-manual-capture.scenario.test.ts \
--reporter=verbose 2>&1 | tee stateful-capture.log
- name: Upload capture evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: partner-up-stateful-manual-capture
path: |
soft-copyright-manual-capture
stateful-capture.log
tests/scenario/.result
if-no-files-found: warn
retention-days: 7