Screenshot.swift 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*****************************************************************************
  2. * Screenshot.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 Screenshot: XCTestCase {
  15. let app = XCUIApplication()
  16. var helper: TestHelper!
  17. override func setUp() {
  18. super.setUp()
  19. XCUIDevice.shared.orientation = .portrait
  20. SDStatusBarManager.sharedInstance().enableOverrides()
  21. setupSnapshot(app)
  22. helper = TestHelper(lang: deviceLanguage, target: VLCiOSTestMenu.self)
  23. app.launch()
  24. }
  25. override func tearDown() {
  26. SDStatusBarManager.sharedInstance().disableOverrides()
  27. }
  28. func testCaptureVideoPlayback() {
  29. download(name: "http://jell.yfish.us/media/jellyfish-10-mbps-hd-h264.mkv")
  30. helper.tap(tabDescription: "Video", app: app)
  31. app.collectionViews.cells.element(boundBy: 0).tap()
  32. app.navigationBars["VLCMovieView"].buttons[helper.localized(key: "VIDEO_ASPECT_RATIO_BUTTON")].tap()
  33. snapshot("playback")
  34. }
  35. func testCaptureAudioTab() {
  36. let audio = helper.localized(key: "AUDIO")
  37. helper.tap(tabDescription: audio, app: app)
  38. snapshot("audio_tab")
  39. }
  40. func testCaptureNetworkTab() {
  41. let localNetwork = helper.localized(key: "LOCAL_NETWORK")
  42. helper.tap(tabDescription: localNetwork, app: app)
  43. snapshot("network_tab")
  44. }
  45. func testCaptureVideoTab() {
  46. helper.tap(tabDescription: "Video", app: app)
  47. snapshot("video_tab")
  48. }
  49. func download(name fileName: String) {
  50. let download = helper.localized(key: "DOWNLOAD_FROM_HTTP")
  51. helper.tap(tabDescription: download, app: app)
  52. let downloadTextfield = app.textFields["http://myserver.com/file.mkv"]
  53. downloadTextfield.clearAndEnter(text: fileName)
  54. app.buttons[helper.localized(key: "BUTTON_DOWNLOAD")].tap()
  55. let cancelDownloadButton = app.buttons["flatDeleteButton"]
  56. let predicate = NSPredicate(format: "exists == 0")
  57. expectation(for: predicate, evaluatedWith: cancelDownloadButton, handler: nil)
  58. waitForExpectations(timeout: 20.0) { err in
  59. XCTAssertNil(err)
  60. downloadTextfield.typeText("\n")
  61. }
  62. }
  63. }