Skip to content

Instantly share code, notes, and snippets.

View tranhieutt's full-sized avatar

Tran Trung Hieu tranhieutt

View GitHub Profile
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:04
waitForExistence
let textField = app.textFields[""input user name textField.tap()
textField.typeText("abc")
app.buttons["start"].tap()
let querry = app.otherElements["identifier_any_uicontroll"]
if querry.waitForExistence(timeout: timeOut)
{
//do something else
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:02
pickerWheels
app.pickerWheels.element(boundBy: 0).adjust(toPickerWheelValue: "17")
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:01
testMoveToOtherScreen
func testMoveToOtherScreen() {
_ = tapOnButtonInCell(atPosition: 0)
XCTAssert(app.navigationBars["Other Screen:"].exists)
}
func tapOnButtonInCell(atPosition: Int) -> XCUIElement {
let cellQuerry = app.tables.cells.element(boundBy: atPosition)
cellQuerry.buttons["buttonOther"].tap()
return cellQuerry
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 07:00
testMoveToFlowerSrceen
func testMoveToFlowerSrceen() {
app.tables.cells.staticTexts["Flower"].tap()
XCTAssert(app.navigationBars["Flower Screen"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:59
testMoveHomeScreen
func testMoveHomeScreen() {
app.buttons[startTest].tap()
XCTAssert(app.navigationBars["HomeScreen"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:57
testLoginWithPasswordAndUserName
func testLoginWithPasswordAndUserName() {
let textField = app.textFields["input user name"]
textField.tap()
textField.typeText("user name")
let secureTextFields = app.secureTextFields[inputPassword]
secureTextFields.tap() secureTextFields.typeText("pass123")
app.buttons["login"].tap()
XCTAssert(app.buttons["startTest"].isEnabled)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:56
testLoginWithEmptyUserNameAndPassword
func testLoginWithEmptyUserNameAndPassword() {
let secureTextFields = app.secureTextFields["input password"]
secureTextFields.tap() secureTextFields.typeText("pass123")
app.buttons["login"].tap()
XCTAssert(app.alerts.element.staticTexts["pass is correct"].exists)
}
@tranhieutt
tranhieutt / .swift
Created May 10, 2018 06:54
testRegisterWithUserName
func testRegisterWithUserName() {
let textField = app.textFields["input user name"]
textField.tap()
textField.typeText("user name")
app.buttons[register].tap()
XCTAssert(app.alerts.element.staticTexts["user is correct"].exists)
}
@tranhieutt
tranhieutt / Swift_CG_UIBezierPath.swift
Created July 22, 2017 11:38
Swift_CG_UIBezierPath
override func draw(_ rect: CGRect) {
// Add ARCs
self.addCirle(innerCircleRadius, capRadius: 20, color: self.firstColor)
self.addCirle(middleCircleRadius, capRadius: 20, color: self.secondColor)
self.addCirle(outerCircleRadius, capRadius: 20, color: self.thirdColor)
}
func addCirle(_ arcRadius: CGFloat, capRadius: CGFloat, color: UIColor) {
let X = self.bounds.midX
let Y = self.bounds.midY
@tranhieutt
tranhieutt / swift_override_init_customview.swift
Created July 22, 2017 11:35
Swift_override_init_customView
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
override init(frame: CGRect) {
super.init(frame: frame)
}
...
}