Skip to content

Commit

Permalink
added hot env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Espinola committed Jun 21, 2024
1 parent 5efc10a commit 863e91a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Example/CreativeUITest/CreativeUITest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class CreativeUITest: XCTestCase, BaseXCTestCase {
clearCookies()
resetUserDefaults()

XCUIApplication().activate()
app.activate()

super.tearDown()
}
Expand Down Expand Up @@ -69,11 +69,12 @@ final class CreativeUITest: XCTestCase, BaseXCTestCase {
CreativePage
.addDelay(seconds: 1)
.tapOnPrivacyLink()
.addDelay(seconds: 5)

guard canLaunchExternalApps else { return }

PricacyPolicyPage.verifyContent()
PricacyPolicyPage
.addDelay(seconds: 5)
.verifyContent()
}

func testLoadCreative_inDebugMode_showsDebugMessage() {
Expand Down
2 changes: 1 addition & 1 deletion Example/CreativeUITest/Pages/HomePage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct HomePage: Page {

@discardableResult
static func tapOnPushMeToCreative() -> Self.Type {
creativeButton.tapOnElement()
creativeButton.tapOnElement(timeout: Timeout.max)
return self
}

Expand Down
6 changes: 5 additions & 1 deletion Example/CreativeUITest/Protocols/BaseXCTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ enum Mode: String {
}

protocol BaseXCTestCase where Self: XCTestCase {
var app: XCUIApplication { get }
func deleteApp()
func launch(with mode: Mode)
}

extension BaseXCTestCase {
var app: XCUIApplication { .init() }

func deleteApp() {
guard canLaunchExternalApps else { return }

Expand All @@ -44,6 +47,7 @@ extension BaseXCTestCase {
"COM_ATTENTIVE_EXAMPLE_DOMAIN" : "mobileapps",
"COM_ATTENTIVE_EXAMPLE_MODE" : mode.rawValue,
"COM_ATTENTIVE_EXAMPLE_IS_UI_TEST" : "YES",
"COM_ATTENTIVE_EXAMPLE_HOST" : "local"
]

if !extras.isEmpty {
Expand All @@ -57,6 +61,6 @@ extension BaseXCTestCase {
var canLaunchExternalApps: Bool {
ProcessInfo
.processInfo
.environment["COM_ATTENTIVE_EXAMPLE_HOST"] != "device_farm"
.environment["COM_ATTENTIVE_EXAMPLE_HOST"] == "local"
}
}

0 comments on commit 863e91a

Please sign in to comment.