Files
GradientLoadingBar/Example/SnapshotTests/GradientLoadingBarController/GradientLoadingBarControllerTestCase.swift
T
2020-12-20 13:45:50 +01:00

50 lines
1.3 KiB
Swift

//
// GradientLoadingBarControllerTestCase.swift
// GradientLoadingBar_SnapshotTests
//
// Created by Felix Mau on 14.06.20.
// Copyright © 2020 CocoaPods. All rights reserved.
//
import XCTest
import SnapshotTesting
@testable import GradientLoadingBar
class GradientLoadingBarControllerTestCase: XCTestCase {
// MARK: - Private properties
private var gradientLoadingBarController: GradientLoadingBarController!
// MARK: - Public methods
override func setUpWithError() throws {
try super.setUpWithError()
gradientLoadingBarController = GradientLoadingBarController()
gradientLoadingBarController.fadeIn(duration: 0)
}
override func tearDownWithError() throws {
gradientLoadingBarController = nil
try super.tearDownWithError()
}
// MARK: - Tests
func testGradientLoadingBarController() {
// Given
let rootViewController = UIViewController()
let expectation = self.expectation(description: "Waiting for view to appear.")
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
expectation.fulfill()
}
// Then
wait(for: [expectation], timeout: 1)
assertSnapshot(matching: rootViewController, as: .windowedImage)
}
}