Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/temporary-soft-copyright-source-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Temporary soft copyright source snapshot

on:
pull_request:
branches: [develop]
paths:
- '.github/workflows/temporary-soft-copyright-source-snapshot.yml'

permissions:
contents: read

jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 30f51b96e2498b4b85014552512a31a7345d86cb
fetch-depth: 1
- name: Archive relevant source
run: |
tar --exclude='**/node_modules' --exclude='**/dist' --exclude='**/.turbo' \
-czf partner-up-relevant-source.tar.gz \
package.json pnpm-lock.yaml pnpm-workspace.yaml .node-version .npmrc \
apps/backend apps/web packages tests scripts
- uses: actions/upload-artifact@v4
with:
name: partner-up-relevant-source
path: partner-up-relevant-source.tar.gz
retention-days: 3
149 changes: 149 additions & 0 deletions .github/workflows/temporary-soft-copyright-stateful-capture.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
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(
'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");',
)
s, confirm_count = re.subn(
r''' await page\.getByTestId\("pr-detail\.participant\.confirm-action"\)\.waitFor\(\{\n state: "visible",\n timeout: 15_000,\n \}\);''',
''' await page.locator('[data-page="pr-detail"]').waitFor({ state: "visible", timeout: 15_000 });
await page.waitForTimeout(750);''',
s,
)
if confirm_count != 1:
raise SystemExit(f"participant wait replacement count was {confirm_count}, expected 1")

s, pairing_count = re.subn(
r'''\n await page\.goto\(`/pr/\$\{mainPr\.id\}/pairing-code`\);\n await page\.getByTestId\("pr-pairing-code\.code"\)\.waitFor\(\{ state: "visible", timeout: 15_000 \}\);\n await captureViewport\(page, "12-pairing-code"\);''',
'',
s,
)
if pairing_count != 1:
raise SystemExit(f"pairing-code removal count was {pairing_count}, expected 1")
s = s.replace(' "12-pairing-code.png",\n', '')

s, profile_count = re.subn(
r''' await page\.getByText\("陈然", \{ exact: true \}\)(?:\.first\(\))?\.waitFor\(\{ state: "visible", timeout: 15_000 \}\);''',
''' await page.locator("#me-profile-nickname").waitFor({ state: "visible", timeout: 15_000 });
await page.waitForTimeout(500);''',
s,
)
if profile_count != 1:
raise SystemExit(f"profile readiness replacement count was {profile_count}, expected 1")

p.write_text(s)
PY
grep -n -A5 -B3 '16-my-profile' 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
1 change: 1 addition & 0 deletions scripts/temporary-soft-copyright-snapshot-marker-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Temporary PR trigger.
1 change: 1 addition & 0 deletions scripts/temporary-soft-copyright-snapshot-marker-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Trigger source snapshot workflow.
1 change: 1 addition & 0 deletions scripts/temporary-soft-copyright-snapshot-marker-4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Snapshot workflow PR marker.
1 change: 1 addition & 0 deletions scripts/temporary-soft-copyright-snapshot-marker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Source snapshot for local manual reconstruction at 30f51b96e2498b4b85014552512a31a7345d86cb.
Loading
Loading