From bc698c14b2029f840f794450393fe52241f07fe2 Mon Sep 17 00:00:00 2001 From: Aleksandrs Proskurins Date: Tue, 20 Sep 2022 09:43:14 +0300 Subject: [PATCH] UI tests --- .../Modules/Common/Mock/MockAppScreens.swift | 1 + .../UI/UserSessionDetailsViewUITests.swift | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 RiotSwiftUI/Modules/UserSessions/UserSession/DetailsView/Test/UI/UserSessionDetailsViewUITests.swift diff --git a/RiotSwiftUI/Modules/Common/Mock/MockAppScreens.swift b/RiotSwiftUI/Modules/Common/Mock/MockAppScreens.swift index e52ac8e29..a87521164 100644 --- a/RiotSwiftUI/Modules/Common/Mock/MockAppScreens.swift +++ b/RiotSwiftUI/Modules/Common/Mock/MockAppScreens.swift @@ -20,6 +20,7 @@ import Foundation enum MockAppScreens { static let appScreens: [MockScreenState.Type] = [ MockUserSessionsOverviewScreenState.self, + MockUserSessionDetailsScreenState.self, MockLiveLocationLabPromotionScreenState.self, MockLiveLocationSharingViewerScreenState.self, MockAuthenticationLoginScreenState.self, diff --git a/RiotSwiftUI/Modules/UserSessions/UserSession/DetailsView/Test/UI/UserSessionDetailsViewUITests.swift b/RiotSwiftUI/Modules/UserSessions/UserSession/DetailsView/Test/UI/UserSessionDetailsViewUITests.swift new file mode 100644 index 000000000..4b59088e1 --- /dev/null +++ b/RiotSwiftUI/Modules/UserSessions/UserSession/DetailsView/Test/UI/UserSessionDetailsViewUITests.swift @@ -0,0 +1,36 @@ +// +// Copyright 2022 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import XCTest +import RiotSwiftUI + +class UserSessionDetailsViewUITests: MockScreenTestCase { + + func test_longPressOnDetailsCell_CopyValueToClipboard() throws { + app.goToScreenWithIdentifier(MockUserSessionDetailsScreenState.allSections.title) + + UIPasteboard.general.string = "" + + let tables = app.tables + let sessionNameIosCell = tables.cells["Session name, iOS"] + sessionNameIosCell.press(forDuration: 0.5) + + app.buttons["Copy"].tap() + + let clipboard = try XCTUnwrap(UIPasteboard.general.string) + XCTAssertEqual(clipboard,"iOS") + } +}