Skip to content

Commit b86fc46

Browse files
committed
Merge remote-tracking branch 'origin/test-updating-between-previous-stable-and-current-stable-ios-424-2'
2 parents 7170e05 + 302ce38 commit b86fc46

25 files changed

+811
-80
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 'iOS end to end tests action'
2+
description: 'Prepares and runs end to end tests on iOS device'
3+
inputs:
4+
ios_device_pin_code:
5+
description: 'iOS Device Pin Code'
6+
required: true
7+
test_device_identifier_uuid:
8+
description: 'Test Device Identifier UUID'
9+
required: true
10+
has_time_account_number:
11+
description: 'Has Time Account Number'
12+
required: true
13+
no_time_account_number:
14+
description: 'No Time Account Number'
15+
required: true
16+
test_device_udid:
17+
description: 'Test Device UDID'
18+
required: true
19+
xcode_test_plan:
20+
description: 'Xcode Test Plan to run'
21+
required: true
22+
23+
runs:
24+
using: 'composite'
25+
steps:
26+
- name: Configure Xcode project
27+
run: |
28+
for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done
29+
sed -i "" "/^HAS_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
30+
sed -i "" "/^NO_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
31+
sed -i "" \
32+
"/IOS_DEVICE_PIN_CODE =/ s/= .*/= $IOS_DEVICE_PIN_CODE/" \
33+
UITests.xcconfig
34+
sed -i "" \
35+
"/TEST_DEVICE_IDENTIFIER_UUID =/ s/= .*/= $TEST_DEVICE_IDENTIFIER_UUID/" \
36+
UITests.xcconfig
37+
echo -e "\nHAS_TIME_ACCOUNT_NUMBER = $HAS_TIME_ACCOUNT_NUMBER" >> UITests.xcconfig
38+
echo "NO_TIME_ACCOUNT_NUMBER = $NO_TIME_ACCOUNT_NUMBER" >> UITests.xcconfig
39+
shell: bash
40+
working-directory: ios/Configurations
41+
env:
42+
IOS_DEVICE_PIN_CODE: ${{ inputs.ios_device_pin_code }}
43+
TEST_DEVICE_IDENTIFIER_UUID: ${{ inputs.test_device_identifier_uuid }}
44+
HAS_TIME_ACCOUNT_NUMBER: ${{ inputs.has_time_account_number }}
45+
NO_TIME_ACCOUNT_NUMBER: ${{ inputs.no_time_account_number }}
46+
47+
- name: Run end-to-end-tests
48+
run: |
49+
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
50+
-project MullvadVPN.xcodeproj \
51+
-scheme MullvadVPNUITests \
52+
-testPlan $XCODE_TEST_PLAN \
53+
-destination "platform=iOS,id=$TEST_DEVICE_UDID" \
54+
clean test 2>&1 | xcbeautify --report junit --report-path test-report
55+
shell: bash
56+
working-directory: ios/
57+
env:
58+
XCODE_TEST_PLAN: ${{ inputs.xcode_test_plan }}
59+
TEST_DEVICE_UDID: ${{ inputs.test_device_udid }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
name: iOS settings migration tests
3+
permissions:
4+
contents: read
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
# At midnight every day.
9+
# Notifications for scheduled workflows are sent to the user who last modified the cron
10+
# syntax in the workflow file. If you update this you must have notifications for
11+
# Github Actions enabled, so these don't go unnoticed.
12+
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs
13+
- cron: '0 0 * * *'
14+
jobs:
15+
test:
16+
name: Settings migration end to end tests
17+
runs-on: [self-hosted, macOS, ios-test]
18+
env:
19+
OLD_APP_COMMIT_HASH: 895b7d98825e678f5d7023d5ea3c9b7beee89280
20+
steps:
21+
- name: Configure Rust
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: stable
25+
override: true
26+
target: aarch64-apple-ios
27+
28+
- name: Uninstall app
29+
run: ios-deploy --id ${{ secrets.IOS_TEST_DEVICE_UDID }} --uninstall_only --bundle_id net.mullvad.MullvadVPN
30+
31+
- name: Checkout old repository version
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ env.OLD_APP_COMMIT_HASH }}
35+
36+
- name: Change DNS settings on old app version
37+
uses: ./.github/actions/ios-end-to-end-tests
38+
with:
39+
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
40+
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
41+
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
42+
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
43+
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }}
44+
xcode_test_plan: 'MullvadVPNUITestsChangeDNSSettings'
45+
46+
- name: Store test report for changing DNS settings
47+
uses: actions/upload-artifact@v4
48+
if: always()
49+
with:
50+
name: test-report-change-dns-settings
51+
path: ios/test-report/junit.xml
52+
53+
- name: Checkout repository to get the current app version
54+
uses: actions/checkout@v4
55+
56+
- name: Verify DNS settings still changed on current app version
57+
uses: ./.github/actions/ios-end-to-end-tests
58+
if: always()
59+
with:
60+
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
61+
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
62+
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
63+
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
64+
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }}
65+
xcode_test_plan: 'MullvadVPNUITestsVerifyDNSSettingsChanged'
66+
67+
- name: Store test report for verifying DNS settings
68+
uses: actions/upload-artifact@v4
69+
if: always()
70+
with:
71+
name: test-report-verify-dns-settings
72+
path: ios/test-report/junit.xml
73+
74+
- name: Checkout old repository version
75+
uses: actions/checkout@v4
76+
with:
77+
ref: ${{ env.OLD_APP_COMMIT_HASH }}
78+
79+
- name: Change all other settings on old app version
80+
uses: ./.github/actions/ios-end-to-end-tests
81+
if: always()
82+
with:
83+
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
84+
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
85+
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
86+
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
87+
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }}
88+
xcode_test_plan: 'MullvadVPNUITestsChangeSettings'
89+
90+
- name: Store test report for changing all settings
91+
uses: actions/upload-artifact@v4
92+
if: always()
93+
with:
94+
name: test-report-change-all-other-settings
95+
path: ios/test-report/junit.xml
96+
97+
- name: Checkout repository to get the current app version
98+
uses: actions/checkout@v4
99+
100+
- name: Verify all other settings still changed on current app version
101+
uses: ./.github/actions/ios-end-to-end-tests
102+
if: always()
103+
with:
104+
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
105+
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
106+
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
107+
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
108+
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }}
109+
xcode_test_plan: 'MullvadVPNUITestsVerifySettingsChanged'
110+
111+
- name: Store test report for verifying all other settings
112+
uses: actions/upload-artifact@v4
113+
if: always()
114+
with:
115+
name: test-report-verify-all-other-settings
116+
path: ios/test-report/junit.xml

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

