From 94ffe31a4a0a602fb65ef1fc034fb2892a3a5b1c Mon Sep 17 00:00:00 2001 From: kenji Date: Tue, 8 Oct 2019 11:13:22 +0200 Subject: [PATCH] Fix ios13 issue and improve screenshot taking --- CHANGELOG.md | 12 +++++++++++- Cartfile | 2 +- Cartfile.resolved | 2 +- Carthage/Checkouts/SimulatorStatusMagic | 2 +- STKTestAppTests/STKSoloTests.swift | 2 +- SwiftiumTestingKit.xcodeproj/project.pbxproj | 8 ++++---- SwiftiumTestingKit/XCTestCaseExtension.swift | 11 ++++++++++- tag-release.sh | 1 + 8 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d6e1d5..d8e4ad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,17 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Removed -## [0.3.0](https://github.com/openium/SwiftiumTestingKit/compare/v0.3.0...HEAD) +## [0.3.0](https://github.com/openium/SwiftiumTestingKit/compare/v0.3.0...v0.4.0) +### Added +Attach screenshot using XCUIScreen.main.screenshot() and a name + +### Changed +Update SimulatorStatusMagic to ios13 branch + +### Removed + + +## [0.3.0](https://github.com/openium/SwiftiumTestingKit/compare/v0.3.0...v0.4.0) ### Added Support for Swift 5.1 diff --git a/Cartfile b/Cartfile index 71bd33f..111628e 100644 --- a/Cartfile +++ b/Cartfile @@ -1,3 +1,3 @@ github "kif-framework/KIF" ~> 3.7 -github "shinydevelopment/SimulatorStatusMagic" ~> 2.2 +github "shinydevelopment/SimulatorStatusMagic" "ios13" github "AliSoftware/OHHTTPStubs" ~> 7.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 7ed9c3d..430f482 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ github "AliSoftware/OHHTTPStubs" "7.0.0" github "kif-framework/KIF" "v3.7.8" -github "shinydevelopment/SimulatorStatusMagic" "2.4.1" +github "shinydevelopment/SimulatorStatusMagic" "82529f682e0b988d3c115b9e98e9ff77f3215798" diff --git a/Carthage/Checkouts/SimulatorStatusMagic b/Carthage/Checkouts/SimulatorStatusMagic index c96f49c..82529f6 160000 --- a/Carthage/Checkouts/SimulatorStatusMagic +++ b/Carthage/Checkouts/SimulatorStatusMagic @@ -1 +1 @@ -Subproject commit c96f49c3d1fc037e5d7fed3b58b9399488e6a571 +Subproject commit 82529f682e0b988d3c115b9e98e9ff77f3215798 diff --git a/STKTestAppTests/STKSoloTests.swift b/STKTestAppTests/STKSoloTests.swift index f42cc9a..d700791 100644 --- a/STKTestAppTests/STKSoloTests.swift +++ b/STKTestAppTests/STKSoloTests.swift @@ -182,7 +182,7 @@ class STKSoloTests: XCTestCase { let alertOKAction = UIAlertAction(title: "OK", style: .default, handler: nil) alertVC.addAction(alertOKAction) viewController.present(alertVC, animated: false, completion: nil) - + attachScreenshot(name: "test") // When let waitForOK = sut.waitFor(tappableText: "OK", andTapIt: true) diff --git a/SwiftiumTestingKit.xcodeproj/project.pbxproj b/SwiftiumTestingKit.xcodeproj/project.pbxproj index 7c1f92d..e482296 100644 --- a/SwiftiumTestingKit.xcodeproj/project.pbxproj +++ b/SwiftiumTestingKit.xcodeproj/project.pbxproj @@ -542,7 +542,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = QH6KR5PAQ7; DYLIB_COMPATIBILITY_VERSION = 1; @@ -560,7 +560,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.3.0; + MARKETING_VERSION = 0.4.0; PRODUCT_BUNDLE_IDENTIFIER = fr.openium.SwiftiumTestingKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -576,7 +576,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = QH6KR5PAQ7; DYLIB_COMPATIBILITY_VERSION = 1; @@ -594,7 +594,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.3.0; + MARKETING_VERSION = 0.4.0; PRODUCT_BUNDLE_IDENTIFIER = fr.openium.SwiftiumTestingKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; diff --git a/SwiftiumTestingKit/XCTestCaseExtension.swift b/SwiftiumTestingKit/XCTestCaseExtension.swift index 9ba9407..ae32f2c 100644 --- a/SwiftiumTestingKit/XCTestCaseExtension.swift +++ b/SwiftiumTestingKit/XCTestCaseExtension.swift @@ -66,13 +66,22 @@ extension XCTestCase { name: StaticString = #function, cleaningMethodNameWith: (StaticString) -> String) { //let image = solo.window.otk_screenshot(withStatusBar: true) - let image = window.layer.screenshot + let image = XCUIScreen.main.screenshot().image + //let image = window.layer.screenshot let attachment = XCTAttachment(image: image, quality: .medium) attachment.lifetime = .keepAlways let nameCleaned = cleaningMethodNameWith(name) attachment.name = nameCleaned add(attachment) } + + public func attachScreenshot(name: String) { + let image = XCUIScreen.main.screenshot().image + let attachment = XCTAttachment(image: image, quality: .medium) + attachment.lifetime = .keepAlways + attachment.name = name + add(attachment) + } } extension UIView { diff --git a/tag-release.sh b/tag-release.sh index c6ea987..d79d9c8 100755 --- a/tag-release.sh +++ b/tag-release.sh @@ -5,6 +5,7 @@ if [ $# -lt 1 ] ; then exit -1 fi +VERSION=$1 TAG=v$VERSION echo "Have you updated the changelog for version $VERSION ? (ctrl-c to go update it)"