diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 607fae0f..114a45b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '26.0.0' + xcode-version: '26' # - name: Install lcov # run: brew install lcov@1.15.0 && brew link --overwrite --force lcov@1.15.0 diff --git a/E2E/TestFramework/BDD/Feature.swift b/E2E/TestFramework/BDD/Feature.swift index 75aa93dd..84e5f9c9 100644 --- a/E2E/TestFramework/BDD/Feature.swift +++ b/E2E/TestFramework/BDD/Feature.swift @@ -4,15 +4,11 @@ import SwiftHamcrest open class Feature: XCTestCase { let id: String = UUID().uuidString - open var currentScenario: Scenario? = nil - - open func title() -> String { - fatalError("Set feature title") - } - - open func description() -> String { - return "" - } + public var currentScenario: Scenario? = nil + + open var tags: [String] { return [] } + open var title: String { fatalError("Set feature title") } + open var narrative: String { return "" } /// our lifecycle starts after xctest is ending public override func tearDown() async throws { @@ -38,18 +34,18 @@ open class Feature: XCTestCase { public override class func tearDown() { if (TestConfiguration.started) { let semaphore = DispatchSemaphore(value: 0) - Task.detached { + Task.detached(priority: .userInitiated) { try await TestConfiguration.shared().endCurrentFeature() semaphore.signal() } semaphore.wait() } - super.tearDown() + XCTestCase.tearDown() } func run() async throws { let currentTestMethodName = self.name - if currentScenario == nil { + guard let scenario = currentScenario else { let rawMethodName = currentTestMethodName.split(separator: " ").last?.dropLast() ?? "yourTestMethod" let errorMessage = """ @@ -66,9 +62,10 @@ open class Feature: XCTestCase { """ throw ConfigurationError.missingScenario(errorMessage) } - if currentScenario!.disabled { - throw XCTSkip("Scenario '\(currentScenario!.name)' in test method \(currentTestMethodName) is disabled.") + if scenario.disabled { + throw XCTSkip("Scenario '\(scenario.name)' in test method \(currentTestMethodName) is disabled.") } + try await TestConfiguration.setUpInstance() if let parameterizedScenario = currentScenario as? ParameterizedScenario { diff --git a/E2E/TestFramework/BDD/Scenario.swift b/E2E/TestFramework/BDD/Scenario.swift index 2c25ab77..aeeb6699 100644 --- a/E2E/TestFramework/BDD/Scenario.swift +++ b/E2E/TestFramework/BDD/Scenario.swift @@ -8,7 +8,8 @@ public class Scenario { var disabled: Bool = false var feature: Feature? var parameters: [String: String]? - + var tags: [String] = [] + private var lastContext: String = "" public init(_ title: String, parameters: [String: String] = [:]) { @@ -31,6 +32,11 @@ public class Scenario { steps.append(stepInstance) } + public func tags(_ tags: String...) -> Scenario { + self.tags.append(contentsOf: tags) + return self + } + public func given(_ step: String) -> Scenario { lastContext = "Given" addStep(step) @@ -54,7 +60,7 @@ public class Scenario { addStep(step) return self } - + public func and(_ step: String) -> Scenario { if (lastContext.isEmpty) { fatalError("Trying to add an [and] step without previous context.") diff --git a/E2E/TestFramework/Configuration/TagFilter.swift b/E2E/TestFramework/Configuration/TagFilter.swift new file mode 100644 index 00000000..3927d3ce --- /dev/null +++ b/E2E/TestFramework/Configuration/TagFilter.swift @@ -0,0 +1,62 @@ +import Foundation + +struct TagFilter { + private let expression: String + + /// Initializes the filter with the raw tag expression string from the environment. + init(from expression: String?) { + self.expression = expression?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + } + + /// Determines if a scenario with the given tags should be executed based on the expression. + func shouldRun(scenarioTags: [String]) -> Bool { + // If there's no expression, run everything. + if expression.isEmpty { + return true + } + + let scenarioTagSet = Set(scenarioTags) + + // Split by "or" to handle the lowest precedence operator first. + // If any of these OR clauses are true, the whole expression is true. + let orClauses = expression.components(separatedBy: " or ") + + for orClause in orClauses { + // Check if this "AND" group is satisfied. + if evaluateAndClause(clause: orClause, scenarioTags: scenarioTagSet) { + return true + } + } + + // If none of the OR clauses were satisfied, the expression is false. + return false + } + + /// Evaluates a sub-expression containing only "and" and "not" conditions. + /// This clause is true only if ALL of its conditions are met. + private func evaluateAndClause(clause: String, scenarioTags: Set) -> Bool { + let andConditions = clause.components(separatedBy: " and ") + + for condition in andConditions { + if !evaluateCondition(condition: condition, scenarioTags: scenarioTags) { + return false // If any condition is false, the whole AND clause is false. + } + } + + // If all conditions passed, the AND clause is true. + return true + } + + /// Evaluates a single tag condition (e.g., "smoke" or "not wip"). + private func evaluateCondition(condition: String, scenarioTags: Set) -> Bool { + let trimmedCondition = condition.trimmingCharacters(in: .whitespacesAndNewlines) + + if trimmedCondition.hasPrefix("not ") { + let tag = String(trimmedCondition.dropFirst(4)) + return !scenarioTags.contains(tag) + } else { + let tag = trimmedCondition + return scenarioTags.contains(tag) + } + } +} diff --git a/E2E/TestFramework/Configuration/TestConfiguration.swift b/E2E/TestFramework/Configuration/TestConfiguration.swift index a14cc632..9bf1b477 100644 --- a/E2E/TestFramework/Configuration/TestConfiguration.swift +++ b/E2E/TestFramework/Configuration/TestConfiguration.swift @@ -100,10 +100,19 @@ open class TestConfiguration: ITestConfiguration { } func runSteps(_ scenario: Scenario) async throws -> ScenarioOutcome { + let tagString = TestConfiguration.shared().environment["TAGS"] + let tagFilter = TagFilter(from: tagString) + let scenarioTags = scenario.feature!.tags + scenario.tags + if !tagFilter.shouldRun(scenarioTags: scenarioTags) { + scenario.disabled = true + } if scenario.disabled { - return ScenarioOutcome(scenario) + let outcome = ScenarioOutcome(scenario) + outcome.status = .skipped + return outcome } + let scenarioOutcome = ScenarioOutcome(scenario) scenarioOutcome.start() @@ -222,6 +231,9 @@ open class TestConfiguration: ITestConfiguration { currentFeatureOut.scenarioOutcomes.append(scenarioOutcome) try await report(.AFTER_SCENARIO, scenarioOutcome) try await tearDownActors() + if (scenarioOutcome.status == .skipped) { + throw XCTSkip() + } } public func afterFeature(_ featureOutcome: FeatureOutcome) async throws { @@ -252,7 +264,7 @@ open class TestConfiguration: ITestConfiguration { /// signals the suite has ended public func end() { let semaphore = DispatchSemaphore(value: 0) - Task.detached { + Task.detached(priority: .userInitiated) { self.suiteOutcome.end() try await self.afterFeatures(self.suiteOutcome.featureOutcomes) try await self.tearDownInstance() @@ -335,13 +347,14 @@ open class TestConfiguration: ITestConfiguration { instance.suiteOutcome.start() self.instance = instance - do { - try await instance.setUp() - try await instance.setUpReporters() - try await instance.setUpSteps() - } catch { - throw ConfigurationError.setup(message: error.localizedDescription) - } + print("Setting up configuration instance") + try await instance.setUp() + + print("Setting up reporters") + try await instance.setUpReporters() + + print("Setting up steps") + try await instance.setUpSteps() /// setup hamcrest to update variable if failed HamcrestReportFunction = { message, file, line in diff --git a/E2E/TestFramework/Errors/ConfigurationError.swift b/E2E/TestFramework/Errors/ConfigurationError.swift index 3e16be50..71a2f206 100644 --- a/E2E/TestFramework/Errors/ConfigurationError.swift +++ b/E2E/TestFramework/Errors/ConfigurationError.swift @@ -1,10 +1,4 @@ open class ConfigurationError { - public final class setup: BaseError { - public init(message: String, file: StaticString = #file, line: UInt = #line) { - super.init(message: message, error: "Configuration error", file: file, line: line) - } - } - public final class missingScenario: Error, CustomStringConvertible { public var errorDescription: String public var failureReason: String = "Missing scenario" diff --git a/E2E/TestFramework/Outcome/FeatureOutcome.swift b/E2E/TestFramework/Outcome/FeatureOutcome.swift index ab3c592d..b8beb188 100644 --- a/E2E/TestFramework/Outcome/FeatureOutcome.swift +++ b/E2E/TestFramework/Outcome/FeatureOutcome.swift @@ -67,7 +67,7 @@ public class FeatureOutcome { } else { // This case should ideally not be reached if the above logic is complete. // Could default to .broken if there's an unexpected mix. - print("Warning: FeatureOutcome for '\(feature.title())' has an undetermined status mix.") +// print("Warning: FeatureOutcome for '\(feature.title())' has an undetermined status mix.") self.status = .broken // Default for unexpected mixed states } } diff --git a/E2E/TestFramework/Report/AllureReporter.swift b/E2E/TestFramework/Report/AllureReporter.swift index 3de9c762..88c589de 100644 --- a/E2E/TestFramework/Report/AllureReporter.swift +++ b/E2E/TestFramework/Report/AllureReporter.swift @@ -266,14 +266,14 @@ public class AllureReporter: Reporter { testCaseId: calculatedTestCaseId, name: scenario.name, fullName: scenarioUniqueName, - description: scenario.feature?.description(), + description: scenario.feature?.narrative, labels: [ AllureLabel(name: "host", value: ProcessInfo.processInfo.hostName), AllureLabel(name: "thread", value: getCurrentPid()), AllureLabel(name: "package", value: generatePackageName(fromFeatureType: type(of: scenario.feature!))), AllureLabel(name: "language", value: "swift"), AllureLabel(name: "framework", value: "identus-e2e-framework"), - AllureLabel(name: "feature", value: scenario.feature!.title()), + AllureLabel(name: "feature", value: scenario.feature!.title), //AllureLabel(name: "suite", value: "suite"), // FIXME: property? config? //AllureLabel(name: "epic", value: "suite"), // FIXME: property? config? //AllureLabel(name: "story", value: scenario.name) @@ -386,7 +386,7 @@ public class AllureReporter: Reporter { container.stop = millisecondsSince1970(from: featureOutcome.endTime) if (featureOutcome.status == .broken || featureOutcome.status == .failed), let featureErr = featureOutcome.error { // From your FeatureOutcome model - let fixtureName = "Feature Level Issue: \(featureOutcome.feature.title())" + let fixtureName = "Feature Level Issue: \(featureOutcome.feature.title)" let problemFixture = AllureFixtureResult( name: fixtureName, status: mapFrameworkStatusToAllureStatus(featureOutcome.status), diff --git a/E2E/TestFramework/Report/ConsoleReporter.swift b/E2E/TestFramework/Report/ConsoleReporter.swift index 762a8528..337bbc40 100644 --- a/E2E/TestFramework/Report/ConsoleReporter.swift +++ b/E2E/TestFramework/Report/ConsoleReporter.swift @@ -12,7 +12,7 @@ public class ConsoleReporter: Reporter { public func beforeFeature(_ feature: Feature) async throws { print() print("---") - print("Feature:", feature.title()) + print("Feature:", feature.title) } public func beforeScenario(_ scenario: Scenario) async throws { diff --git a/E2E/TestFramework/Report/DebugReporter.swift b/E2E/TestFramework/Report/DebugReporter.swift index d7dcbc95..ded93b4c 100644 --- a/E2E/TestFramework/Report/DebugReporter.swift +++ b/E2E/TestFramework/Report/DebugReporter.swift @@ -7,7 +7,7 @@ public class DebugReporter: Reporter { public required init() {} public func beforeFeature(_ feature: Feature) async throws { - if debug { print("Before Feature:", feature.title()) } + if debug { print("Before Feature:", feature.title) } } public func beforeScenario(_ scenario: Scenario) async throws { @@ -35,7 +35,7 @@ public class DebugReporter: Reporter { } public func afterFeature(_ featureOutcome: FeatureOutcome) async throws { - print("After Feature", featureOutcome.feature.title()) + print("After Feature", featureOutcome.feature.title) } public func afterFeatures(_ featuresOutcome: [FeatureOutcome]) async throws { diff --git a/E2E/TestFramework/Report/DotReporter.swift b/E2E/TestFramework/Report/DotReporter.swift index aa62c797..71795148 100644 --- a/E2E/TestFramework/Report/DotReporter.swift +++ b/E2E/TestFramework/Report/DotReporter.swift @@ -38,7 +38,7 @@ public class DotReporter: Reporter { public func afterFeatures(_ featuresOutcome: [FeatureOutcome]) async throws { print("Executed", featuresOutcome.count, "features") for featureOutcome in featuresOutcome { - print(" ", "Feature:", featureOutcome.feature.title()) + print(" ", "Feature:", featureOutcome.feature.title) for scenarioOutcome in featureOutcome.scenarioOutcomes { print( " ", diff --git a/E2E/TestFramework/Report/HtmlReporter.swift b/E2E/TestFramework/Report/HtmlReporter.swift index 3c56e690..ae446eb9 100644 --- a/E2E/TestFramework/Report/HtmlReporter.swift +++ b/E2E/TestFramework/Report/HtmlReporter.swift @@ -49,7 +49,7 @@ public class HtmlReporter: Reporter { let htmlReport: HtmlReport = HtmlReport() for featureOutcome in featuresOutcome { let featureReport = FeatureReport() - featureReport.name = featureOutcome.feature.title() + featureReport.name = featureOutcome.feature.title htmlReport.data.append(featureReport) for scenarioOutcome in featureOutcome.scenarioOutcomes { diff --git a/E2E/TestFramework/Report/JunitReporter.swift b/E2E/TestFramework/Report/JunitReporter.swift index 7719416e..05f518a4 100644 --- a/E2E/TestFramework/Report/JunitReporter.swift +++ b/E2E/TestFramework/Report/JunitReporter.swift @@ -41,7 +41,7 @@ public class JunitReporter: Reporter { featureFailures = 0 let id = XMLNode.attribute(withName: "id", stringValue: feature.id) as! XMLNode - let name = XMLNode.attribute(withName: "name", stringValue: feature.title()) as! XMLNode + let name = XMLNode.attribute(withName: "name", stringValue: feature.title) as! XMLNode currentFeature.addAttribute(id) currentFeature.addAttribute(name) diff --git a/E2E/TestFramework/Report/SummaryReporter.swift b/E2E/TestFramework/Report/SummaryReporter.swift index 31a6ebbf..3bd7dab8 100644 --- a/E2E/TestFramework/Report/SummaryReporter.swift +++ b/E2E/TestFramework/Report/SummaryReporter.swift @@ -48,7 +48,7 @@ public class SummaryReporter: Reporter { for featureOutcome in featuresOutcome { // Corrected Swift loop syntax totalFeaturesExecuted += 1 - let featureTitle = featureOutcome.feature.title() + let featureTitle = featureOutcome.feature.title let featureStatusString = featureOutcome.status.rawValue.uppercased() let featureDurationString = String(format: "%.2fs", featureOutcome.duration ?? 0.0) diff --git a/E2E/Tests/Source/Abilities/DidcommAgentAbility.swift b/E2E/Tests/Source/Abilities/DidcommAgentAbility.swift index ff55894a..8dcb1092 100644 --- a/E2E/Tests/Source/Abilities/DidcommAgentAbility.swift +++ b/E2E/Tests/Source/Abilities/DidcommAgentAbility.swift @@ -164,17 +164,7 @@ class DidcommAgentAbility: Ability { let did = (jsonData["from"] as? String)! return try DID(string: did) } - - static private func getRootsMediatorDid() async throws -> DID { - let url = URL(string: Config.mediatorOobUrl)! - let invitationUrl: String = try await Api.get(from: url) - let base64data: String = String(invitationUrl.split(separator: "?_oob=").last!) - let decodedData = Data(base64Encoded: base64data)! - let json = try (JSONSerialization.jsonObject(with: decodedData, options: []) as? [String: Any])! - let from = (json["from"] as? String)! - return try DID(string: from) - } - + private static func fromBase64(_ encoded: String) -> Data { var encoded = encoded; let remainder = encoded.count % 4 diff --git a/E2E/Tests/Source/Features/Backup.swift b/E2E/Tests/Source/Features/Backup.swift index 4b8f1a57..8b563cca 100644 --- a/E2E/Tests/Source/Features/Backup.swift +++ b/E2E/Tests/Source/Features/Backup.swift @@ -1,14 +1,9 @@ -import Foundation import TestFramework -final class BackupFeature: Feature { - override func title() -> String { - "Backup" - } - - override func description() -> String { - "The Edge Agent should be able to create and restore a backup" - } +final class Backup: Feature { + override var tags: [String] { ["backup"] } + override var title: String { "Backup" } + override var narrative: String { "The Edge Agent should be able to create and restore a backup" } func testCreateAndRestoreABackup() async throws { currentScenario = Scenario("Create and restore a backup") @@ -18,6 +13,7 @@ final class BackupFeature: Feature { func testAgentWithoutProperSeedShouldNotBeAbleToRestoreTheBackup() async throws { currentScenario = Scenario("Agent without a seed should not be able to restore the backup") + .tags("quick") .given("Edge Agent has created a backup") .then("a new Restored Agent cannot be restored from Edge Agent with wrong seed") } diff --git a/E2E/Tests/Source/Features/CreateConnection.swift b/E2E/Tests/Source/Features/CreateConnection.swift index 61b533f5..09fe53ec 100644 --- a/E2E/Tests/Source/Features/CreateConnection.swift +++ b/E2E/Tests/Source/Features/CreateConnection.swift @@ -1,13 +1,9 @@ import TestFramework -final class ConnectionFeature: Feature { - override func title() -> String { - "Create connection" - } - - override func description() -> String { - "The Edge Agent should be able to create a connection to Open Enterprise Agent" - } +final class CreateConnection: Feature { + override var tags: [String] { ["connection"] } + override var title: String { "Create connection" } + override var narrative: String { "The Edge Agent should be able to create a connection to Open Enterprise Agent" } func testConnection() async throws { let table: [[String: String]] = [ diff --git a/E2E/Tests/Source/Features/ProvideAnoncredProof.swift b/E2E/Tests/Source/Features/ProvideAnoncredProof.swift index 7d4f9fef..5001f479 100644 --- a/E2E/Tests/Source/Features/ProvideAnoncredProof.swift +++ b/E2E/Tests/Source/Features/ProvideAnoncredProof.swift @@ -1,38 +1,34 @@ - import TestFramework +import TestFramework - final class ProvideAnoncredProof: Feature { - override func title() -> String { - "Provide anonymous proof" - } +final class ProvideAnoncredProof: Feature { + override var tags: [String] { ["anoncred", "proof"] } + override var title: String { "Provide anonymous proof" } + override var narrative: String { "The Edge Agent should provide anonymous proof to Cloud Agent" } - override func description() -> String { - "The Edge Agent should provide anonymous proof to Cloud Agent" - } + func testRespondToProofOfRequest() async throws { + currentScenario = Scenario("Respond to anonymous request proof") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") + .when("Cloud Agent asks for anonymous present-proof") + .and("Edge Agent sends the present-proof") + .then("Cloud Agent should see the present-proof is verified") + } - func testRespondToProofOfRequest() async throws { - currentScenario = Scenario("Respond to anonymous request proof") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") - .when("Cloud Agent asks for anonymous present-proof") - .and("Edge Agent sends the present-proof") - .then("Cloud Agent should see the present-proof is verified") - } + func testRespondToAPresentRequestWithWrongCredential() async throws { + currentScenario = Scenario("Respond to a present request with a wrong credential") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") + .when("Cloud Agent asks for anonymous present-proof with unexpected attributes") + .then("Edge Agent should receive an exception when trying to use a wrong anoncred credential") + } - func testRespondToAPresentRequestWithWrongCredential() async throws { - currentScenario = Scenario("Respond to a present request with a wrong credential") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") - .when("Cloud Agent asks for anonymous present-proof with unexpected attributes") - .then("Edge Agent should receive an exception when trying to use a wrong anoncred credential") - } - - func testRespondToAPresentRequestWithWrongAttribute() async throws { - currentScenario = Scenario("Respond to a present request with a wrong attribute") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") - .when("Cloud Agent asks for presentation of AnonCred proof with unexpected values") - .and("Edge Agent sends the present-proof") - .then("Cloud Agent should see the present-proof is not verified") - .disable() - } - } + func testRespondÏToAPresentRequestWithWrongAttribute() async throws { + currentScenario = Scenario("Respond to a present request with a wrong attribute") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") + .when("Cloud Agent asks for presentation of AnonCred proof with unexpected values") + .and("Edge Agent sends the present-proof") + .then("Cloud Agent should see the present-proof is not verified") + .disable() + } +} diff --git a/E2E/Tests/Source/Features/ProvideJwtProof.swift b/E2E/Tests/Source/Features/ProvideJwtProof.swift index 2f526c17..9a9bf02a 100644 --- a/E2E/Tests/Source/Features/ProvideJwtProof.swift +++ b/E2E/Tests/Source/Features/ProvideJwtProof.swift @@ -1,13 +1,9 @@ import TestFramework final class ProvideJwtProof: Feature { - override func title() -> String { - "Provide jwt proof" - } - - override func description() -> String { - "The Edge Agent should provide jwt proof to Cloud Agent" - } + override var tags: [String] { ["jwt", "proof"] } + override var title: String { "Provide jwt proof" } + override var narrative: String { "The Edge Agent should provide jwt proof to Cloud Agent" } func testRespondToProofOfRequest() async throws { currentScenario = ParameterizedScenario("Respond to request proof") diff --git a/E2E/Tests/Source/Features/ProvideSdJwtProof.swift b/E2E/Tests/Source/Features/ProvideSdJwtProof.swift index 396878f6..683408ac 100644 --- a/E2E/Tests/Source/Features/ProvideSdJwtProof.swift +++ b/E2E/Tests/Source/Features/ProvideSdJwtProof.swift @@ -1,13 +1,9 @@ import TestFramework final class ProvideSdJwtProof: Feature { - override func title() -> String { - "Provide sdjwt proof" - } - - override func description() -> String { - "The Edge Agent should provide sdjwt proof to Cloud Agent" - } + override var tags: [String] { ["sdjwt", "proof"] } + override var title: String { "Provide sdjwt proof" } + override var narrative: String { "The Edge Agent should provide sdjwt proof to Cloud Agent" } func testRespondToProofOfRequest() async throws { currentScenario = Scenario("Respond to request proof") diff --git a/E2E/Tests/Source/Features/ReceiveAnoncredCredential.swift b/E2E/Tests/Source/Features/ReceiveAnoncredCredential.swift index d3fef8a7..ff0d6004 100644 --- a/E2E/Tests/Source/Features/ReceiveAnoncredCredential.swift +++ b/E2E/Tests/Source/Features/ReceiveAnoncredCredential.swift @@ -1,13 +1,9 @@ import TestFramework -final class ReceiveAnoncredCredentialFeature: Feature { - override func title() -> String { - "Receive anonymous credential" - } - - override func description() -> String { - "The Edge Agent should be able to receive an anonymous credential from Cloud Agent" - } +final class ReceiveAnoncredCredential: Feature { + override var tags: [String] { ["credential", "anoncred"] } + override var title: String { "Receive anonymous credential" } + override var narrative: String { "The Edge Agent should be able to receive an anonymous credential from Cloud Agent" } func testReceiveOneAnoncred() async throws { currentScenario = Scenario("Receive one anonymous credential") diff --git a/E2E/Tests/Source/Features/ReceiveJwtCredential.swift b/E2E/Tests/Source/Features/ReceiveJwtCredential.swift index 26a40a29..c5c22ae3 100644 --- a/E2E/Tests/Source/Features/ReceiveJwtCredential.swift +++ b/E2E/Tests/Source/Features/ReceiveJwtCredential.swift @@ -1,13 +1,9 @@ import TestFramework -final class ReceiveJwtCredentialTests: Feature { - override func title() -> String { - "Receive verifiable credential" - } - - override func description() -> String { - "The Edge Agent should be able to receive a verifiable credential from Cloud Agent" - } +final class ReceiveJwtCredential: Feature { + override var tags: [String] { ["credential", "jwt"] } + override var title: String { "Receive verifiable credential" } + override var narrative: String { "The Edge Agent should be able to receive a verifiable credential from Cloud Agent" } func testReceiveOneCredential() async throws { currentScenario = Scenario("Receive one verifiable credential") diff --git a/E2E/Tests/Source/Features/ReceiveSdJwtCredential.swift b/E2E/Tests/Source/Features/ReceiveSdJwtCredential.swift index d814a4be..089a9978 100644 --- a/E2E/Tests/Source/Features/ReceiveSdJwtCredential.swift +++ b/E2E/Tests/Source/Features/ReceiveSdJwtCredential.swift @@ -1,13 +1,9 @@ import TestFramework -final class ReceiveSdJwtCredentialTests: Feature { - override func title() -> String { - "Receive verifiable credential" - } - - override func description() -> String { - "The Edge Agent should be able to receive a verifiable credential from Cloud Agent" - } +final class ReceiveSdJwtCredential: Feature { + override var tags: [String] { ["credential", "sdjwt"] } + override var title: String { "Receive verifiable credential" } + override var narrative: String { "The Edge Agent should be able to receive a verifiable credential from Cloud Agent" } func testReceiveOneCredential() async throws { currentScenario = Scenario("Receive one sd+jwt credential") diff --git a/E2E/Tests/Source/Features/RevokeJwtCredential.swift b/E2E/Tests/Source/Features/RevokeJwtCredential.swift index 4dbae7c1..2ab5886d 100644 --- a/E2E/Tests/Source/Features/RevokeJwtCredential.swift +++ b/E2E/Tests/Source/Features/RevokeJwtCredential.swift @@ -1,14 +1,10 @@ import TestFramework final class RevokeJwtCredential: Feature { - override func title() -> String { - "Revoke JWT Credential" - } - - override func description() -> String { - "Edge Agent should be notified when Cloud Agent revokes a credential" - } - + override var tags: [String] { ["revocation", "jwt"] } + override var title: String { "Revoke JWT Credential" } + override var narrative: String { "Edge Agent should be notified when Cloud Agent revokes a credential" } + func testRevocationNotification() async throws { currentScenario = Scenario("Revoke one verifiable credential") .given("Cloud Agent is connected to Edge Agent") diff --git a/E2E/Tests/Source/Features/VerifyAnoncredCredential.swift b/E2E/Tests/Source/Features/VerifyAnoncredCredential.swift index 115ce2aa..b002984a 100644 --- a/E2E/Tests/Source/Features/VerifyAnoncredCredential.swift +++ b/E2E/Tests/Source/Features/VerifyAnoncredCredential.swift @@ -1,28 +1,26 @@ - import TestFramework +import TestFramework - final class VerifyAnoncredCredential: Feature { - override func title() -> String { - "Verify Anoncred presentation" - } +final class VerifyAnoncredCredential: Feature { + override var tags: [String] { ["anoncred", "verification"] } + override var title: String { "Verify Anoncred presentation" } + override var narrative: String { + "The Edge Agent should be able to receive a verifiable credential from Cloud Agent and then send a presentation to another edge agent who will verify it" + } - override func description() -> String { - "The Edge Agent should be able to receive a verifiable credential from Cloud Agent and then send a presentation to another edge agent who will verify it" - } + func testSdkAnoncredVerification() async throws { + currentScenario = Scenario("Should succeed") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") + .when("Verifier Edge Agent will request Edge Agent to verify the anonymous credential") + .and("Edge Agent sends the present-proof") + .then("Verifier Edge Agent should see the verification proof is verified") + } - func testSdkAnoncredVerification() async throws { - currentScenario = Scenario("Should succeed") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") - .when("Verifier Edge Agent will request Edge Agent to verify the anonymous credential") - .and("Edge Agent sends the present-proof") - .then("Verifier Edge Agent should see the verification proof is verified") - } - - func testSdkAnoncredVerificationUnsatisfiedPredicate() async throws { - currentScenario = Scenario("Should fail for unsatisfied predicate") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") - .when("Verifier Edge Agent will request Edge Agent to verify the anonymous credential for age greater than actual") - .then("Edge Agent should not be able to create the present-proof") - } - } + func testSdkAnoncredVerificationUnsatisfiedPredicate() async throws { + currentScenario = Scenario("Should fail for unsatisfied predicate") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' anonymous credentials issued by Cloud Agent") + .when("Verifier Edge Agent will request Edge Agent to verify the anonymous credential for age greater than actual") + .then("Edge Agent should not be able to create the present-proof") + } +} diff --git a/E2E/Tests/Source/Features/VerifyJwtCredential.swift b/E2E/Tests/Source/Features/VerifyJwtCredential.swift index 67c63a81..f56a5811 100644 --- a/E2E/Tests/Source/Features/VerifyJwtCredential.swift +++ b/E2E/Tests/Source/Features/VerifyJwtCredential.swift @@ -1,11 +1,9 @@ import TestFramework -final class VerifyJwt: Feature { - override func title() -> String { - "Verify JWT presentation" - } - - override func description() -> String { +final class VerifyJwtCredential: Feature { + override var tags: [String] { ["verification", "jwt"] } + override var title: String { "Verify JWT presentation" } + override var narrative: String { "The Edge Agent should be able to receive a verifiable credential from Cloud Agent and then send a presentation to another edge agent who will verify it" } diff --git a/E2E/Tests/Source/Features/VerifySdJwtCredential.swift b/E2E/Tests/Source/Features/VerifySdJwtCredential.swift index a9251117..3982cd6c 100644 --- a/E2E/Tests/Source/Features/VerifySdJwtCredential.swift +++ b/E2E/Tests/Source/Features/VerifySdJwtCredential.swift @@ -1,30 +1,28 @@ - import TestFramework +import TestFramework - final class VerifySdJwt: Feature { - override func title() -> String { - "Verify SD+JWT presentation" - } +final class VerifySdJwtCredential: Feature { + override var tags: [String] { ["verification", "sdjwt"] } + override var title: String { "Verify SD+JWT presentation" } + override var narrative: String { + "The Edge Agent should be able to receive a verifiable credential from Cloud Agent and then send a presentation to another edge agent who will verify it" + } - override func description() -> String { - "The Edge Agent should be able to receive a verifiable credential from Cloud Agent and then send a presentation to another edge agent who will verify it" - } + func testSdJwtVerification() async throws { + currentScenario = Scenario("SDKs JWT Verification") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' sdjwt credentials issued by Cloud Agent") + .then("Verifier Edge Agent requests the Edge Agent to verify the sdjwt credential") + .when("Edge Agent sends the present-proof") + .then("Verifier Edge Agent should see the verification proof is verified") + } - func testSdJwtVerification() async throws { - currentScenario = Scenario("SDKs JWT Verification") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' sdjwt credentials issued by Cloud Agent") - .then("Verifier Edge Agent requests the Edge Agent to verify the sdjwt credential") - .when("Edge Agent sends the present-proof") - .then("Verifier Edge Agent should see the verification proof is verified") - } - - func testSdJwtWrongClaimsVerification() async throws { - currentScenario = Scenario("SDKs JWT Verification") - .given("Cloud Agent is connected to Edge Agent") - .and("Edge Agent has '1' sd+jwt credentials issued by Cloud Agent") - .then("Verifier Edge Agent requests Edge Agent to verify the SD+JWT credential with non-existing claims") - .when("Edge Agent sends the present-proof") - .then("Verifier Edge Agent should see the verification proof is not verified") - .disable() - } - } + func testSdJwtWrongClaimsVerification() async throws { + currentScenario = Scenario("SDKs JWT Verification") + .given("Cloud Agent is connected to Edge Agent") + .and("Edge Agent has '1' sd+jwt credentials issued by Cloud Agent") + .then("Verifier Edge Agent requests Edge Agent to verify the SD+JWT credential with non-existing claims") + .when("Edge Agent sends the present-proof") + .then("Verifier Edge Agent should see the verification proof is not verified") + .disable() + } +}