Skip to content

Commit

Permalink
Merge pull request #369 from WalletConnect/feature/xcode-13-4-#361
Browse files Browse the repository at this point in the history
[CI] Upgrade XCode on GH Runner
  • Loading branch information
flypaper0 authored Jul 27, 2022
2 parents b0f6398 + 9a606de commit 18a07a0
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 74 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
build:
runs-on: macos-latest
runs-on: macos-12
strategy:
matrix:
test-type: [ui-tests, unit-tests, integration-tests, build-example-wallet, build-example-dapp]
Expand All @@ -27,8 +27,6 @@ jobs:

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.2'

- uses: actions/cache@v2
with:
Expand Down
139 changes: 72 additions & 67 deletions Example/IntegrationTests/Chat/ChatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@ final class ChatTests: XCTestCase {
override func setUp() {
registry = KeyValueRegistry()
invitee = makeClient(prefix: "🦖 Registered")
inviter = makeClient(prefix: "🍄 Inviter")
inviter = makeClient(prefix: "🍄 Inviter")

waitClientsConnected()
}

private func waitClientsConnected() async {
let group = DispatchGroup()
group.enter()
private func waitClientsConnected() {
let expectation = expectation(description: "Wait Clients Connected")
expectation.expectedFulfillmentCount = 2

invitee.socketConnectionStatusPublisher.sink { status in
if status == .connected {
group.leave()
expectation.fulfill()
}
}.store(in: &publishers)

group.enter()
inviter.socketConnectionStatusPublisher.sink { status in
if status == .connected {
group.leave()
expectation.fulfill()
}
}.store(in: &publishers)
group.wait()
return

wait(for: [expectation], timeout: 5)
}

func makeClient(prefix: String) -> ChatClient {
Expand All @@ -47,7 +49,6 @@ final class ChatTests: XCTestCase {
}

func testInvite() async {
await waitClientsConnected()
let inviteExpectation = expectation(description: "invitation expectation")
let inviteeAccount = Account(chainIdentifier: "eip155:1", address: "0x3627523167367216556273151")!
let inviterAccount = Account(chainIdentifier: "eip155:1", address: "0x36275231673672234423f")!
Expand All @@ -59,61 +60,65 @@ final class ChatTests: XCTestCase {
wait(for: [inviteExpectation], timeout: 4)
}

// func testAcceptAndCreateNewThread() async {
// await waitClientsConnected()
// let newThreadInviterExpectation = expectation(description: "new thread on inviting client expectation")
// let newThreadinviteeExpectation = expectation(description: "new thread on invitee client expectation")
// let inviteeAccount = Account(chainIdentifier: "eip155:1", address: "0x3627523167367216556273151")!
// let inviterAccount = Account(chainIdentifier: "eip155:1", address: "0x36275231673672234423f")!
// let pubKey = try! await invitee.register(account: inviteeAccount)
//
// try! await inviter.invite(publicKey: pubKey, peerAccount: inviteeAccount, openingMessage: "opening message", account: inviterAccount)
//
// invitee.invitePublisher.sink { [unowned self] invite in
// Task {try! await invitee.accept(inviteId: invite.id)}
// }.store(in: &publishers)
//
// invitee.newThreadPublisher.sink { _ in
// newThreadinviteeExpectation.fulfill()
// }.store(in: &publishers)
//
// inviter.newThreadPublisher.sink { _ in
// newThreadInviterExpectation.fulfill()
// }.store(in: &publishers)
//
// wait(for: [newThreadinviteeExpectation, newThreadInviterExpectation], timeout: 4)
// }
//
// func testMessage() async {
// await waitClientsConnected()
// let messageExpectation = expectation(description: "message received")
// messageExpectation.expectedFulfillmentCount = 2
// let message = "message"
// let inviteeAccount = Account(chainIdentifier: "eip155:1", address: "0x3627523167367216556273151")!
// let inviterAccount = Account(chainIdentifier: "eip155:1", address: "0x36275231673672234423f")!
// let pubKey = try! await invitee.register(account: inviteeAccount)
// try! await inviter.invite(publicKey: pubKey, peerAccount: inviteeAccount, openingMessage: "opening message", account: inviterAccount)
//
// invitee.invitePublisher.sink { [unowned self] invite in
// Task {try! await invitee.accept(inviteId: invite.id)}
// }.store(in: &publishers)
//
// invitee.newThreadPublisher.sink { [unowned self] thread in
// Task {try! await invitee.message(topic: thread.topic, message: message)}
// }.store(in: &publishers)
//
// inviter.newThreadPublisher.sink { [unowned self] thread in
// Task {try! await inviter.message(topic: thread.topic, message: message)}
// }.store(in: &publishers)
//
// inviter.messagePublisher.sink { _ in
// messageExpectation.fulfill()
// }.store(in: &publishers)
//
// invitee.messagePublisher.sink { _ in
// messageExpectation.fulfill()
// }.store(in: &publishers)
//
// wait(for: [messageExpectation], timeout: 35)
// }
func testAcceptAndCreateNewThread() {
let newThreadInviterExpectation = expectation(description: "new thread on inviting client expectation")
let newThreadinviteeExpectation = expectation(description: "new thread on invitee client expectation")
let inviteeAccount = Account(chainIdentifier: "eip155:1", address: "0x3627523167367216556273151")!
let inviterAccount = Account(chainIdentifier: "eip155:1", address: "0x36275231673672234423f")!

Task(priority: .background) {
let pubKey = try! await invitee.register(account: inviteeAccount)

try! await inviter.invite(publicKey: pubKey, peerAccount: inviteeAccount, openingMessage: "opening message", account: inviterAccount)
}

invitee.invitePublisher.sink { [unowned self] invite in
Task {try! await invitee.accept(inviteId: invite.id)}
}.store(in: &publishers)

invitee.newThreadPublisher.sink { _ in
newThreadinviteeExpectation.fulfill()
}.store(in: &publishers)

inviter.newThreadPublisher.sink { _ in
newThreadInviterExpectation.fulfill()
}.store(in: &publishers)

wait(for: [newThreadinviteeExpectation, newThreadInviterExpectation], timeout: 10)
}

func testMessage() {
let messageExpectation = expectation(description: "message received")
messageExpectation.expectedFulfillmentCount = 4 // expectedFulfillmentCount 4 because onMessage() called on send too

let inviteeAccount = Account(chainIdentifier: "eip155:1", address: "0x3627523167367216556273151")!
let inviterAccount = Account(chainIdentifier: "eip155:1", address: "0x36275231673672234423f")!

Task(priority: .background) {
let pubKey = try! await invitee.register(account: inviteeAccount)
try! await inviter.invite(publicKey: pubKey, peerAccount: inviteeAccount, openingMessage: "opening message", account: inviterAccount)
}

invitee.invitePublisher.sink { [unowned self] invite in
Task {try! await invitee.accept(inviteId: invite.id)}
}.store(in: &publishers)

invitee.newThreadPublisher.sink { [unowned self] thread in
Task {try! await invitee.message(topic: thread.topic, message: "message")}
}.store(in: &publishers)

inviter.newThreadPublisher.sink { [unowned self] thread in
Task {try! await inviter.message(topic: thread.topic, message: "message")}
}.store(in: &publishers)

inviter.messagePublisher.sink { _ in
messageExpectation.fulfill()
}.store(in: &publishers)

invitee.messagePublisher.sink { _ in
messageExpectation.fulfill()
}.store(in: &publishers)

wait(for: [messageExpectation], timeout: 10)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class RelayClientEndToEndTests: XCTestCase {
)
let urlFactory = RelayUrlFactory(socketAuthenticator: socketAuthenticator)
let socket = WebSocket(url: urlFactory.create(host: relayHost, projectId: projectId))

let logger = ConsoleLogger()
let dispatcher = Dispatcher(socket: socket, socketConnectionHandler: ManualSocketConnectionHandler(socket: socket), logger: logger)
return RelayClient(dispatcher: dispatcher, logger: logger, keyValueStorage: RuntimeKeyValueStorage())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

final class ImportInteractor {
private let registerService: RegisterService
private let accountStorage: AccountStorage
Expand Down
2 changes: 1 addition & 1 deletion Sources/WalletConnectSign/Types/Session/WCSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct WCSession: SequenceObject, Equatable {
peerParticipant: Participant,
namespaces: [String: SessionNamespace],
requiredNamespaces: [String: ProposalNamespace],
events: Set<String>,
events: Set<String>,
accounts: Set<Account>,
acknowledged: Bool,
expiry: Int64
Expand Down
1 change: 0 additions & 1 deletion Tests/RelayerTests/DispatcherTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Combine
class WebSocketMock: WebSocketConnecting {
var request: URLRequest = URLRequest(url: URL(string: "wss://relay.walletconnect.com")!)


var onText: ((String) -> Void)?
var onConnect: (() -> Void)?
var onDisconnect: ((Error?) -> Void)?
Expand Down

0 comments on commit 18a07a0

Please sign in to comment.