|
| 1 | +// |
| 2 | +// SnapShotTests.swift |
| 3 | +// UITests |
| 4 | +// |
| 5 | +// Created by Jiwoong CHOI on 9/14/24. |
| 6 | +// |
| 7 | + |
| 8 | +import XCTest |
| 9 | + |
| 10 | +final class SnapShotTests: XCTestCase { |
| 11 | + var app: XCUIApplication! |
| 12 | + |
| 13 | + @MainActor |
| 14 | + override func setUpWithError() throws { |
| 15 | + continueAfterFailure = false |
| 16 | + app = XCUIApplication() |
| 17 | + setupSnapshot(app) // fastlane snapshot 초기화 |
| 18 | + app.launch() |
| 19 | + } |
| 20 | + |
| 21 | + override func tearDownWithError() throws {} |
| 22 | + |
| 23 | + /// 탭바의 각 화면에서 스크린샷을 촬영하는 테스트 예시입니다. |
| 24 | + /// 로그인이 되어있어야하고, 학과 역시 입력되어 있어야 합니다. |
| 25 | + @MainActor |
| 26 | + func testTabBarScreenshots() { |
| 27 | + // 1. "학식" 탭 선택 및 스크린샷 촬영 |
| 28 | + let mealButton = app.tabBars.buttons["학식"] |
| 29 | + mealButton.tap() |
| 30 | + let mealPredicate = NSPredicate(format: "isSelected == true") |
| 31 | + expectation(for: mealPredicate, evaluatedWith: mealButton, handler: nil) |
| 32 | + waitForExpectations(timeout: 5, handler: nil) |
| 33 | + snapshot("01_Restaurant") |
| 34 | + |
| 35 | + // 2. "지도" 탭 선택 및 스크린샷 촬영 |
| 36 | + let mapButton = app.tabBars.buttons["지도"] |
| 37 | + mapButton.tap() |
| 38 | + let mapPredicate = NSPredicate(format: "isSelected == true") |
| 39 | + expectation(for: mapPredicate, evaluatedWith: mapButton, handler: nil) |
| 40 | + waitForExpectations(timeout: 5, handler: nil) |
| 41 | + snapshot("02_Map") |
| 42 | + |
| 43 | + // 3. "마이" 탭 선택 및 스크린샷 촬영 |
| 44 | + let myButton = app.tabBars.buttons["마이"] |
| 45 | + myButton.tap() |
| 46 | + let myPredicate = NSPredicate(format: "isSelected == true") |
| 47 | + expectation(for: myPredicate, evaluatedWith: myButton, handler: nil) |
| 48 | + waitForExpectations(timeout: 5, handler: nil) |
| 49 | + snapshot("03_MyPage") |
| 50 | + } |
| 51 | +} |
0 commit comments