diff options
| author | Niklas Berglund <niklas.berglund@gmail.com> | 2024-06-10 14:09:53 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2024-06-19 13:10:26 +0200 |
| commit | 6d905da1b7610baf6a006dcd8ea998817a8fb0e4 (patch) | |
| tree | 9947ed2396152ab8b81210f7466ee65ceaf6df93 | |
| parent | 121286df1096aa5981c5dbe57155b92a4cb05d8b (diff) | |
| download | mullvadvpn-6d905da1b7610baf6a006dcd8ea998817a8fb0e4.tar.xz mullvadvpn-6d905da1b7610baf6a006dcd8ea998817a8fb0e4.zip | |
Fix for failing iOS screenshot tests
| -rw-r--r-- | .github/workflows/ios-screenshots-creation.yml | 15 | ||||
| -rw-r--r-- | .github/workflows/ios-screenshots-tests.yml | 30 | ||||
| -rw-r--r-- | ios/Configurations/Screenshots.xcconfig.template | 3 | ||||
| -rw-r--r-- | ios/Configurations/UITests.xcconfig.template | 2 | ||||
| -rw-r--r-- | ios/MullvadVPN/Supporting Files/Info.plist | 2 | ||||
| -rw-r--r-- | ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift | 2 | ||||
| -rw-r--r-- | ios/MullvadVPNUITests/Pages/SelectLocationPage.swift | 3 | ||||
| -rw-r--r-- | ios/Snapfile | 12 |
8 files changed, 45 insertions, 24 deletions
diff --git a/.github/workflows/ios-screenshots-creation.yml b/.github/workflows/ios-screenshots-creation.yml index 4b7e6a3692..a8789a2be7 100644 --- a/.github/workflows/ios-screenshots-creation.yml +++ b/.github/workflows/ios-screenshots-creation.yml @@ -38,18 +38,21 @@ jobs: - name: Configure Xcode project run: | - cp Base.xcconfig.template Base.xcconfig - cp App.xcconfig.template App.xcconfig - cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig - cp Screenshots.xcconfig.template Screenshots.xcconfig - cp Api.xcconfig.template Api.xcconfig - sed -i "" "s/MULLVAD_ACCOUNT_TOKEN = /MULLVAD_ACCOUNT_TOKEN = $TEST_ACCOUNT/g" Screenshots.xcconfig + for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done + sed -i "" \ + "/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \ + UITests.xcconfig working-directory: ios/Configurations - name: Bundle run: bundle install working-directory: ios + - name: Install protobuf + run: | + brew update + brew install protobuf + - name: Create screenshots run: bundle exec fastlane snapshot --cloned_source_packages_path "$SOURCE_PACKAGES_PATH" working-directory: ios diff --git a/.github/workflows/ios-screenshots-tests.yml b/.github/workflows/ios-screenshots-tests.yml index 7bc5cd670d..d78ca6ef51 100644 --- a/.github/workflows/ios-screenshots-tests.yml +++ b/.github/workflows/ios-screenshots-tests.yml @@ -14,12 +14,13 @@ on: workflow_dispatch: jobs: test: - if: github.event.pull_request.merged + if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' name: Screenshot tests runs-on: macos-13-xlarge env: SOURCE_PACKAGES_PATH: .spm TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }} + PARTNER_API_TOKEN: ${{ secrets.STAGEMOLE_PARTNER_AUTH }} steps: - name: Checkout repository uses: actions/checkout@v3 @@ -54,15 +55,17 @@ jobs: - name: Configure Xcode project run: | - cp Base.xcconfig.template Base.xcconfig - cp App.xcconfig.template App.xcconfig - cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig - cp Screenshots.xcconfig.template Screenshots.xcconfig - cp Api.xcconfig.template Api.xcconfig - cp UITests.xcconfig.template UITests.xcconfig - sed -i "" "s/MULLVAD_ACCOUNT_TOKEN = /MULLVAD_ACCOUNT_TOKEN = $TEST_ACCOUNT/g" Screenshots.xcconfig + for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done + sed -i "" \ + "/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \ + UITests.xcconfig working-directory: ios/Configurations + - name: Install zip + run: | + brew update + brew install zip + - name: Install xcbeautify run: | brew update @@ -82,5 +85,16 @@ jobs: -destination "platform=iOS Simulator,name=iPhone 15" \ -clonedSourcePackagesDirPath "$SOURCE_PACKAGES_PATH" \ -disableAutomaticPackageResolution \ + -resultBundlePath xcode-test-report \ test 2>&1 | xcbeautify working-directory: ios/ + + - name: Archive test report + run: zip -r test-report.zip ios/xcode-test-report.xcresult + + - name: Store test report artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-report + path: test-report.zip diff --git a/ios/Configurations/Screenshots.xcconfig.template b/ios/Configurations/Screenshots.xcconfig.template index 025de82739..e885dd21d0 100644 --- a/ios/Configurations/Screenshots.xcconfig.template +++ b/ios/Configurations/Screenshots.xcconfig.template @@ -5,6 +5,3 @@ PROVISIONING_PROFILE_SPECIFIER[config=Debug][sdk=*][arch=*] = Screenshots Development PROVISIONING_PROFILE_SPECIFIER[config=Staging][sdk=*][arch=*] = Screenshots Development PROVISIONING_PROFILE_SPECIFIER[config=MockRelease][sdk=*][arch=*] = Screenshots Development - -// Mullvad account number used when taking screenshots -MULLVAD_ACCOUNT_TOKEN = diff --git a/ios/Configurations/UITests.xcconfig.template b/ios/Configurations/UITests.xcconfig.template index 030fe46d31..74fb0355ee 100644 --- a/ios/Configurations/UITests.xcconfig.template +++ b/ios/Configurations/UITests.xcconfig.template @@ -7,7 +7,7 @@ IOS_DEVICE_PIN_CODE = TEST_DEVICE_IDENTIFIER_UUID = // Base64 encoded token for the partner API. Will only be used if account numbers are not configured. -PARTNER_API_TOKEN = +// PARTNER_API_TOKEN = // Mullvad accounts used by UI tests HAS_TIME_ACCOUNT_NUMBER[config=Debug] = diff --git a/ios/MullvadVPN/Supporting Files/Info.plist b/ios/MullvadVPN/Supporting Files/Info.plist index c62f632af0..48854dc4c3 100644 --- a/ios/MullvadVPN/Supporting Files/Info.plist +++ b/ios/MullvadVPN/Supporting Files/Info.plist @@ -32,6 +32,8 @@ <string>$(MARKETING_VERSION)</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> + <key>HasTimeAccountNumber</key> + <string>$(HAS_TIME_ACCOUNT_NUMBER)</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSRequiresIPhoneOS</key> diff --git a/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift b/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift index 67d1d7acdd..2a26d5bf99 100644 --- a/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift +++ b/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift @@ -107,7 +107,7 @@ class PartnerAPIClient { XCTFail("Failed to deserialize JSON response") } } else { - XCTFail("Request failed") + XCTFail("Request failed with status code \(response.statusCode)") } completionHandlerInvokedExpectation.fulfill() diff --git a/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift b/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift index 8c87309a04..95b9416c1c 100644 --- a/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift +++ b/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift @@ -68,6 +68,9 @@ class SelectLocationPage: Page { } @discardableResult func tapCustomListEllipsisButton() -> Self { + // This wait should not be needed, but is due to the issues we are having with the ellipsis button + _ = app.buttons[.openCustomListsMenuButton].waitForExistence(timeout: BaseUITestCase.shortTimeout) + let customListEllipsisButtons = app.buttons .matching(identifier: AccessibilityIdentifier.openCustomListsMenuButton.rawValue).allElementsBoundByIndex diff --git a/ios/Snapfile b/ios/Snapfile index 43c55ae82d..bed7cfd3f1 100644 --- a/ios/Snapfile +++ b/ios/Snapfile @@ -1,10 +1,12 @@ +ios_version '17.2' + # A list of devices you want to take the screenshots from devices([ "iPhone SE (3rd generation)", "iPhone 15 Pro", - "iPhone 15 Pro Max", - "iPad Pro (11-inch) (4th generation)", - "iPad Pro (12.9-inch) (6th generation)" + "iPhone 15 Pro Max" + #"iPad Pro (11-inch) (4th generation)", + #"iPad Pro (12.9-inch) (6th generation)" ]) languages([ @@ -14,8 +16,8 @@ languages([ # ["pt", "pt_BR"] # Portuguese with Brazilian locale ]) -# The name of the scheme which contains the UI Tests -scheme("MullvadVPNUITests") +# The name of the scheme which contains the screenshot UI Tests +scheme("MullvadVPN") # The name of the test plan which contains the UI Tests testplan("MullvadVPNScreenshots") |
