Upgrade to Pro — share decks privately, control downloads, hide ads and more …

みんな使おう! AWS Device Farm

Sato Takeshi
February 23, 2017

みんな使おう! AWS Device Farm

GEEK GARAGE iOS vol1
https://geekgarage.connpass.com/event/50929/
の資料です。

Sato Takeshi

February 23, 2017
Tweet

More Decks by Sato Takeshi

Other Decks in Technology

Transcript

  1. ๛෋ͳ୺຤छྨ&OSόʔδϣϯ • iPhone4s-iPhone7PlusͷiOS7.1͔ΒiOS10·Ͱ • iPad2/iPad miniୈҰੈ୅/iPad Pro • Android΋΄΅ओཁͳ୺຤ΛͦΖ͍͑ͯΔʢͨͩ͠άϩʔόϧ൛) •

    Android୺຤͸೔ຊ͸ΩϟϦΞ͕ΧελϚΠζ͍ͯ͠ΔͷͰ஫ ҙʂ https://aws.amazon.com/jp/device-farm/device-list/ ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 11
  2. AndroidͷςετϑϨʔϜϫʔΫ • Instrumentation • UI Automator • JUnit • Espresso

    • Robotium ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 18
  3. XCUIͰςετίʔυΛॻ͘ import XCTest class MAMORIOUITests: XCTestCase { override func setUp()

    { super.setUp() continueAfterFailure = false XCUIApplication().launch() } func test1Tutorial() {} } ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 24
  4. mkdir Payload mv [UITestName]-Runner.app Payload zip Payload.zip Payload mv Payload.zip

    Payload.ipa ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 29
  5. Device FarmʹΞϓϦͱςε τΛొ࿥࣮͠ߦ Create a new project ΛΫϦοΫ Create a

    new run ΛΫϦοΫ ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 30
  6. XCUIͷઆ໌ • XCUIApplicationͰΞϓϦऔಘͯ͠ • XCUIElementQueryͰUI෦඼Λݕࡧ ͯ͠ • XCUIElementͰλοϓͳͲUIૢ࡞Λ ͢Δ let

    app = XCUIApplication() app.buttons["startButton"].tap() ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 39
  7. ίʔυ͸ͪ͜Β let title : UILabel = UILabel.init(frame:CGRect(x:0 ,y:0, width:100, height:90))

    title.isAccessibilityElement = true title.accessibilityIdentifier = "logoutLabel" ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 41
  8. γεςϜΞϥʔτͷλοϓํ ๏(ϓογϡ௨஌ڐՄɺϩέʔ γϣϯڐՄ) ͜Ε͸ͩΊ let app = XCUIApplication() let notifiAlert

    = app.alerts["“MAMORIO”͸௨஌Λૹ৴͠·͢ɻΑΖ͍͠Ͱ͔͢?"] let comfirmButton = notifiAlert.buttons["ڐՄ"] if comfirmButton.exists { comfirmButton.tap() } ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 43
  9. addUIInterruptionMonitor ϝιουΛ࣮ߦ͢Δඞཁ͕͋Δ //͜Ε͕ඞཁ addUIInterruptionMonitor(withDescription: "notificationAlert", handler: { alert in if

    alert.buttons["ڐՄ"].exists { alert.buttons["ڐՄ"].tap() return true } if alert.buttons["Allow"].exists { alert.buttons["Allow"].tap() return true } return false }) app.tap() ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 44
  10. webαΠτͷදࣔ UIApplicationͷopenͰSafariΞϓϦΛ։͘ͱ໭Εͳ͍ɻ func linkURL(string :String) { if let url =

    URL(string:string) { if #available(iOS 10.0, *) { UIApplication.shared.open(url) } else { UIApplication.shared.openURL(url) } } } ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 45
  11. WebViewͰදࣔ͠Α͏ɻ if let url = URL(string:string) { if let rootViewController

    = self.keyWindow?.rootViewController { let safariViewController = SFSafariViewController.init(url: url) rootViewController.present(safariViewController, animated: true, completion: nil) } } ΈΜͳ࢖͓͏ʂ AWS Device Farm 2017/2/23 46