From dc4a526cb8923ed3198151fedcfae0c8342fb522 Mon Sep 17 00:00:00 2001 From: yashchavanweb Date: Wed, 21 Oct 2026 14:42:26 +0530 Subject: [PATCH] feat(dev): rename tc exploration to tc-workflow and default to Google Pixel 9 Device sessions kept dying on the auto-selected device, so pin Pixel 9 (OS left to Test Companion), clarify the session-failure message, and align the local runner's Test Management IDs with the workflow. --- .../{tc-explore.yml => tc-workflow.yml} | 15 ++--- scripts/run-tc-explore.sh | 61 ------------------- scripts/run-tc-workflow.sh | 18 ++++++ 3 files changed, 26 insertions(+), 68 deletions(-) rename .github/workflows/{tc-explore.yml => tc-workflow.yml} (93%) delete mode 100755 scripts/run-tc-explore.sh create mode 100755 scripts/run-tc-workflow.sh diff --git a/.github/workflows/tc-explore.yml b/.github/workflows/tc-workflow.yml similarity index 93% rename from .github/workflows/tc-explore.yml rename to .github/workflows/tc-workflow.yml index 8a3b7b2..fe7b95c 100644 --- a/.github/workflows/tc-explore.yml +++ b/.github/workflows/tc-workflow.yml @@ -1,4 +1,4 @@ -name: TC explore and generate test cases +name: tc-workflow # Runs after "Build release APK" completes successfully, or manually (workflow_dispatch). # Reads the tc-handoff artifact (bs:// app id + feature context), explores the app on a real @@ -14,9 +14,9 @@ on: required: false default: "BStackBankLatest" device: - description: "Device name (leave empty to let Test Companion choose)" + description: "Device name (default Google Pixel 9; OS version is chosen by Test Companion)" required: false - default: "" + default: "Google Pixel 9" os_version: description: "OS version (only used together with a device)" required: false @@ -27,7 +27,7 @@ on: default: "" concurrency: - group: tc-explore + group: tc-workflow cancel-in-progress: false permissions: @@ -41,7 +41,8 @@ env: TM_PROJECT: "PR-172074" # Test-Companion-Demo-Vision TM_FOLDER_NAME: "Functional" TM_FOLDER_ID: "60058724" - DEVICE: ${{ github.event.inputs.device }} + # workflow_run (auto) has no inputs, so fall back to Google Pixel 9. OS version stays empty. + DEVICE: ${{ github.event.inputs.device || 'Google Pixel 9' }} OS_VERSION: ${{ github.event.inputs.os_version }} jobs: @@ -137,7 +138,7 @@ jobs: --auto-grant-permissions --save-to-tm --yolo --json "$INSTRUCTIONS" 2>&1 | tee "tc-run-$attempt.log" code=${PIPESTATUS[0]} if grep -qE 'Session liveness check failed|session crashed/terminated|No active Appium session|task_blocked|could not be started|no longer available on BrowserStack|not one of the devices provided' "tc-run-$attempt.log"; then - echo "Device session failed on attempt $attempt (exit $code). Discarding anything created without a device." + echo "Device session failed on attempt $attempt (exit $code): the session died at start. Likely causes: device unavailable, app crashing on launch, or no free parallels. Check the session in the App Automate dashboard." tc tm review --reject --all || true continue fi @@ -167,7 +168,7 @@ jobs: - uses: actions/upload-artifact@v4 if: always() with: - name: tc-explore-logs + name: tc-workflow-logs path: | tc-run-*.log tc-summary.md diff --git a/scripts/run-tc-explore.sh b/scripts/run-tc-explore.sh deleted file mode 100755 index 1846484..0000000 --- a/scripts/run-tc-explore.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# Trigger the Test Companion exploration directly, without the app build/merge flow. -# -# Usage: -# ./scripts/run-tc-explore.sh ci [app] [device] [os_version] # runs the GitHub workflow (workflow_dispatch) -# ./scripts/run-tc-explore.sh local [app] [device] [os_version] # runs tc on THIS machine -# -# app bs://, or a custom id such as BStackBankLatest (default). Custom ids are -# resolved to the real bs:// first; tc rejects a bare custom id. -# device optional, e.g. "Google Pixel 8". Empty = Test Companion chooses. -# os_version optional, only used together with a device -# -# Both modes use .github/tc-context/feature-context.md as the exploration prompt. -set -euo pipefail - -MODE="${1:-ci}" -APP="${2:-BStackBankLatest}" -DEVICE="${3:-}" -OSV="${4:-}" - -TM_PROJECT="PR-79" -TM_FOLDER_NAME="Functional" -TM_FOLDER_ID="60003370" -CTX_FILE=".github/tc-context/feature-context.md" -WORKFLOW="tc-explore.yml" - -case "$MODE" in - ci) - command -v gh >/dev/null || { echo "gh CLI required"; exit 1; } - BRANCH="$(git rev-parse --abbrev-ref HEAD)" - echo "Dispatching $WORKFLOW (needs the workflow file on the default branch)" - gh workflow run "$WORKFLOW" -f app="$APP" -f device="$DEVICE" -f os_version="$OSV" - sleep 4 - gh run list --workflow "$WORKFLOW" --limit 1 - echo "Watch it with: gh run watch \$(gh run list --workflow $WORKFLOW --limit 1 --json databaseId -q '.[0].databaseId')" - ;; - local) - command -v tc >/dev/null || { echo "tc not installed"; exit 1; } - [ -f "$CTX_FILE" ] || { echo "$CTX_FILE not found (run from the repo root)"; exit 1; } - : "${BROWSERSTACK_USERNAME:?set BROWSERSTACK_USERNAME (e.g. source .env)}" - : "${BROWSERSTACK_ACCESS_KEY:?set BROWSERSTACK_ACCESS_KEY (e.g. source .env)}" - APP="$(node scripts/resolve-bs-app.js "$APP")" - echo "App: $APP" - tc auth login >/dev/null - tc tm use browserstack >/dev/null - tc tm review --reject --all >/dev/null 2>&1 || true # no unverified leftovers - DEVICE_ARGS=() - [ -n "$DEVICE" ] && DEVICE_ARGS+=(--device "$DEVICE") - [ -n "$DEVICE" ] && [ -n "$OSV" ] && DEVICE_ARGS+=(--os-version "$OSV") - CTX="$(cat "$CTX_FILE")" - INSTRUCTIONS="Save every generated test case to Test Management project ${TM_PROJECT} (Test-Companion-Demo-Vision), inside the existing folder ${TM_FOLDER_NAME} (folder id ${TM_FOLDER_ID}). Do not create a new project and do not use the Automation folders. -Write manual, step-based test cases only (a title, preconditions, numbered steps, and one clear expected result per step). Do not generate automation scripts or file names. -You MUST explore the feature on the real device and base every test case on what you actually observed. If the device session cannot be started or is lost, STOP and report failure. Never write test cases from the description alone and never save unverified cases. - -${CTX}" - tc app generate --app "$APP" --platform android ${DEVICE_ARGS[@]+"${DEVICE_ARGS[@]}"} \ - --auto-grant-permissions --save-to-tm --yolo "$INSTRUCTIONS" - ;; - *) - echo "Usage: $0 ci|local [app] [device] [os_version]"; exit 1;; -esac diff --git a/scripts/run-tc-workflow.sh b/scripts/run-tc-workflow.sh new file mode 100755 index 0000000..334fecf --- /dev/null +++ b/scripts/run-tc-workflow.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Trigger the Test Companion exploration directly, without the app build/merge flow. +# +# Usage: +# ./scripts/run-tc-workflow.sh ci [app] [device] [os_version] # runs the GitHub workflow (workflow_dispatch) +# ./scripts/run-tc-workflow.sh local [app] [device] [os_version] # runs tc on THIS machine +# +# app bs://, or a custom id such as BStackBankLatest (default). Custom ids are +# resolved to the real bs:// first; tc rejects a bare custom id. +# device optional, e.g. "Google Pixel 8". Empty = Test Companion chooses. +# os_version optional, only used together with a device +# +# Both modes use .github/tc-context/feature-context.md as the exploration prompt. +set -euo pipefail + +MODE="${1:-ci}" +APP="${2:-BStackBankLatest}" +DEVICE="${3:-Google Pixel 9}" \ No newline at end of file