Skip to content

Instantly share code, notes, and snippets.

@mpahuja
Created September 24, 2019 06:33
Show Gist options
  • Save mpahuja/b99ba78cb0e25af1f9581d7dfa96d4a4 to your computer and use it in GitHub Desktop.
Save mpahuja/b99ba78cb0e25af1f9581d7dfa96d4a4 to your computer and use it in GitHub Desktop.
UITests - TableViewTests.swift
import XCTest
class TableViewTests: BaseTest {
func testRowAlert() {
XCTContext.runActivity(named: "Test Correct row alert is being shown on random row") { _ in
XCTAssertTrue(tableViewPage.isRandomTableDisplayed())
let countOfRows = tableViewPage.countTableRows()
XCTAssertGreaterThan(countOfRows, 0)
let randomRowElement = Int.random(in: 1 ... countOfRows)
let currentRowValue = tableViewPage.getValueAtDesiredRow(desiredIndex: randomRowElement)
print(currentRowValue)
tableViewPage.tapDesiredRow(desiredIndex: randomRowElement)
// XCTAssertTrue(tableViewPage.isCorrectAlertDisplayed(rowTitle: currentRowValue))
XCTAssertTrue(tableViewPage.tapOkOnAlert())
}
XCTContext.runActivity(named: "Test Correct row alert is being shown on first row") { _ in
// Not implemented
// Purpose is to make test deterministic and make sure a (first) row is rendered and shows the alert
}
XCTContext.runActivity(named: "Test Correct row alert is being shown on last row when we have 20 rows") { _ in
// Not implemented
// Purpose is to make test deterministic and make sure a after scrolling a row is rendered and shows the alert
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment