localhost1978's picture
download
raw
1.99 kB
import XCTest
public enum SSKAccessibilityID: String {
case snippetContainer = "SSK_UI_SnippetContainer"
case snippetTitle = "SSK_UI_SnippetTitle"
case snippetFileCount = "SSK_UI_SnippetFileCount"
case snippetRoutingButton = "SSK_UI_SnippetRoutingButton"
}
@MainActor
class UITestBase: XCTestCase {
var app: XCUIApplication!
override func setUpWithError() throws {
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// Initialize XCUIApplication. For SPM integration, the scheme must specify the Target Application.
app = XCUIApplication()
// Pass the UITesting argument so the app knows it's being tested and can launch the Debug Host View
app.launchArguments.append("-UITesting")
// Register a teardown block that runs on failure to capture screenshots
addTeardownBlock { [weak self] in
guard let self = self else { return }
// In XCTest, the test run is associated with the test case instance.
// If the test failed, capture a screenshot.
if let testRun = self.testRun, testRun.failureCount > 0 {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.name = "FailureScreenshot_\(self.name)"
attachment.lifetime = .keepAlways
self.add(attachment)
}
}
}
override func tearDownWithError() throws {
app = nil
}
/// Helper to manually trigger a screenshot at any point during validation
func takeScreenshot(named name: String) {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.name = name
attachment.lifetime = .keepAlways
add(attachment)
}
}

Xet Storage Details

Size:
1.99 kB
·
Xet hash:
2c61a50e8f841ba0d03fa10a3d9705cd3b88051403950e20e4fb10bc959e037f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.