Skip to content

Commit

Permalink
Merge pull request #20395 from wordpress-mobile/enable-core-data-conc…
Browse files Browse the repository at this point in the history
…urrency-debug-option-in-ui-tests

Enable Core Data concurrency debug option in UI tests
  • Loading branch information
crazytonyli authored Apr 3, 2023
2 parents 2f3499c + 46f6655 commit f316bf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion WordPress/UITests/Tests/EditorGutenbergTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class EditorGutenbergTests: XCTestCase {
private var editorScreen: BlockEditorScreen!

override func setUpWithError() throws {
setUpTestSuite()
setUpTestSuite(crashOnCoreDataConcurrencyIssues: false)

_ = try LoginFlow.login(siteUrl: WPUITestCredentials.testWPcomSiteAddress, email: WPUITestCredentials.testWPcomUserEmail, password: WPUITestCredentials.testWPcomPassword)
editorScreen = try EditorFlow
Expand Down
10 changes: 9 additions & 1 deletion WordPress/UITests/Utils/XCTest+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ import XCTest

extension XCTestCase {

public func setUpTestSuite(for app: XCUIApplication = XCUIApplication(), removeBeforeLaunching: Bool = false) {
public func setUpTestSuite(
for app: XCUIApplication = XCUIApplication(),
removeBeforeLaunching: Bool = false,
crashOnCoreDataConcurrencyIssues: Bool = true
) {
super.setUp()

// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false

app.launchArguments = ["-wpcom-api-base-url", WireMock.URL().absoluteString, "-no-animations", "-ui-testing"]

if crashOnCoreDataConcurrencyIssues {
app.launchArguments.append(contentsOf: ["-com.apple.CoreData.ConcurrencyDebug", "1"])
}

if removeBeforeLaunching {
removeApp(app)
}
Expand Down

0 comments on commit f316bf4

Please sign in to comment.