Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix screenshot tests failing #6336

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/ios-screenshots-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/ios-screenshots-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
3 changes: 0 additions & 3 deletions ios/Configurations/Screenshots.xcconfig.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
2 changes: 1 addition & 1 deletion ios/Configurations/UITests.xcconfig.template
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
2 changes: 2 additions & 0 deletions ios/MullvadVPN/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
XCTFail("Failed to deserialize JSON response")
}
} else {
XCTFail("Request failed")
XCTFail("Request failed with status code \(response.statusCode)")

Check failure on line 110 in ios/MullvadVPNUITests/Networking/PartnerAPIClient.swift

View workflow job for this annotation

GitHub Actions / End to end tests

testLogin, failed - Request failed with status code 403
}

completionHandlerInvokedExpectation.fulfill()
Expand Down
3 changes: 3 additions & 0 deletions ios/MullvadVPNUITests/Pages/SelectLocationPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 7 additions & 5 deletions ios/Snapfile
Original file line number Diff line number Diff line change
@@ -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([
Expand All @@ -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")
Expand Down
Loading