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

Performance tests #1301

Merged
merged 20 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5db9c4d
Add signposts to performance tests.
pixlwave Jul 3, 2023
880b77f
If the welcome screen shows, click on the button.
michaelkaye Jul 6, 2023
f106079
Ensure a clean simulator each run.
michaelkaye Jul 6, 2023
ee9e83b
Add accessibility identifier for migration screen if required.
michaelkaye Jul 7, 2023
5741087
Handle walking into the room and back out again.
michaelkaye Jul 7, 2023
61ae0b1
use iphone 14 pro to match what's used in xcode.
michaelkaye Jul 7, 2023
8670710
Remove ApplicationTests as duplicated in LoginTests.
michaelkaye Jul 7, 2023
53fe2ff
Sleep 10s, the ui is otherwise showing up in random order.
michaelkaye Jul 7, 2023
91fecb4
Revert "Remove ApplicationTests as duplicated in LoginTests."
michaelkaye Jul 7, 2023
d3dc4b1
Update script to parse out correct values from results file.
michaelkaye Jul 10, 2023
8a52b9b
Allow cancellation of password prompt in any order.
michaelkaye Jul 10, 2023
ca62a2f
Remove test timeout, performance tests will always take a while.
michaelkaye Jul 10, 2023
5c3fdee
Adjust parsing further
michaelkaye Jul 10, 2023
285e3b8
Remove ApplicationTests.
pixlwave Jul 10, 2023
8c4fe71
Move to a more elegant way to wait for something to disappear.
michaelkaye Jul 10, 2023
c7104e6
Linting.
michaelkaye Jul 10, 2023
93591f0
Merge branch 'develop' into doug/performance-tests
michaelkaye Jul 10, 2023
7d9647c
Fix unit tests.
pixlwave Jul 10, 2023
74fbb12
Merge branch 'develop' into doug/performance-tests
pixlwave Jul 11, 2023
7fd7816
Merge branch 'develop' into doug/performance-tests
pixlwave Jul 11, 2023
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
6 changes: 6 additions & 0 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
764AFCC225B044CF5F9B41E5 /* PaginationIndicatorRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42EEA67A6796BDC2761619C5 /* PaginationIndicatorRoomTimelineView.swift */; };
76BA28216FBAF83B2D86A027 /* InvitesScreenCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2A71915C1F075E403F559C /* InvitesScreenCell.swift */; };
7756C4E90CABE6F14F7920A0 /* BugReportUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FEA87EA3752203065ECE27 /* BugReportUITests.swift */; };
77920AFA8091AC6B9F190C90 /* Signposter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752A0EB49BF5BCEA37EDF7A3 /* Signposter.swift */; };
77D7DAA41AAB36800C1F2E2D /* RoomTimelineProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 095AED4CF56DFF3EB7BB84C8 /* RoomTimelineProviderProtocol.swift */; };
77FACC29F98FE2E65BBB6A5F /* ServerSelectionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054F469E433864CC6FE6EE8E /* ServerSelectionUITests.swift */; };
784592335560C2E91D32D177 /* DeveloperOptionsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B098A612DCB5A7358EECD5 /* DeveloperOptionsScreenModels.swift */; };
Expand Down Expand Up @@ -365,6 +366,7 @@
878070573C7BF19E735707B4 /* RoomTimelineItemProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DE8D25D6A91030175D52A20 /* RoomTimelineItemProperties.swift */; };
87CEDB8A0696F0D5AE2ABB28 /* test_audio.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D5E26C54362206BBDD096D83 /* test_audio.mp3 */; };
8810A2A30A68252EBB54EE05 /* HomeScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BC7CA1BC1041E93077BBA1 /* HomeScreenModels.swift */; };
88356DE7F2AD243AB10C7B7A /* Signposter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752A0EB49BF5BCEA37EDF7A3 /* Signposter.swift */; };
8868ACFA45E5B5E19514B575 /* LegalInformationScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACCC1874C122E2BBE648B8F5 /* LegalInformationScreenUITests.swift */; };
88F348E2CB14FF71CBBB665D /* AudioRoomTimelineItemContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7475C5AE20BA896930907EA8 /* AudioRoomTimelineItemContent.swift */; };
890F0D453FE388756479AC97 /* AnalyticsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C687844F60BFF532D49A994C /* AnalyticsTests.swift */; };
Expand Down Expand Up @@ -1096,6 +1098,7 @@
7475C5AE20BA896930907EA8 /* AudioRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRoomTimelineItemContent.swift; sourceTree = "<group>"; };
748AE77AC3B0A01223033B87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
74DD0855F2F76D47E5555082 /* MediaUploadPreviewScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenCoordinator.swift; sourceTree = "<group>"; };
752A0EB49BF5BCEA37EDF7A3 /* Signposter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Signposter.swift; sourceTree = "<group>"; };
75697AB5E64A12F1F069F511 /* EncryptedHistoryRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedHistoryRoomTimelineView.swift; sourceTree = "<group>"; };
75910F5A36EA8FF9BAD08D18 /* MigrationScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationScreenUITests.swift; sourceTree = "<group>"; };
772334731A8BF8E6D90B194D /* LocationRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationRoomTimelineView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2094,6 +2097,7 @@
5445FCE0CE15E634FDC1A2E2 /* AnalyticsService.swift */,
A6B891A6DA826E2461DBB40F /* PHGPostHogConfiguration.swift */,
1715E3D7F53C0748AA50C91C /* PostHogAnalyticsClient.swift */,
752A0EB49BF5BCEA37EDF7A3 /* Signposter.swift */,
3A304097A59704AC9B869EC6 /* Helpers */,
);
path = Analytics;
Expand Down Expand Up @@ -4439,6 +4443,7 @@
1C8BC70A18060677E295A846 /* ShareToMapsAppActivity.swift in Sources */,
8922219C5C934C4155E8CA50 /* SharedUserDefaultsKeys.swift in Sources */,
274CE3C986841D15FD530BF5 /* ShimmerModifier.swift in Sources */,
77920AFA8091AC6B9F190C90 /* Signposter.swift in Sources */,
8BC8EF6705A78946C1F22891 /* SoftLogoutScreen.swift in Sources */,
A3A7A05E8F9B7EB0E1A09A2A /* SoftLogoutScreenCoordinator.swift in Sources */,
F86102DC2C68BBBB0521BAAE /* SoftLogoutScreenModels.swift in Sources */,
Expand Down Expand Up @@ -4606,6 +4611,7 @@
23B2CD5A06B16055BDDD0994 /* ApplicationTests.swift in Sources */,
07240B7159A3990C4C2E8FFC /* LoginTests.swift in Sources */,
A439B456D0761D6541745CC3 /* NSRegularExpresion.swift in Sources */,
88356DE7F2AD243AB10C7B7A /* Signposter.swift in Sources */,
290FDB0FFDC2F1DDF660343E /* TestMeasurementParser.swift in Sources */,
B444F9C184A377C1B481F07F /* XCUIElement.swift in Sources */,
);
Expand Down
5 changes: 4 additions & 1 deletion ElementX/Sources/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
navigationSplitCoordinator: navigationSplitCoordinator,
bugReportService: ServiceLocator.shared.bugReportService,
roomTimelineControllerFactory: RoomTimelineControllerFactory(),
appSettings: ServiceLocator.shared.settings)
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics)

