Swiftpack.co - TazkiyaTech/XCTestExtensions as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
TazkiyaTech/XCTestExtensions
Swift package containing extension functions for the XCTest framework.
.package(url: "https://github.com/TazkiyaTech/XCTestExtensions.git", from: "1.0.0")

XCTestExtensions

Swift package containing extension functions for the XCTest framework.

Summary

This Swift package contains the following extension functions:

  • XCUIElementAttributes.assertLabel(contains:) – Asserts that the receiving element's label property contains the given String value. This is a nicer alternative to writing XCTAssertTrue(myElement.label.contains(expectedLabel)). Instead, you can write myElement.assertLabel(contains: expectedLabel).
  • XCUIElementAttributes.assertLabel(equals:) – Asserts that the receiving element's label property equals the given String value. This is a nicer alternative to writing XCTAssertEqual(myElement.label, expectedLabel). Instead, you can write myElement.assertLabel(equals: expectedLabel).
  • XCUIElement.assertExistence() – Asserts that the receiving element's exists property is true. This is a nicer alternative to writing XCTAssertTrue(myElement.exists). Instead, you can write myElement.assertExistence().
  • XCUIElement.assertExistence(timeout:) – Asserts that the receiving element's exists property is true. This is a nicer alternative to writing XCTAssertTrue(myElement.waitForExistence(timeout: 1)). Instead, you can write myElement.assertExistence(timeout: 1).
  • XCUIElement.assertNonExistence() – Asserts that the receiving element's exists property is false. This is a nicer alternative to writing XCTAssertFalse(myElement.exists). Instead, you can write myElement.assertNonExistence().
  • XCUIElement.assertNonExistence(timeout:) – Asserts that the receiving element's exists property is false. This is a nicer alternative to writing XCTAssertTrue(myElement.waitForNonExistence(timeout: 1)). Instead, you can write myElement.assertNonExistence(timeout: 1).
  • XCUIElementQuery.assertCount(equals:) – Asserts that the receiving element's count property equals the given value. This is a nicer alternative to writing XCTAssertEqual(myElementQuery.count, 1). Instead, you can write myElementQuery.assertCount(1).
  • XCUIScreenshotProviding.saveScreenshot(to:named:) – Saves a screenshot of the receiving element's current visual state to the given XCTActivity instance. So, in your test methods, you can simply write myElement.saveScreenshot(to: self, named: "my_screenshot").

Installation

  1. Add this Swift package to your Xcode project's list of Swift packages by means of this repo's URL.
  2. Select the testing target(s) that you would like to add this Swift package to.

GitHub

link
Stars: 0
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics