Navigation Menu

Skip to content

albinekcom/XCUIElement-IsVisible

Repository files navigation

XCUIElement+IsVisible

Swift 4.2.1 Build Status

This extension adds a computed property isVisible to XCUIElement. It is useful in UI Testing for checking if a specified element is visible on the screen.

Installation

CocoaPods

Add the following line to the target UITests in your Podfile:

pod 'XCUIElement+IsVisible'

Swift Package Manager

Add the following line to dependencies in your Package.swift file:

.package(url: "https://github.com/albinekcom/XCUIElement-IsVisible.git", from: "0.0.1")

Manually

Add XCUIElement+IsVisible.swift file from Sources directory into your project.

Usage

  1. Add import statement in your class which inherits from XCTestCase (not needed if you install it manually):
import XCUIElement_IsVisible
  1. Receive desired XCUIElement in your test method and use its isVisible computed property:
func testExample() {
    let element = // (...)

    XCTAssertTrue(element.isVisible)
}

Check out Example project in Example directory.

About

It adds "isVisible" computed property to XCUIElement

Resources

License

Stars

Watchers

Forks

Packages

No packages published