diff --git a/.github/workflows/ios-screenshots-creation.yml b/.github/workflows/ios-screenshots-creation.yml index 4b7e6a3692d8..a8789a2be75b 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 7bc5cd670df6..d78ca6ef51d1 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 025de82739ee..e885dd21d0fb 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 030fe46d3129..74fb0355ee96 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 c62f632af01f..48854dc4c3f9 100644 --- a/ios/MullvadVPN/Supporting Files/Info.plist +++ b/ios/MullvadVPN/Supporting Files/Info.plist @@ -32,6 +32,8 @@ $(MARKETING_VERSION) CFBundleVersion $(CURRENT_PROJECT_VERSION) + HasTimeAccountNumber + $(HAS_TIME_ACCOUNT_NUMBER) ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift b/ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift index 67d1d7acdddb..2a26d5bf9993 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 8c87309a04fd..95b9416c1c59 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 43c55ae82dca..bed7cfd3f1cb 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")