Skip to content

YamamotoDesu/UITestingSwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image

import XCTest

final class UITestingSwiftUIUITests: XCTestCase {

    var app: XCUIApplication!

    override func setUpWithError() throws {
         continueAfterFailure = false
         app = XCUIApplication()
         app.launch()
     }

     func testAddTask() throws {
         let addTaskTab = app.tabBars.buttons["Add Task"]
         addTaskTab.tap()

         let textField = app.textFields["Enter task"]
         textField.tap()
         textField.typeText("New Task")

         // Dismiss the keyboard
         app.buttons["Return"].tap()

         let addTaskButton = app.buttons["AddTaskButton"]
         addTaskButton.tap()

         app.tabBars.buttons["Tasks"].tap()

         XCTAssertTrue(app.staticTexts["New Task"].exists)
     }
}

Releases

No releases published

Packages

No packages published

Languages