BaseUIXCTestCase.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // BaseUIXCTestCase.swift
  3. // NextcloudUITests
  4. //
  5. // Created by Milen on 20.06.23.
  6. // Copyright © 2023 Marino Faggiana. All rights reserved.
  7. //
  8. // This program is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. import XCTest
  22. class BaseUIXCTestCase: BaseXCTestCase {
  23. override final class var runsForEachTargetApplicationUIConfiguration: Bool {
  24. false
  25. }
  26. internal func waitForEnabled(object: Any?) {
  27. let predicate = NSPredicate(format: "enabled == true")
  28. expectation(for: predicate, evaluatedWith: object, handler: nil)
  29. waitForExpectations(timeout: TestConstants.timeoutLong, handler: nil)
  30. }
  31. internal func waitForHittable(object: Any?) {
  32. let predicate = NSPredicate(format: "hittable == true")
  33. expectation(for: predicate, evaluatedWith: object, handler: nil)
  34. waitForExpectations(timeout: TestConstants.timeoutLong, handler: nil)
  35. }
  36. internal func waitForEnabledAndHittable(object: Any?) {
  37. waitForEnabled(object: object)
  38. waitForHittable(object: object)
  39. }
  40. }