VLCiOSTestVideoCodecs.swift 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*****************************************************************************
  2. * VLCiOSTestVideoCodecs.swift
  3. * VLC for iOSUITests
  4. *****************************************************************************
  5. * Copyright (c) 2018 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Mike JS. Choi <mkchoi212 # icloud.com>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. import Foundation
  13. import XCTest
  14. class VLCiOSTestVideoCodecs: XCTestCase {
  15. let app = XCUIApplication()
  16. var helper: TestHelper!
  17. override func setUp() {
  18. super.setUp()
  19. XCUIDevice.shared.orientation = .portrait
  20. setupSnapshot(app)
  21. helper = TestHelper(app)
  22. setupSnapshot(app)
  23. app.launch()
  24. }
  25. func testMovCodec() {
  26. stream(named: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov")
  27. }
  28. func testHEVCCodec10b() {
  29. stream(named: "http://jell.yfish.us/media/jellyfish-90-mbps-hd-hevc-10bit.mkv")
  30. }
  31. func testHEVCCodec() {
  32. stream(named: "http://jell.yfish.us/media/jellyfish-25-mbps-hd-hevc.mkv")
  33. }
  34. func testH264Codec() {
  35. stream(named: "http://jell.yfish.us/media/jellyfish-25-mbps-hd-h264.mkv")
  36. }
  37. func stream(named fileName: String) {
  38. helper.tapTabBarItem(VLCAccessibilityIdentifier.localNetwork)
  39. app.cells[VLCAccessibilityIdentifier.stream].tap()
  40. let addressTextField = app.textFields["http://myserver.com/file.mkv"]
  41. addressTextField.clearAndEnter(text: fileName)
  42. app.buttons["Open Network Stream"].tap()
  43. let displayTime = app.navigationBars["VLCMovieView"].buttons["--:--"]
  44. let zeroPredicate = NSPredicate(format: "exists == 0")
  45. expectation(for: zeroPredicate, evaluatedWith: displayTime, handler: nil)
  46. waitForExpectations(timeout: 20.0) { err in
  47. XCTAssertNil(err)
  48. if !(self.app.buttons["Done"].exists) {
  49. self.app.otherElements["Video Player Title"].tap()
  50. }
  51. let playPause = self.app.buttons[VLCAccessibilityIdentifier.playPause]
  52. let onePredicate = NSPredicate(format: "exists == 1")
  53. self.expectation(for: onePredicate, evaluatedWith: playPause, handler: nil)
  54. self.waitForExpectations(timeout: 20.0, handler: nil)
  55. }
  56. }
  57. }