- Add RDEPUBReaderSearchBarView with animated show/hide, keyword navigation, and match counting integrated into the reader controller - Restructure docs: replace scattered design docs with consolidated BUSINESS_LOGIC.md and UML_CLASS_DIAGRAMS.md; update ARCHITECTURE.md - Add SearchTests and FanrenParseTimeTest; enhance LargeBookOnDemandTests - Add scripts/run_ui_regression.sh and summarize_ui_results.py for automated UI test execution and reporting Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
160 lines
4.0 KiB
Bash
Executable File
160 lines
4.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -u
|
|
set -o pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
PROJECT_PATH="${PROJECT_PATH:-$ROOT_DIR/ReadViewDemo/ReadViewDemo.xcodeproj}"
|
|
SCHEME_NAME="${SCHEME_NAME:-ReadViewDemo}"
|
|
CONFIGURATION="${CONFIGURATION:-Debug}"
|
|
SIMULATOR_NAME="${SIMULATOR_NAME:-iPhone 16 Plus}"
|
|
DESTINATION="${DESTINATION:-platform=iOS Simulator,name=${SIMULATOR_NAME}}"
|
|
RESULTS_ROOT="${RESULTS_ROOT:-$ROOT_DIR/.artifacts/ui-tests}"
|
|
DERIVED_DATA_PATH="${DERIVED_DATA_PATH:-$RESULTS_ROOT/DerivedData}"
|
|
ONLY_TESTING="${ONLY_TESTING:-}"
|
|
TEST_PLAN="${TEST_PLAN:-}"
|
|
TEST_TYPE_ARG="${1:-}"
|
|
TEST_TYPE="${TEST_TYPE:-${TEST_TYPE_ARG:-quick}}"
|
|
TIMESTAMP="$(date +"%Y%m%d-%H%M%S")"
|
|
RUN_DIR="$RESULTS_ROOT/$TIMESTAMP"
|
|
XCRESULT_PATH="$RUN_DIR/ReadViewDemoUITests.xcresult"
|
|
RAW_LOG_PATH="$RUN_DIR/xcodebuild.log"
|
|
REPORT_MD_PATH="$RUN_DIR/UI-Test-Report.md"
|
|
REPORT_JSON_PATH="$RUN_DIR/ui-test-results.json"
|
|
REPORT_TXT_PATH="$RUN_DIR/summary.txt"
|
|
SUMMARY_SCRIPT="$ROOT_DIR/scripts/summarize_ui_results.py"
|
|
|
|
TARGET_NAME="ReadViewDemoUITests"
|
|
|
|
QUICK_TESTS=(
|
|
BookmarkManagementTests
|
|
BookmarkTests
|
|
DisplayTypeTests
|
|
ErrorAndEdgeCaseTests
|
|
HighlightsManagementTests
|
|
LocationPersistenceTests
|
|
PageNavigationTests
|
|
ReaderAnnotationExtendedTests
|
|
ReaderAnnotationTests
|
|
ReaderOpenCloseTests
|
|
ReaderToolbarTests
|
|
SearchTests
|
|
SelectionMenuTests
|
|
SettingsEffectTests
|
|
SettingsExtendedTests
|
|
SettingsPanelTests
|
|
TOCInteractionTests
|
|
TableOfContentsTests
|
|
ToolbarStateTests
|
|
)
|
|
|
|
LARGE_BOOK_TESTS=(
|
|
ConfigurableWindowTests
|
|
ConcurrentParsingTests
|
|
LargeBookOnDemandTests
|
|
)
|
|
|
|
PERFORMANCE_TESTS=(
|
|
FanrenParseTimeTest
|
|
MetadataParseBenchmarkTests
|
|
)
|
|
|
|
mkdir -p "$RUN_DIR" "$DERIVED_DATA_PATH"
|
|
|
|
append_only_testing_items() {
|
|
local raw_list="$1"
|
|
local item
|
|
IFS=',' read -r -a ONLY_TESTING_ITEMS <<< "$raw_list"
|
|
for item in "${ONLY_TESTING_ITEMS[@]}"; do
|
|
local trimmed_item
|
|
trimmed_item="$(echo "$item" | xargs)"
|
|
if [[ -n "$trimmed_item" ]]; then
|
|
XCODEBUILD_ARGS+=(-only-testing:"$trimmed_item")
|
|
fi
|
|
done
|
|
}
|
|
|
|
apply_test_type_filter() {
|
|
local selected_type="$1"
|
|
local test_name
|
|
case "$selected_type" in
|
|
quick)
|
|
for test_name in "${QUICK_TESTS[@]}"; do
|
|
XCODEBUILD_ARGS+=(-only-testing:"$TARGET_NAME/$test_name")
|
|
done
|
|
;;
|
|
large-book)
|
|
for test_name in "${LARGE_BOOK_TESTS[@]}"; do
|
|
XCODEBUILD_ARGS+=(-only-testing:"$TARGET_NAME/$test_name")
|
|
done
|
|
;;
|
|
performance)
|
|
for test_name in "${PERFORMANCE_TESTS[@]}"; do
|
|
XCODEBUILD_ARGS+=(-only-testing:"$TARGET_NAME/$test_name")
|
|
done
|
|
;;
|
|
all)
|
|
;;
|
|
*)
|
|
echo "Unsupported TEST_TYPE: $selected_type" >&2
|
|
echo "Supported values: quick, large-book, performance, all" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
}
|
|
|
|
echo "UI regression run"
|
|
echo " project: $PROJECT_PATH"
|
|
echo " scheme: $SCHEME_NAME"
|
|
echo " configuration:$CONFIGURATION"
|
|
echo " destination: $DESTINATION"
|
|
echo " test type: $TEST_TYPE"
|
|
echo " results: $RUN_DIR"
|
|
|
|
XCODEBUILD_ARGS=(
|
|
xcodebuild
|
|
test
|
|
-project "$PROJECT_PATH"
|
|
-scheme "$SCHEME_NAME"
|
|
-configuration "$CONFIGURATION"
|
|
-destination "$DESTINATION"
|
|
-resultBundlePath "$XCRESULT_PATH"
|
|
-derivedDataPath "$DERIVED_DATA_PATH"
|
|
)
|
|
|
|
if [[ -n "$TEST_PLAN" ]]; then
|
|
XCODEBUILD_ARGS+=(-testPlan "$TEST_PLAN")
|
|
fi
|
|
|
|
if [[ -n "$ONLY_TESTING" ]]; then
|
|
append_only_testing_items "$ONLY_TESTING"
|
|
else
|
|
apply_test_type_filter "$TEST_TYPE"
|
|
fi
|
|
|
|
set +e
|
|
"${XCODEBUILD_ARGS[@]}" 2>&1 | tee "$RAW_LOG_PATH"
|
|
TEST_EXIT_CODE=${PIPESTATUS[0]}
|
|
set -e
|
|
|
|
python3 "$SUMMARY_SCRIPT" \
|
|
--xcresult "$XCRESULT_PATH" \
|
|
--raw-log "$RAW_LOG_PATH" \
|
|
--output-md "$REPORT_MD_PATH" \
|
|
--output-json "$REPORT_JSON_PATH" \
|
|
--output-txt "$REPORT_TXT_PATH" \
|
|
--test-type "$TEST_TYPE" \
|
|
--xcodebuild-exit-code "$TEST_EXIT_CODE"
|
|
|
|
echo
|
|
cat "$REPORT_TXT_PATH"
|
|
echo
|
|
echo "Artifacts"
|
|
echo " summary: $REPORT_TXT_PATH"
|
|
echo " report: $REPORT_MD_PATH"
|
|
echo " json: $REPORT_JSON_PATH"
|
|
echo " xcresult: $XCRESULT_PATH"
|
|
echo " raw log: $RAW_LOG_PATH"
|
|
|
|
exit "$TEST_EXIT_CODE"
|