From 625f98a41a162edd3ffc2ea1764435d1072cc3f1 Mon Sep 17 00:00:00 2001 From: Andreas Bauer Date: Tue, 20 Aug 2024 11:28:42 +0200 Subject: [PATCH] Fix concurrency in tests --- TemplateApplicationTests/TemplateApplicationTests.swift | 1 + TemplateApplicationUITests/ContactsTests.swift | 9 +++++---- TemplateApplicationUITests/ContributionsTest.swift | 7 ++++--- TemplateApplicationUITests/SchedulerTests.swift | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/TemplateApplicationTests/TemplateApplicationTests.swift b/TemplateApplicationTests/TemplateApplicationTests.swift index e019d9b..af006a4 100644 --- a/TemplateApplicationTests/TemplateApplicationTests.swift +++ b/TemplateApplicationTests/TemplateApplicationTests.swift @@ -11,6 +11,7 @@ import XCTest class TemplateApplicationTests: XCTestCase { + @MainActor func testContactsCount() throws { XCTAssertEqual(Contacts(presentingAccount: .constant(true)).contacts.count, 1) } diff --git a/TemplateApplicationUITests/ContactsTests.swift b/TemplateApplicationUITests/ContactsTests.swift index 6e70089..ac51f30 100644 --- a/TemplateApplicationUITests/ContactsTests.swift +++ b/TemplateApplicationUITests/ContactsTests.swift @@ -10,9 +10,9 @@ import XCTest class ContactsTests: XCTestCase { - override func setUpWithError() throws { - try super.setUpWithError() - + @MainActor + override func setUp() async throws { + continueAfterFailure = false let app = XCUIApplication() @@ -20,7 +20,8 @@ class ContactsTests: XCTestCase { app.launch() } - + + @MainActor func testContacts() throws { let app = XCUIApplication() diff --git a/TemplateApplicationUITests/ContributionsTest.swift b/TemplateApplicationUITests/ContributionsTest.swift index a7176d3..55332be 100644 --- a/TemplateApplicationUITests/ContributionsTest.swift +++ b/TemplateApplicationUITests/ContributionsTest.swift @@ -10,9 +10,9 @@ import XCTest final class ContributionsTest: XCTestCase { - override func setUpWithError() throws { - try super.setUpWithError() - + @MainActor + override func setUp() async throws { + continueAfterFailure = false let app = XCUIApplication() @@ -20,6 +20,7 @@ final class ContributionsTest: XCTestCase { app.deleteAndLaunch(withSpringboardAppName: "TemplateApplication") } + @MainActor func testLicenseInformationPage() throws { let app = XCUIApplication() diff --git a/TemplateApplicationUITests/SchedulerTests.swift b/TemplateApplicationUITests/SchedulerTests.swift index e201d20..fef49bb 100644 --- a/TemplateApplicationUITests/SchedulerTests.swift +++ b/TemplateApplicationUITests/SchedulerTests.swift @@ -11,9 +11,8 @@ import XCTestExtensions class SchedulerTests: XCTestCase { - override func setUpWithError() throws { - try super.setUpWithError() - + @MainActor + override func setUp() async throws { continueAfterFailure = false let app = XCUIApplication() @@ -21,7 +20,8 @@ class SchedulerTests: XCTestCase { app.deleteAndLaunch(withSpringboardAppName: "TemplateApplication") } - + + @MainActor func testScheduler() throws { let app = XCUIApplication()