Skip to content

Commit ab77c7e

Browse files
committed
Merge branch 'fix-screenshot-tests-failing'
2 parents 121286d + 6d905da commit ab77c7e

File tree

8 files changed

+45
-24
lines changed

8 files changed

+45
-24
lines changed

.github/workflows/ios-screenshots-creation.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,21 @@ jobs:
3838
3939
- name: Configure Xcode project
4040
run: |
41-
cp Base.xcconfig.template Base.xcconfig
42-
cp App.xcconfig.template App.xcconfig
43-
cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig
44-
cp Screenshots.xcconfig.template Screenshots.xcconfig
45-
cp Api.xcconfig.template Api.xcconfig
46-
sed -i "" "s/MULLVAD_ACCOUNT_TOKEN = /MULLVAD_ACCOUNT_TOKEN = $TEST_ACCOUNT/g" Screenshots.xcconfig
41+
for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done
42+
sed -i "" \
43+
"/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \
44+
UITests.xcconfig
4745
working-directory: ios/Configurations
4846

4947
- name: Bundle
5048
run: bundle install
5149
working-directory: ios
5250

51+
- name: Install protobuf
52+
run: |
53+
brew update
54+
brew install protobuf
55+
5356
- name: Create screenshots
5457
run: bundle exec fastlane snapshot --cloned_source_packages_path "$SOURCE_PACKAGES_PATH"
5558
working-directory: ios

.github/workflows/ios-screenshots-tests.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ on:
1414
workflow_dispatch:
1515
jobs:
1616
test:
17-
if: github.event.pull_request.merged
17+
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch'
1818
name: Screenshot tests
1919
runs-on: macos-13-xlarge
2020
env:
2121
SOURCE_PACKAGES_PATH: .spm
2222
TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }}
23+
PARTNER_API_TOKEN: ${{ secrets.STAGEMOLE_PARTNER_AUTH }}
2324
steps:
2425
- name: Checkout repository
2526
uses: actions/checkout@v3
@@ -54,15 +55,17 @@ jobs:
5455
5556
- name: Configure Xcode project
5657
run: |
57-
cp Base.xcconfig.template Base.xcconfig
58-
cp App.xcconfig.template App.xcconfig
59-
cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig
60-
cp Screenshots.xcconfig.template Screenshots.xcconfig
61-
cp Api.xcconfig.template Api.xcconfig
62-
cp UITests.xcconfig.template UITests.xcconfig
63-
sed -i "" "s/MULLVAD_ACCOUNT_TOKEN = /MULLVAD_ACCOUNT_TOKEN = $TEST_ACCOUNT/g" Screenshots.xcconfig
58+
for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done
59+
sed -i "" \
60+
"/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \
61+
UITests.xcconfig
6462
working-directory: ios/Configurations
6563

64+
- name: Install zip
65+
run: |
66+
brew update
67+
brew install zip
68+
6669
- name: Install xcbeautify
6770
run: |
6871
brew update
@@ -82,5 +85,16 @@ jobs:
8285
-destination "platform=iOS Simulator,name=iPhone 15" \
8386
-clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \
8487
-disableAutomaticPackageResolution \
88+
-resultBundlePath xcode-test-report \
8589
test 2>&1 | xcbeautify
8690
working-directory: ios/
91+
92+
- name: Archive test report
93+
run: zip -r test-report.zip ios/xcode-test-report.xcresult
94+
95+
- name: Store test report artifact
96+
if: always()
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: test-report
100+
path: test-report.zip

ios/Configurations/Screenshots.xcconfig.template

-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@
55
PROVISIONING_PROFILE_SPECIFIER[config=Debug][sdk=*][arch=*] = Screenshots Development
66
PROVISIONING_PROFILE_SPECIFIER[config=Staging][sdk=*][arch=*] = Screenshots Development
77
PROVISIONING_PROFILE_SPECIFIER[config=MockRelease][sdk=*][arch=*] = Screenshots Development
8-
9-
// Mullvad account number used when taking screenshots
10-
MULLVAD_ACCOUNT_TOKEN =

ios/Configurations/UITests.xcconfig.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ IOS_DEVICE_PIN_CODE =
77
TEST_DEVICE_IDENTIFIER_UUID =
88

99
// Base64 encoded token for the partner API. Will only be used if account numbers are not configured.
10-
PARTNER_API_TOKEN =
10+
// PARTNER_API_TOKEN =
1111

1212
// Mullvad accounts used by UI tests
1313
HAS_TIME_ACCOUNT_NUMBER[config=Debug] =

ios/MullvadVPN/Supporting Files/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<string>$(MARKETING_VERSION)</string>
3333
<key>CFBundleVersion</key>
3434
<string>$(CURRENT_PROJECT_VERSION)</string>
35+
<key>HasTimeAccountNumber</key>
36+
<string>$(HAS_TIME_ACCOUNT_NUMBER)</string>
3537
<key>ITSAppUsesNonExemptEncryption</key>
3638
<false/>
3739
<key>LSRequiresIPhoneOS</key>

ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class PartnerAPIClient {
107107
XCTFail("Failed to deserialize JSON response")
108108
}
109109
} else {
110-
XCTFail("Request failed")
110+
XCTFail("Request failed with status code \(response.statusCode)")
111111
}
112112

113113
completionHandlerInvokedExpectation.fulfill()

ios/MullvadVPNUITests/Pages/SelectLocationPage.swift

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class SelectLocationPage: Page {
6868
}
6969

7070
@discardableResult func tapCustomListEllipsisButton() -> Self {
71+
// This wait should not be needed, but is due to the issues we are having with the ellipsis button
72+
_ = app.buttons[.openCustomListsMenuButton].waitForExistence(timeout: BaseUITestCase.shortTimeout)
73+
7174
let customListEllipsisButtons = app.buttons
7275
.matching(identifier: AccessibilityIdentifier.openCustomListsMenuButton.rawValue).allElementsBoundByIndex
7376

ios/Snapfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
ios_version '17.2'
2+
13
# A list of devices you want to take the screenshots from
24
devices([
35
"iPhone SE (3rd generation)",
46
"iPhone 15 Pro",
5-
"iPhone 15 Pro Max",
6-
"iPad Pro (11-inch) (4th generation)",
7-
"iPad Pro (12.9-inch) (6th generation)"
7+
"iPhone 15 Pro Max"
8+
#"iPad Pro (11-inch) (4th generation)",
9+
#"iPad Pro (12.9-inch) (6th generation)"
810
])
911

1012
languages([
@@ -14,8 +16,8 @@ languages([
1416
# ["pt", "pt_BR"] # Portuguese with Brazilian locale
1517
])
1618

17-
# The name of the scheme which contains the UI Tests
18-
scheme("MullvadVPNUITests")
19+
# The name of the scheme which contains the screenshot UI Tests
20+
scheme("MullvadVPN")
1921

2022
# The name of the test plan which contains the UI Tests
2123
testplan("MullvadVPNScreenshots")

0 commit comments

Comments
 (0)