func testTrackEventWithOneProps()

in Sasquatch/SasquatchUITests/AnalyticsUITests.swift [118:152]


  func testTrackEventWithOneProps() {
    guard let `app` = app else {
      XCTFail()
      return
    }

    // Go to analytics page.
    app.tabBars.buttons["Analytics"].tap()

    // Make sure the module is enabled.
    let analyticsButton = app.tables["Analytics"].switches["Set Enabled"]
    if (!analyticsButton.boolValue) {
      analyticsButton.tap()
    }

    // Track event with one property.
    self.trackEvent(name: "myEvent", propertiesCount: 1)

    // Go to result page.
    #if ACTIVE_COMPILATION_CONDITION_PUPPET
    app.tables["Analytics"].staticTexts["Results"].tap()
    
    let resultsTable = app.tables["Analytics Result"]
    let nameExp = expectation(for: NSPredicate(format: "label = 'myEvent'"),
                              evaluatedWith: resultsTable.cells.element(boundBy: 3).staticTexts.element(boundBy: 1),
                              handler: nil)
    let propsCountExp = expectation(for: NSPredicate(format: "label = '1'"),
                                    evaluatedWith: resultsTable.cells.element(boundBy: 5).staticTexts.element(boundBy: 1),
                                    handler: nil)
    let statusExp = expectation(for: NSPredicate(format: "label = 'Succeeded'"),
                                evaluatedWith: resultsTable.cells.element(boundBy: 6).staticTexts.element(boundBy: 1),
                                handler: nil)
    wait(for: [nameExp, propsCountExp, statusExp], timeout: timeout)
    #endif
  }