Skip to content

Commit

Permalink
Fix for failing iOS screenshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasberglund committed Jun 10, 2024
1 parent 3bcde84 commit 89cb242
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ios-screenshots-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
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 @@ -43,7 +44,9 @@ jobs:
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
sed -i "" \
"/PARTNER_API_TOKEN =/ s#= .*#= $PARTNER_API_TOKEN#" \
UITests.xcconfig
working-directory: ios/Configurations

- name: Bundle
Expand Down
7 changes: 5 additions & 2 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 @@ -60,7 +61,9 @@ jobs:
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
sed -i "" \
"/PARTNER_API_TOKEN =/ s#= .*#= $PARTNER_API_TOKEN#" \
UITests.xcconfig
working-directory: ios/Configurations

- name: Install xcbeautify
Expand Down
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/MullvadVPNUITests/Networking/PartnerAPIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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

0 comments on commit 89cb242

Please sign in to comment.