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

Make tests work on iOS 17 #356

Merged
merged 3 commits into from
Sep 7, 2023
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: 12 additions & 3 deletions .github/workflows/cron-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
# Runs "At 02:00 every night"
- cron: '0 2 * * *'

pull_request:
branches:
- 'main'
# TODO: commented until `develop` branch is in place
testableapple marked this conversation as resolved.
Show resolved Hide resolved
# pull_request:
# branches:
# - 'main'

workflow_dispatch:

Expand All @@ -24,6 +25,12 @@ jobs:
strategy:
matrix:
include:
# TODO: uncomment this block as soon as Xcode 15 is stable on CI
# - ios: 17.0
# xcode: 15.0
# os: macos-13
# device: "iPhone 14 Pro Max"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we use iPhone 14 Pro so far?

Copy link
Contributor Author

@testableapple testableapple Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, these are cron checks, just copy-pasted logic from the main repo to align the environment. But device name is essential only for Snapshot tests, for other ones it's good to test on different devices to cover more scenarios.

# setup_runtime: false
- ios: 16.4
xcode: 14.3.1
os: macos-13
Expand Down Expand Up @@ -83,6 +90,8 @@ jobs:
strategy:
matrix:
include:
- xcode: 15.0
os: macos-13
- xcode: 14.3.1
os: macos-13
- xcode: 14.2
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/smoke-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- '**'
- '!main'
# - '!main' TODO: commented until `develop` branch is in place

workflow_dispatch:

Expand All @@ -14,7 +14,7 @@ concurrency:

env:
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI
IOS_SIMULATOR_DEVICE: "iPhone 14 Pro (16.4)"
IOS_SIMULATOR_DEVICE: "iPhone 14 Pro (17.0)"

jobs:
automated-code-review:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
INSTALL_XCPARSE: true
- name: Run UI Tests (Debug)
run: bundle exec fastlane test_ui device:"${{ env.IOS_SIMULATOR_DEVICE }}"
timeout-minutes: 30
timeout-minutes: 40
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.number }}
Expand Down Expand Up @@ -112,6 +112,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.number }}
MATRIX_SIZE: ${{ strategy.job-total }}
IOS_SIMULATOR_DEVICE: "iPhone 14 Pro (16.4)" # TODO: delete this line as soon as Xcode 15 is stable on CI
testableapple marked this conversation as resolved.
Show resolved Hide resolved
XCODE_VERSION: "14.3.1" # TODO: delete this line as soon as Xcode 15 is stable on CI
- name: Allure TestOps Upload
if: env.LAUNCH_ID != '' && (success() || failure())
run: bundle exec fastlane allure_upload launch_id:$LAUNCH_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
}
.accessibilityElement(children: .contain)
.accessibilityIdentifier("ReactionsOverlayView")
.onRotate { orientation in
.onRotate { _ in
if isIPad {
self.orientationChanged = true
}
Expand Down Expand Up @@ -362,6 +362,6 @@ struct DeviceRotationViewModifier: ViewModifier {

extension View {
func onRotate(perform action: @escaping (UIDeviceOrientation) -> Void) -> some View {
self.modifier(DeviceRotationViewModifier(action: action))
modifier(DeviceRotationViewModifier(action: action))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AddUsersViewModel_Tests: StreamChatTestCase {
}
.store(in: &cancellables)

waitForExpectations(timeout: 1)
waitForExpectations(timeout: defaultTimeout)
}

func test_addUsersViewModel_onUserAppear() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ class AddUsersView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_directChannelOnlineSnapshot() {
Expand All @@ -46,7 +46,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_directChannelMutedSnapshot() {
Expand All @@ -66,7 +66,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_groupCollapsedSnapshot() {
Expand All @@ -89,7 +89,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_smallGroupSnapshot() {
Expand All @@ -112,7 +112,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_groupExpandedSnapshot() {
Expand All @@ -137,7 +137,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_navBarSnapshot() {
Expand Down Expand Up @@ -166,7 +166,7 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: navigationView, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: navigationView, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelInfoView_addUsersShownSnapshot() {
Expand All @@ -191,6 +191,6 @@ class ChatChannelInfoView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FileAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_fileAttachmentsView_emptySnapshot() {
Expand All @@ -40,7 +40,7 @@ class FileAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_fileAttachmentsView_loadingSnapshot() {
Expand All @@ -55,7 +55,7 @@ class FileAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_fileAttachmentsPickerView_snapshot() {
Expand All @@ -64,6 +64,6 @@ class FileAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MediaAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_mediaAttachmentsView_emptySnapshot() {
Expand All @@ -41,7 +41,7 @@ class MediaAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_mediaAttachmentsView_loading() {
Expand All @@ -54,6 +54,6 @@ class MediaAttachmentsView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PinnedMessagesView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_pinnedMessagesView_emptySnapshot() {
Expand All @@ -39,7 +39,7 @@ class PinnedMessagesView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ChatChannelHeader_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelHeader_snapshot() {
Expand All @@ -41,7 +41,7 @@ class ChatChannelHeader_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_channelTitleView_snapshot() {
Expand All @@ -53,6 +53,6 @@ class ChatChannelHeader_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ class ChatChannelViewDateOverlay_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ChatChannelView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelView_snapshotEmpty() {
Expand Down Expand Up @@ -82,7 +82,7 @@ class ChatChannelView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_chatChannelView_snapshotLoading() {
Expand All @@ -107,7 +107,7 @@ class ChatChannelView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_defaultChannelHeader_snapshot() {
Expand All @@ -126,6 +126,6 @@ class ChatChannelView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GalleryView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_galleryHeader_snapshot() {
Expand All @@ -43,7 +43,7 @@ class GalleryView_Tests: StreamChatTestCase {
.frame(width: defaultScreenSize.width, height: 44)

// Then
assertSnapshot(matching: header, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: header, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_gridView_snapshotLoading() {
Expand All @@ -55,6 +55,6 @@ class GalleryView_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: view, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class LazyImageExtensions_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_imageURL_nonEmpty() {
Expand All @@ -29,7 +29,7 @@ final class LazyImageExtensions_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: snapshotPrecision))
}

func test_imageRequest_emptyURL() {
Expand All @@ -40,6 +40,6 @@ final class LazyImageExtensions_Tests: StreamChatTestCase {
.applyDefaultSize()

// Then
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: 0.98))
assertSnapshot(matching: lazyImageView, as: .image(perceptualPrecision: snapshotPrecision))
}
}
Loading