Skip to content

Commit 9f4169f

Browse files
Scope from JSON file
1 parent 59755c0 commit 9f4169f

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

.github/workflows/ios-end-to-end-tests.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
inputs:
1818
# Optionally specify a test case or suite to run.
1919
# Must be in the format MullvadVPNUITest/<test-suite-name>/<test-case-name> where test case name is optional.
20-
test_name:
20+
user_supplied_test_name:
2121
description: 'Only run test case/suite'
2222
required: false
2323
schedule:
@@ -52,10 +52,17 @@ jobs:
5252
if [ -n "$TEST_NAME" ]; then
5353
echo "::set-output name=test_runs_json::'[\"$TEST_NAME\"]'"
5454
else
55-
# List test suites based on file names
56-
test_suites=$(find . -name "*Tests.swift" | sed 's/.*\///' | sed 's/\.swift//' | sed '/SettingsMigrationTests/d' | sort)
57-
test_suites_json=$(printf "$test_suites" | jq --compact-output --raw-input --slurp 'split("\n")')
58-
echo "test_suites_json=$test_suites_json" >> $GITHUB_ENV
55+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
56+
test_suites_json=$(jq -r --compact-output .tests.pr-merge-to-main tests.json)
57+
echo "test_suites_json=$test_suites_json" >> $GITHUB_ENV
58+
elif [[ "${{ github.event_name }}" == "schedule" ]] | [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
59+
test_suites_json=$(jq -r --compact-output .tests.all tests.json)
60+
echo "test_suites_json=$test_suites_json" >> $GITHUB_ENV
61+
# List test suites based on file names
62+
#test_suites=$(find . -name "*Tests.swift" | sed 's/.*\///' | sed 's/\.swift//' | sed '/SettingsMigrationTests/d' | sort)
63+
#test_suites_json=$(printf "$test_suites" | jq --compact-output --raw-input --slurp 'split("\n")')
64+
#echo "test_suites_json=$test_suites_json" >> $GITHUB_ENV
65+
fi
5966
fi
6067
working-directory: ios/MullvadVPNUITests
6168
outputs:
@@ -109,7 +116,7 @@ jobs:
109116
uses: ./.github/actions/build-ios-e2e-tests
110117
with:
111118
xcode_test_plan: ${{ env.XCODE_TEST_PLAN }}
112-
test_name: ${{ github.event.inputs.test_name }}
119+
test_name: ${{ github.event.inputs.user_supplied_test_name }}
113120
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
114121
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
115122
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}

ios/MullvadVPNUITests/tests.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"tests": {
3+
"all": [
4+
"MullvadVPNUITests/AccountTests",
5+
"MullvadVPNUITests/ConnectivityTests",
6+
"MullvadVPNUITests/CustomListsTests",
7+
"MullvadVPNUITests/RelayTests",
8+
"MullvadVPNUITests/ScreenshotTests",
9+
"MullvadVPNUITests/SettingsTests"
10+
],
11+
"pr-merge-to-main": [
12+
"MullvadVPNUITests/AccountTests/testLogin",
13+
"MullvadVPNUITests/AccountTests/testCreateAccount"
14+
]
15+
}
16+
}

0 commit comments

Comments
 (0)