|
| 1 | +// |
| 2 | +// LiveEventAppUITests.swift |
| 3 | +// |
| 4 | +// PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks |
| 5 | +// Copyright © 2021 PubNub Inc. |
| 6 | +// https://www.pubnub.com/ |
| 7 | +// https://www.pubnub.com/terms |
| 8 | +// |
| 9 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 10 | +// of this software and associated documentation files (the "Software"), to deal |
| 11 | +// in the Software without restriction, including without limitation the rights |
| 12 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 13 | +// copies of the Software, and to permit persons to whom the Software is |
| 14 | +// furnished to do so, subject to the following conditions: |
| 15 | +// |
| 16 | +// The above copyright notice and this permission notice shall be included in |
| 17 | +// all copies or substantial portions of the Software. |
| 18 | +// |
| 19 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 22 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 24 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 25 | +// THE SOFTWARE. |
| 26 | +// |
| 27 | + |
| 28 | +import XCTest |
| 29 | + |
| 30 | +final class LiveEventAppUITests: XCTestCase { |
| 31 | + |
| 32 | + override func setUpWithError() throws { |
| 33 | + // Put setup code here. This method is called before the invocation of each test method in the class. |
| 34 | + // In UI tests it is usually best to stop immediately when a failure occurs. |
| 35 | + continueAfterFailure = false |
| 36 | + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. |
| 37 | + // The setUp method is a good place to do this. |
| 38 | + } |
| 39 | + |
| 40 | + override func tearDownWithError() throws { |
| 41 | + // Put teardown code here. This method is called after the invocation of each test method in the class. |
| 42 | + } |
| 43 | + |
| 44 | + func testExample() throws { |
| 45 | + // UI tests must launch the application that they test. |
| 46 | + let app = XCUIApplication() |
| 47 | + // Launches the application synchronously |
| 48 | + app.launchArguments = ["1", "2", "3"] |
| 49 | + app.launch() |
| 50 | + |
| 51 | + let lastMessagePredicate = NSPredicate(format: "label == '[99] Lorem ipsum dolor sit amet'") |
| 52 | + let messageList = app.collectionViews.firstMatch |
| 53 | + let lastMessageCell = messageList.cells.containing(lastMessagePredicate).firstMatch |
| 54 | + let result = lastMessageCell.waitForExistence(timeout: 30) |
| 55 | + |
| 56 | + XCTAssertTrue(result) |
| 57 | + } |
| 58 | + |
| 59 | + func testPerformane() throws { |
| 60 | + measure { |
| 61 | + try? LiveEventAppUITests().testExample() |
| 62 | + } |
| 63 | + } |
| 64 | +} |
0 commit comments