-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: e2e framework #112
test: e2e framework #112
Conversation
@@ -23,6 +23,7 @@ class KeychainMock: KeychainStore, KeychainProvider { | |||
service: String, | |||
account: String | |||
) throws { | |||
print("Add KEY", key, service, account) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw I have to remove this
AtalaPrismSDK/PrismAgent/Sources/Protocols/Connection/DIDCommConnectionRunner.swift
Outdated
Show resolved
Hide resolved
Sample/AtalaPrismWalletDemo/AtalaPrismWalletDemo/AtalaPrismWalletDemo.entitlements
Outdated
Show resolved
Hide resolved
AtalaPrismSDK/PrismAgent/Sources/Protocols/Connection/DIDCommConnectionRunner.swift
Outdated
Show resolved
Hide resolved
static private func createSecretsStream( | ||
keyRestoration: KeyRestoration, | ||
pluto: Pluto, | ||
castor: Castor | ||
) -> AnyPublisher<[Secret], Error> { | ||
pluto.getAllPeerDIDs() | ||
.first() | ||
.flatMap { array in | ||
Future { | ||
try await array.asyncMap { did, privateKeys, _ in | ||
let privateKeys = try await privateKeys.asyncMap { | ||
try await keyRestoration.restorePrivateKey($0) | ||
} | ||
let secrets = try parsePrivateKeys( | ||
did: did, | ||
privateKeys: privateKeys, | ||
castor: castor | ||
) | ||
|
||
return secrets | ||
} | ||
} | ||
} | ||
.map { | ||
$0.compactMap { | ||
$0 | ||
}.flatMap { | ||
$0 | ||
} } | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
static private func parsePrivateKeys( | ||
did: DID, | ||
privateKeys: [PrivateKey], | ||
castor: Castor | ||
) throws -> [Domain.Secret] { | ||
return try privateKeys | ||
.map { $0 as? (PrivateKey & ExportableKey) } | ||
.compactMap { $0 } | ||
.map { privateKey in | ||
let ecnumbasis = try castor.getEcnumbasis(did: did, publicKey: privateKey.publicKey()) | ||
return (did, privateKey, ecnumbasis) | ||
} | ||
.map { did, privateKey, ecnumbasis in | ||
try parseToSecret( | ||
did: did, | ||
privateKey: privateKey, | ||
ecnumbasis: ecnumbasis | ||
) | ||
} | ||
} | ||
|
||
static private func parseToSecret(did: DID, privateKey: PrivateKey & ExportableKey, ecnumbasis: String) throws -> Domain.Secret { | ||
let id = did.string + "#" + ecnumbasis | ||
let jwk = privateKey.jwk | ||
guard | ||
let dataJson = try? JSONEncoder().encode(jwk), | ||
let stringJson = String(data: dataJson, encoding: .utf8) | ||
else { | ||
throw CommonError.invalidCoding(message: "Could not encode privateKey.jwk") | ||
} | ||
return .init( | ||
id: id, | ||
type: .jsonWebKey2020, | ||
secretMaterial: .jwk(value: stringJson) | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to do this? Can't the SDK do this for you? What are your trying to achieve? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of what you did to help me. It's being used on the creation of the agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say much, to be honest, as I'm not Swift specialist, but from my perspective, it looks very good.
I would concentrate on a bit of documentation for configuring and running the tests + quick guide on how to add a new scenario.
For sure, JUnit report is lacking, but it can come later and included into the CI/CD checks.
But it's very nice job and we finally have something for Swift which is awesome and @goncalo-frade-iohk will be happy :)
ab32e45
to
c3265d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks beautiful even if I'm not an expert in Swift 👍
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)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FIY its preferable to use Codable
and you could use our Message
structure to parse this. But since this is a test framework its good enough :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean, can you provide an example?
Overview
@goncalo-frade-iohk @antonbaliasnikov this is the draft of the e2e framework. few things are not ready yet and others could be improved
but the main points are the
junit
andhtml
reports that create the output files that we are going to use for the releases. they are created using thetargetDirectory
folder -- which should point to the source code folder (E2E/e2etests/Target
)XML example:
(checkout the output using online parser like this: https://lotterfriends.github.io/online-junit-parser)
"HTML" example (it's a txt file for now):
Results running in xcode
Fixes #
Checklist
My PR contains...
My changes...
Documentation
Tests