diff --git a/ios/common-swiftui-test/common-swiftui-test/CustomSwiftUiTestRuleWrapper.swift b/ios/common-swiftui-test/common-swiftui-test/CustomSwiftUiTestRuleWrapper.swift deleted file mode 100755 index 76e9f02..0000000 --- a/ios/common-swiftui-test/common-swiftui-test/CustomSwiftUiTestRuleWrapper.swift +++ /dev/null @@ -1,26 +0,0 @@ -import SwiftUI -import CommonSwiftUi - -public struct CustomSwiftUiTestRuleWrapper: View where Content: View { - let embedWithinNavigation: Bool - let content: () -> Content - - public init( - embedWithinNavigation: Bool = false, - @ViewBuilder content: @escaping () -> Content - ) { - self.embedWithinNavigation = embedWithinNavigation - self.content = content - } - - public var body: some View { - let theme = Theme(type: .dark) - if embedWithinNavigation { - NavigationView { - content().environmentObject(theme) - } - } else { - content().environmentObject(theme) - } - } -} diff --git a/ios/feed-test-fixtures/feed-test-fixtures/FeedRobot.swift b/ios/feed-test-fixtures/feed-test-fixtures/FeedRobot.swift deleted file mode 100755 index a9191a5..0000000 --- a/ios/feed-test-fixtures/feed-test-fixtures/FeedRobot.swift +++ /dev/null @@ -1,103 +0,0 @@ -import XCTest - -/* - Robot to make assertions on the Feed screen. - */ -public class FeedRobot { - private let app: XCUIApplication - - public init(app: XCUIApplication) { - self.app = app - } - - public func assertLoadingExists() { - XCTAssert(app.activityIndicators[Loading].exists) - } - - public func assertLoadingDoesNotExist() { - XCTAssert(!app.activityIndicators[Loading].exists) - } - - public func assertEmptyStateExists() { - XCTAssert(app.staticTexts["No results found. Please\ntry another search term"].exists) - } - - public func assertEmptyStateDoesNotExist() { - XCTAssert(!app.staticTexts["No results found. Please\ntry another search term"].exists) - } - - public func assertSectionExists(header: String) { - XCTAssert(app.staticTexts[header].exists) - } - - public func assertSectionDoesNotExist(header: String) { - XCTAssert(!app.staticTexts[header].exists) - } - - public func assertFeedItemExists( - title: String, - date: String - ) { - XCTAssert(app.staticTexts[title].exists) - XCTAssert(app.staticTexts[date].exists) - } - - public func assertFeedItemDoesNotExist( - title: String, - date: String - ) { - XCTAssert(!app.staticTexts[title].exists) - XCTAssert(!app.staticTexts[date].exists) - } - - public func assertFavouriteItemsShown(favouriteItems: Int) { - XCTAssertEqual(app.images.matching(identifier: AddedToFavourites).count, favouriteItems) - } - - public func assertBackButtonExists() { - XCTAssert(app.buttons["Newsfeed"].exists) - } - - public func assertBackButtonDoesNotExist() { - XCTAssert(!app.buttons["Newsfeed"].exists) - } - - public func assertBlockingErrorExists() { - XCTAssert(app.staticTexts[BlockingErrorTitle].exists) - XCTAssert(app.staticTexts[BlockingErrorSubtitle].exists) - XCTAssert(app.buttons[BlockingErrorAction].exists) - } - - public func assertBlockingErrorDoesNotExist() { - XCTAssert(!app.staticTexts[BlockingErrorTitle].exists) - XCTAssert(!app.staticTexts[BlockingErrorSubtitle].exists) - XCTAssert(!app.buttons[BlockingErrorAction].exists) - } - - public func assertNonBlockingErrorExists() { - XCTAssert(app.staticTexts[NonBlockingErrorTitle].exists) - XCTAssert(app.staticTexts[NonBlockingErrorSubtitle].exists) - XCTAssert(app.buttons[NonBlockingErrorAction].exists) - } - - public func assertNonBlockingErrorDoesNotExist() { - XCTAssert(!app.staticTexts[NonBlockingErrorTitle].exists) - XCTAssert(!app.staticTexts[NonBlockingErrorSubtitle].exists) - XCTAssert(!app.buttons[NonBlockingErrorAction].exists) - } - - public func clickPost(title: String) { - app.staticTexts[title].tap() - } -} - -private let Loading = "Loading" - -private let AddedToFavourites = "Added to favourites" - -private let BlockingErrorTitle = "Oups!" -private let BlockingErrorSubtitle = "Something has gone wrong. Please try again." -private let BlockingErrorAction = "Try again" -private let NonBlockingErrorTitle = "Oups" -private let NonBlockingErrorSubtitle = "Something went wrong. Please try again." -private let NonBlockingErrorAction = "Retry" diff --git a/ios/post-test-fixtures/post-test-fixtures/PostRobot.swift b/ios/post-test-fixtures/post-test-fixtures/PostRobot.swift deleted file mode 100755 index e1a199f..0000000 --- a/ios/post-test-fixtures/post-test-fixtures/PostRobot.swift +++ /dev/null @@ -1,89 +0,0 @@ -import XCTest - -/* - Robot to make assertions on the Post screen. - */ -public class PostRobot { - private let app: XCUIApplication - - public init(app: XCUIApplication) { - self.app = app - } - - public func assertLoadingExists() { - XCTAssert(app.activityIndicators[Loading].exists) - } - - public func assertLoadingDoesNotExist() { - XCTAssert(!app.activityIndicators[Loading].exists) - } - - public func assertPostExists( - title: String, - author: String, - readingTime: String, - body: String - ) { - XCTAssert(app.staticTexts[title].exists) - XCTAssert(app.staticTexts[author].exists) - XCTAssert(app.staticTexts[readingTime].exists) - XCTAssert(app.staticTexts[body].exists) - } - - public func assertPostDoesNotExist( - title: String, - author: String, - readingTime: String, - body: String - ) { - XCTAssert(!app.staticTexts[title].exists) - XCTAssert(!app.staticTexts[author].exists) - XCTAssert(!app.staticTexts[readingTime].exists) - XCTAssert(!app.staticTexts[body].exists) - } - - public func assertAddToFavouritesButtonExists() { - XCTAssert(app.buttons[AddToFavourite].exists) - } - - public func assertAddToFavouritesButtonDoesNotExist() { - XCTAssert(!app.buttons[AddToFavourite].exists) - } - - public func assertRemoveFromFavouritesButtonExists() { - XCTAssert(app.buttons[RemoveFromFavourite].exists) - } - - public func assertRemoveFromFavouritesButtonDoesNotExist() { - XCTAssert(!app.buttons[RemoveFromFavourite].exists) - } - - public func assertBlockingErrorExists() { - XCTAssert(app.staticTexts[BlockingErrorTitle].exists) - XCTAssert(app.staticTexts[BlockingErrorSubtitle].exists) - XCTAssert(app.buttons[BlockingErrorAction].exists) - } - - public func assertBlockingErrorDoesNotExist() { - XCTAssert(!app.staticTexts[BlockingErrorTitle].exists) - XCTAssert(!app.staticTexts[BlockingErrorSubtitle].exists) - XCTAssert(!app.buttons[BlockingErrorAction].exists) - } - - public func clickAddToFavouritesButton() { - app.buttons[AddToFavourite].tap() - } - - public func clickRemoveFromFavouritesButton() { - app.buttons[RemoveFromFavourite].tap() - } -} - -private let Loading = "Loading" - -private let AddToFavourite = "Add to favourites" -private let RemoveFromFavourite = "Remove from favourites" - -private let BlockingErrorTitle = "Oups!" -private let BlockingErrorSubtitle = "Something has gone wrong. Please try again." -private let BlockingErrorAction = "Try again"