-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathrun-e2e-tags.sh
executable file
·48 lines (38 loc) · 1.36 KB
/
run-e2e-tags.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Set strict error handling
set -euo pipefail
# Constants
BASE_DIR="./e2e/specs"
# TEST_SUITE_TAG=".*SmokeEarn.*"
echo "Searching for tests with pattern: $TEST_SUITE_TAG"
# Initialize an array to store matching files
declare -a matching_files
# Find matching files and store them in the array
while IFS= read -r file; do
if [ -n "$file" ]; then
matching_files+=("$file")
echo "Found matching test: $file"
fi
done < <(find "$BASE_DIR" -type f -name "*.spec.js" -exec grep -l "$TEST_SUITE_TAG" {} \; | sort -u)
# Check if any files were found
if [ ${#matching_files[@]} -eq 0 ]; then
echo " No test files found containing pattern: $TEST_SUITE_TAG"
exit 1
fi
# Display results
echo -e "\n Found ${#matching_files[@]} matching test files:"
printf '%s\n' "${matching_files[@]}" | sed 's/^/ - /'
# Run all matching tests in a single command
echo -e "\nRunning matching tests..."
# Join array elements with spaces to pass to test command
TEST_FILES="${matching_files[*]}"
# yarn test:e2e:ios:debug:run $TEST_FILES
if [[ "$BITRISE_TRIGGERED_WORKFLOW_ID" == *"ios"* ]]; then
echo "Detected iOS workflow"
IGNORE_BOXLOGS_DEVELOPMENT="true" \
yarn test:e2e:ios:run:qa-release $TEST_FILES
else
echo "Detected Android workflow"
IGNORE_BOXLOGS_DEVELOPMENT="true" \
yarn test:e2e:android:run:qa-release $TEST_FILES
fi