func testTrackEventWithDisabledAnalytics()

in Sasquatch/SasquatchUITests/AnalyticsUITests.swift [190:224]


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

    // Go to analytics page.
    app.tabBars.buttons["Analytics"].tap()
    
    // Disable service.
    let analyticsButton = app.tables["Analytics"].switches["Set Enabled"]
    if (analyticsButton.boolValue) {
      analyticsButton.tap()
    }

    // Track event.
    self.trackEvent(name: "myEvent", propertiesCount: 0)

    // 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 = ' '"),
                              evaluatedWith: resultsTable.cells.element(boundBy: 3).staticTexts.element(boundBy: 1),
                              handler: nil)
    let propsCountExp = expectation(for: NSPredicate(format: "label = '0'"),
                                    evaluatedWith: resultsTable.cells.element(boundBy: 5).staticTexts.element(boundBy: 1),
                                    handler: nil)
    let statusExp = expectation(for: NSPredicate(format: "label = ' '"),
                                evaluatedWith: resultsTable.cells.element(boundBy: 6).staticTexts.element(boundBy: 1),
                                handler: nil)
    wait(for: [nameExp, propsCountExp, statusExp], timeout: timeout)
    #endif
  }