Skip to content

Commit

Permalink
Merge pull request #288 from sbenedicadb/update-e2e-tests
Browse files Browse the repository at this point in the history
-fix race condition in e2e tests
  • Loading branch information
sbenedicadb authored Aug 12, 2024
2 parents ec9a361 + 1b684c3 commit 5c85d66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions AEPMessaging/Tests/E2EFunctionalTests/E2EFunctionalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,25 @@ class E2EFunctionalTests: XCTestCase, AnyCodableAsserts {
MobileCore.clearUpdatedConfiguration()

let environment = Environment.get()
MobileCore.configureWith(appId: environment.appId)
if let configUpdates = environment.configurationUpdates {
MobileCore.updateConfigurationWith(configDict: configUpdates)
}

MobileCore.updateConfigurationWith(configDict: environment.configurationUpdates)

let extensions = [
Consent.self,
AEPEdgeIdentity.Identity.self,
Messaging.self,
Edge.self
]

MobileCore.registerExtensions(extensions)

MobileCore.registerExtensions(extensions) {
MobileCore.configureWith(appId: environment.appId)
}

// wait 2 seconds to allow configuration to download
let semaphore = DispatchSemaphore(value: 0)
DispatchQueue.global().asyncAfter(deadline: .now() + .seconds(2)) {
semaphore.signal()
}
semaphore.wait()
}

func registerMessagingRequestContentListener(_ listener: @escaping EventListener) {
Expand Down
6 changes: 3 additions & 3 deletions AEPMessaging/Tests/E2EFunctionalTests/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ extension Environment {
}
}

var configurationUpdates: [String: Any]? {
var configurationUpdates: [String: Any] {
guard isStaging else {
return nil
return [ "edge.environment": "" ]
}

return ["edge.environment": "int"]
return [ "edge.environment": "int" ]
}

private var isStaging: Bool {
Expand Down

0 comments on commit 5c85d66

Please sign in to comment.