userSessionFlowCoordinator.callback = { [weak self] action in
switch action {
Expand Down Expand Up @@ -548,6 +549,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
}

private func startSync() {
ServiceLocator.shared.analytics.signpost.beginSync()
guard let userSession else {
fatalError("User session not setup")
}
Expand All @@ -572,6 +574,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
case .startedUpdating:
showLoadingIndicator()
case .receivedSyncUpdate:
ServiceLocator.shared.analytics.signpost.endSync()
ServiceLocator.shared.userIndicatorController.retractIndicatorWithId(identifier)
default:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
private let bugReportService: BugReportServiceProtocol
private let roomTimelineControllerFactory: RoomTimelineControllerFactoryProtocol
private let appSettings: AppSettings
private let analytics: AnalyticsService

private let stateMachine: UserSessionFlowCoordinatorStateMachine
private let roomFlowCoordinator: RoomFlowCoordinator
Expand All @@ -46,13 +47,15 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
navigationSplitCoordinator: NavigationSplitCoordinator,
bugReportService: BugReportServiceProtocol,
roomTimelineControllerFactory: RoomTimelineControllerFactoryProtocol,
appSettings: AppSettings) {
appSettings: AppSettings,
analytics: AnalyticsService) {
stateMachine = UserSessionFlowCoordinatorStateMachine()
self.userSession = userSession
self.navigationSplitCoordinator = navigationSplitCoordinator
self.bugReportService = bugReportService
self.roomTimelineControllerFactory = roomTimelineControllerFactory
self.appSettings = appSettings
self.analytics = analytics

sidebarNavigationStackCoordinator = NavigationStackCoordinator(navigationSplitCoordinator: navigationSplitCoordinator)
detailNavigationStackCoordinator = NavigationStackCoordinator(navigationSplitCoordinator: navigationSplitCoordinator)
Expand All @@ -64,18 +67,20 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
navigationStackCoordinator: detailNavigationStackCoordinator,
navigationSplitCoordinator: navigationSplitCoordinator,
emojiProvider: EmojiProvider(),
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
appSettings: appSettings,
analytics: analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)

setupStateMachine()

roomFlowCoordinator.actions.sink { action in
switch action {
case .presentedRoom(let roomID):
self.analytics.signpost.beginRoomFlow(roomID)
self.stateMachine.processEvent(.selectRoom(roomId: roomID))
case .dismissedRoom:
self.stateMachine.processEvent(.deselectRoom)
self.analytics.signpost.endRoomFlow()
}
}
.store(in: &cancellables)
Expand Down
16 changes: 14 additions & 2 deletions ElementX/Sources/Other/AccessibilityIdentifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ struct A11yIdentifiers {
static let roomMemberDetailsScreen = RoomMemberDetailsScreen()
static let createRoomScreen = CreateRoomScreen()
static let invitesScreen = InvitesScreen()

static let welcomeScreen = WelcomeScreen()
static let migrationScreen = MigrationScreen()

struct AnalyticsPromptScreen {
let title = "analytics_prompt-title"
let enable = "analytics_prompt-enable"
Expand All @@ -59,8 +61,10 @@ struct A11yIdentifiers {
let settings = "home_screen-settings"
let signOut = "home_screen-sign_out"
let verificationBannerContinue = "home_screen-verification_continue"

let roomNamePrefix = "home_screen-room_name"
func roomName(_ name: String) -> String {
"home_screen-room_name:\(name)"
"\(roomNamePrefix):\(name)"
}
}

Expand Down Expand Up @@ -142,4 +146,12 @@ struct A11yIdentifiers {
let roomName = "create_room-room_name"
let roomTopic = "create_room-room_topic"
}

struct WelcomeScreen {
let letsGo = "welcome_screen-lets_go"
}

struct MigrationScreen {
let message = "migration_screen-message"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct ShimmerOverlay_Previews: PreviewProvider {
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL),
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)

static var previews: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class AuthenticationCoordinator: CoordinatorProtocol {

private func showLoginScreen() {
let parameters = LoginScreenCoordinatorParameters(authenticationService: authenticationService,
analytics: analytics,
userIndicatorController: userIndicatorController)
let coordinator = LoginScreenCoordinator(parameters: parameters)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct LoginScreenCoordinatorParameters {
/// The service used to authenticate the user.
let authenticationService: AuthenticationServiceProxyProtocol

let analytics: AnalyticsService
let userIndicatorController: UserIndicatorControllerProtocol
}

Expand Down Expand Up @@ -119,15 +120,18 @@ final class LoginScreenCoordinator: CoordinatorProtocol {
startLoading(isInteractionBlocking: true)

Task {
parameters.analytics.signpost.beginLogin()
switch await authenticationService.login(username: username,
password: password,
initialDeviceName: UIDevice.current.initialDeviceName,
deviceID: nil) {
case .success(let userSession):
callback?(.signedIn(userSession))
parameters.analytics.signpost.endLogin()
stopLoading()
case .failure(let error):
stopLoading()
parameters.analytics.signpost.endLogin()
switch error {
case .isOnWaitlist:
callback?(.isOnWaitlist(.init(username: username,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
attributedStringBuilder: parameters.attributedStringBuilder,
selectedRoomPublisher: parameters.selectedRoomPublisher,
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)

viewModel.callback = { [weak self] action in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
private let userSession: UserSessionProtocol
private let attributedStringBuilder: AttributedStringBuilderProtocol
private let appSettings: AppSettings
private let analytics: AnalyticsService
private let userIndicatorController: UserIndicatorControllerProtocol

private let roomSummaryProvider: RoomSummaryProviderProtocol?
Expand All @@ -38,10 +39,12 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
attributedStringBuilder: AttributedStringBuilderProtocol,
selectedRoomPublisher: CurrentValuePublisher<String?, Never>,
appSettings: AppSettings,
analytics: AnalyticsService,
userIndicatorController: UserIndicatorControllerProtocol) {
self.userSession = userSession
self.attributedStringBuilder = attributedStringBuilder
self.appSettings = appSettings
self.analytics = analytics
self.userIndicatorController = userIndicatorController

roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
Expand Down Expand Up @@ -98,6 +101,11 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
return
}

// End the initial sync performance timing once the room list is about to be displayed.
if roomListMode == .rooms, self.state.roomListMode == .skeletons {
analytics.signpost.endSync()
}

self.state.roomListMode = roomListMode

MXLog.info("Received room summary provider update, setting view room list mode to \"\(self.state.roomListMode)\"")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ struct HomeScreen_Previews: PreviewProvider {
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL),
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)

return NavigationStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ struct HomeScreenRoomCell_Previews: PreviewProvider {
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL),
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
appSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics,
userIndicatorController: ServiceLocator.shared.userIndicatorController)

let rooms: [HomeScreenRoom] = summaryProvider.roomListPublisher.value.compactMap { summary -> HomeScreenRoom? in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct MigrationScreen: View {
.font(.compound.bodyLG)
.multilineTextAlignment(.center)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.migrationScreen.message)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct WelcomeScreen: View {
Text(context.viewState.buttonTitle)
}
.buttonStyle(.elementAction(.xLarge))
.accessibilityIdentifier(A11yIdentifiers.welcomeScreen.letsGo)
}
}

Expand Down
4 changes: 4 additions & 0 deletions ElementX/Sources/Services/Analytics/AnalyticsService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class AnalyticsService {
private let client: AnalyticsClientProtocol
private let appSettings: AppSettings
private let bugReportService: BugReportServiceProtocol

/// A signpost client for performance testing the app. This client doesn't respect the
/// `isRunning` state or behave any differently when `start`/`reset` are called.
let signpost = Signposter()

init(client: AnalyticsClientProtocol, appSettings: AppSettings, bugReportService: BugReportServiceProtocol) {
self.client = client
Expand Down
Loading
Loading