+32-37
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,51 @@ on:
1414
- .github/workflows/ios-end-to-end-tests.yml
1515
- ios/**
1616
workflow_dispatch:
17+
schedule:
18+
# At midnight every day.
19+
# Notifications for scheduled workflows are sent to the user who last modified the cron
20+
# syntax in the workflow file. If you update this you must have notifications for
21+
# Github Actions enabled, so these don't go unnoticed.
22+
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs
23+
- cron: '0 0 * * *'
1724
jobs:
1825
test:
1926
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch'
2027
name: End to end tests
2128
runs-on: [self-hosted, macOS, ios-test]
22-
env:
23-
IOS_DEVICE_PIN_CODE: ${{ secrets.IOS_DEVICE_PIN_CODE }}
24-
TEST_DEVICE_IDENTIFIER_UUID: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
25-
TEST_DEVICE_UDID: ${{ secrets.IOS_TEST_DEVICE_UDID }}
26-
HAS_TIME_ACCOUNT_NUMBER: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
27-
NO_TIME_ACCOUNT_NUMBER: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
2829
steps:
30+
- name: Configure Rust
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: stable
34+
override: true
35+
target: aarch64-apple-ios
36+
2937
- name: Checkout repository
3038
uses: actions/checkout@v4
3139

32-
- name: Configure Rust
33-
run: |
34-
rustup default stable
35-
rustup update stable
36-
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
37-
38-
- name: Configure Xcode project
40+
- name: Select test plan to execute
3941
run: |
40-
for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done
41-
sed -i "" "/^HAS_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
42-
sed -i "" "/^NO_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
43-
sed -i "" \
44-
"/IOS_DEVICE_PIN_CODE =/ s/= .*/= $IOS_DEVICE_PIN_CODE/" \
45-
UITests.xcconfig
46-
sed -i "" \
47-
"/TEST_DEVICE_IDENTIFIER_UUID =/ s/= .*/= $TEST_DEVICE_IDENTIFIER_UUID/" \
48-
UITests.xcconfig
49-
echo -e "\nHAS_TIME_ACCOUNT_NUMBER = $HAS_TIME_ACCOUNT_NUMBER" >> UITests.xcconfig
50-
echo "NO_TIME_ACCOUNT_NUMBER = $NO_TIME_ACCOUNT_NUMBER" >> UITests.xcconfig
51-
working-directory: ios/Configurations
42+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
43+
echo "XCODE_TEST_PLAN=MullvadVPNUITestsSmoke" >> $GITHUB_ENV
44+
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
45+
echo "XCODE_TEST_PLAN=MullvadVPNUITestsAll" >> $GITHUB_ENV
46+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
47+
echo "XCODE_TEST_PLAN=MullvadVPNUITestsAll" >> $GITHUB_ENV
48+
fi
5249
53-
- name: Run end-to-end-tests
54-
run: |
55-
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
56-
-project MullvadVPN.xcodeproj \
57-
-scheme MullvadVPNUITests \
58-
-configuration Debug \
59-
-testPlan MullvadVPNUITestsSmoke \
60-
-destination "platform=iOS,id=$TEST_DEVICE_UDID" \
61-
-disableAutomaticPackageResolution \
62-
test 2>&1 | xcbeautify --report junit --report-path test-report
63-
working-directory: ios/
50+
- name: iOS end to end tests action
51+
uses: ./.github/actions/ios-end-to-end-tests
52+
with:
53+
xcode_test_plan: ${{ env.XCODE_TEST_PLAN }}
54+
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }}
55+
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }}
56+
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }}
57+
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }}
58+
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }}
6459

6560
- name: Comment PR on test failure
66-
if: failure() && github.event_name != 'workflow_dispatch'
61+
if: failure() && github.event_name == 'pull_request'
6762
uses: actions/github-script@v7
6863
with:
6964
github-token: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)