From ebb1901d007edc8c6a558153c2bf6120189ed023 Mon Sep 17 00:00:00 2001 From: Flavio Alescio Date: Thu, 11 May 2023 12:26:53 +0200 Subject: [PATCH] add screenshots for UI test --- .../Other/AccessibilityIdentifiers.swift | 6 ++++++ .../CreateRoom/View/CreateRoomScreen.swift | 4 ++-- UITests/Sources/CreateRoomScreenUITests.swift | 19 +++++++++++++++++++ ...en-GB-iPad-9th-generation.createRoom-0.png | 3 +++ ...en-GB-iPad-9th-generation.createRoom-1.png | 3 +++ ...en-GB-iPad-9th-generation.createRoom-2.png | 3 +++ ...en-GB-iPad-9th-generation.createRoom-3.png | 3 +++ .../en-GB-iPhone-14.createRoom-0.png | 3 +++ .../en-GB-iPhone-14.createRoom-1.png | 3 +++ .../en-GB-iPhone-14.createRoom-2.png | 3 +++ .../en-GB-iPhone-14.createRoom-3.png | 3 +++ ...seudo-iPad-9th-generation.createRoom-0.png | 3 +++ ...seudo-iPad-9th-generation.createRoom-1.png | 3 +++ ...seudo-iPad-9th-generation.createRoom-2.png | 3 +++ ...seudo-iPad-9th-generation.createRoom-3.png | 3 +++ .../pseudo-iPhone-14.createRoom-0.png | 3 +++ .../pseudo-iPhone-14.createRoom-1.png | 3 +++ .../pseudo-iPhone-14.createRoom-2.png | 3 +++ .../pseudo-iPhone-14.createRoom-3.png | 3 +++ 19 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-0.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-1.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-2.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-3.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-0.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-1.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-2.png create mode 100644 UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-3.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-0.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-1.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-2.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-3.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-0.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-1.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-2.png create mode 100644 UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-3.png diff --git a/ElementX/Sources/Other/AccessibilityIdentifiers.swift b/ElementX/Sources/Other/AccessibilityIdentifiers.swift index ed9b49fc4..3331bbe49 100644 --- a/ElementX/Sources/Other/AccessibilityIdentifiers.swift +++ b/ElementX/Sources/Other/AccessibilityIdentifiers.swift @@ -30,6 +30,7 @@ struct A11yIdentifiers { static let softLogoutScreen = SoftLogoutScreen() static let startChatScreen = StartChatScreen() static let roomMemberDetailsScreen = RoomMemberDetailsScreen() + static let createRoomScreen = CreateRoomScreen() static let invitesScreen = InvitesScreen() struct AnalyticsPromptScreen { @@ -130,4 +131,9 @@ struct A11yIdentifiers { let inviteFriends = "start_chat-invite_friends" let searchNoResults = "start_chat-search_no_results" } + + struct CreateRoomScreen { + let roomName = "create-room-room-name" + let roomTopic = "create-room-room-topic" + } } diff --git a/ElementX/Sources/Screens/CreateRoom/View/CreateRoomScreen.swift b/ElementX/Sources/Screens/CreateRoom/View/CreateRoomScreen.swift index c17569fac..9a25d0687 100644 --- a/ElementX/Sources/Screens/CreateRoom/View/CreateRoomScreen.swift +++ b/ElementX/Sources/Screens/CreateRoom/View/CreateRoomScreen.swift @@ -39,10 +39,8 @@ struct CreateRoomScreen: View { roomSection topicSection if !context.viewState.selectedUsers.isEmpty { - // TODO: check clipping outside form selectedUsersSection } - // TODO: Spacer not working properly Spacer() .listRowBackground(Color.clear) securitySection @@ -67,6 +65,7 @@ struct CreateRoomScreen: View { text: $context.roomName, prompt: Text(L10n.screenCreateRoomRoomNamePlaceholder), axis: .horizontal) + .accessibilityIdentifier(A11yIdentifiers.createRoomScreen.roomName) .padding(EdgeInsets(top: 10, leading: 16, bottom: 10, trailing: 16)) .background(Color.element.formRowBackground) .clipShape(RoundedRectangle(cornerRadius: 8)) @@ -84,6 +83,7 @@ struct CreateRoomScreen: View { text: $context.roomTopic, prompt: Text(L10n.screenCreateRoomTopicPlaceholder), axis: .vertical) + .accessibilityIdentifier(A11yIdentifiers.createRoomScreen.roomTopic) .lineLimit(3, reservesSpace: false) } header: { Text(L10n.screenCreateRoomTopicLabel) diff --git a/UITests/Sources/CreateRoomScreenUITests.swift b/UITests/Sources/CreateRoomScreenUITests.swift index 49588e393..dfb9fe97c 100644 --- a/UITests/Sources/CreateRoomScreenUITests.swift +++ b/UITests/Sources/CreateRoomScreenUITests.swift @@ -27,4 +27,23 @@ class CreateRoomScreenUITests: XCTestCase { let app = Application.launch(.createRoomNoUsers) app.assertScreenshot(.createRoom, step: 1) } + + func testLongInputNameText() { + let app = Application.launch(.createRoom) + let roomName: String + if UIDevice.current.userInterfaceIdiom == .pad { + roomName = "Room name very very very very very very very very very very very very very very very very long" + } else { + roomName = "Room name very very very very long" + } + app.textFields[A11yIdentifiers.createRoomScreen.roomName].clearAndTypeText(roomName) + app.assertScreenshot(.createRoom, step: 2) + } + + func testLongInputTopicText() { + let app = Application.launch(.createRoom) + let roomTopic = "Room topic\nvery\nvery\nvery long" + app.textViews[A11yIdentifiers.createRoomScreen.roomTopic].clearAndTypeText(roomTopic) + app.assertScreenshot(.createRoom, step: 3) + } } diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-0.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-0.png new file mode 100644 index 000000000..f2beab479 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ce58d664380c881e9f793d01897229f4f9afce1b6d6e2614274c780e4105606 +size 140709 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-1.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-1.png new file mode 100644 index 000000000..de1c70293 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd40abfd78340148ab9640d9f57329381e177782364085eefe063782b76451a3 +size 117434 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-2.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-2.png new file mode 100644 index 000000000..22b8a176b --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:338157168cdf237955f64908627432319487871fd5e81824664a7f65293ce1bc +size 212991 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-3.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-3.png new file mode 100644 index 000000000..1098cd60d --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.createRoom-3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0197617ed76b9a17cde9d22323bbe374d78fbe9596e2c31928e2991482a7128a +size 212483 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-0.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-0.png new file mode 100644 index 000000000..0282faf37 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cdecb8eda71e1142725931aafed538e61b01ee571c2bac0fc64500cc5b64af4 +size 188211 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-1.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-1.png new file mode 100644 index 000000000..ebf131c15 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ced89105404a17c6cbd117ff64639d2a0ffe688a99d289e142d76c3ad031187 +size 157443 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-2.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-2.png new file mode 100644 index 000000000..744e70f55 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28f3f129db6a100cc7c24c1419ecdd319820d1b5b23dfcd942648fc51469152d +size 208353 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-3.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-3.png new file mode 100644 index 000000000..af32eaadb --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.createRoom-3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f29aefa3158b91801ab7291edc7ad824de57a016ed151358fb1a0a15b9e4840 +size 211860 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-0.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-0.png new file mode 100644 index 000000000..f880932b2 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d76422f5c7ca9259dd0af19766553c089a4af147277ba6d9b046daaed833021d +size 170045 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-1.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-1.png new file mode 100644 index 000000000..c74ee1a5a --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef2da36c0dc9db449d0e370df85e2794258c29fc4dea1c2b9b778fda171e61b7 +size 146542 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-2.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-2.png new file mode 100644 index 000000000..8ee617140 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:152202a96a2bd27fa7075b8b6daf87c8e1221ae5b49ff5bdac6f5bcde05e0ac5 +size 240605 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-3.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-3.png new file mode 100644 index 000000000..5a9608d4b --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.createRoom-3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:543af442458cb4292c3b0cd22a56cb7376d69776fdc80e0b0eefeb6b8ce867ea +size 240524 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-0.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-0.png new file mode 100644 index 000000000..811f7ab22 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:baf8dfb833a68eb3424121895619d6cdb62d3684784f4990f1d22397cab84f7e +size 236641 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-1.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-1.png new file mode 100644 index 000000000..9f6dfe6e8 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3076f5da83494b9c375bfa6a632806c475603cccd8408407f3020da00a645db3 +size 212717 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-2.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-2.png new file mode 100644 index 000000000..1910b4db7 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af0eec1935090fd30bcc49522e7f8c43502d975313ea3b45ccc3c335effd0f54 +size 222778 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-3.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-3.png new file mode 100644 index 000000000..e36388fa6 --- /dev/null +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.createRoom-3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8789a81c437710854ab852b937cdfaeca3d9852337f370a31c0235f587c0002e +size 223291