diff --git a/cabal.project b/cabal.project index 80e42fc652..334e106121 100644 --- a/cabal.project +++ b/cabal.project @@ -12,7 +12,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: 762909ce33c01d71bbabfed156e1e9faeebbedca + tag: f51cf1deacd14aced88652ccfa06a746999e2ac6 source-repository-package type: git diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index 2b168c51ba..7577d1eae5 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."762909ce33c01d71bbabfed156e1e9faeebbedca" = "0jsfi792n84zk6bhfhg138mn0mv6wvvfmm0d6qxmplpb6glcbqaj"; + "https://github.com/simplex-chat/simplexmq.git"."f51cf1deacd14aced88652ccfa06a746999e2ac6" = "1q1lcjbapq0mrz0z99shajn364jf7j2j6gm5qir2h230l5fg6mih"; "https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38"; "https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d"; "https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl"; diff --git a/tests/ChatTests/Direct.hs b/tests/ChatTests/Direct.hs index 54f31ff50f..2e549d9dd1 100644 --- a/tests/ChatTests/Direct.hs +++ b/tests/ChatTests/Direct.hs @@ -298,6 +298,7 @@ testPlanInvitationLinkOwn tmp = alice ##> ("/_connect plan 1 " <> inv) alice <## "invitation link: ok to connect" -- conn_req_inv is forgotten after connection + threadDelay 100000 alice @@@ [("@alice_1", lastChatFeature), ("@alice_2", lastChatFeature)] alice `send` "@alice_2 hi" alice @@ -1068,20 +1069,25 @@ testNegotiateCall = -- alice confirms call by sending WebRTC answer alice ##> ("/_call answer @2 " <> serialize testWebRTCSession) alice <## "ok" + threadDelay 100000 alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "outgoing call: connecting...")]) bob <## "alice continued the WebRTC call" repeatM_ 3 $ getTermLine bob + threadDelay 100000 bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "incoming call: connecting...")]) -- participants can update calls as connected alice ##> "/_call status @2 connected" alice <## "ok" + threadDelay 100000 alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "outgoing call: in progress (00:00)")]) bob ##> "/_call status @2 connected" bob <## "ok" + threadDelay 100000 bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "incoming call: in progress (00:00)")]) -- either party can end the call bob ##> "/_call end @2" bob <## "ok" + threadDelay 100000 bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "incoming call: ended (00:00)")]) alice <## "call with bob ended" alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "outgoing call: ended (00:00)")]) @@ -2290,6 +2296,7 @@ testSwitchContact = alice <## "bob: you started changing address" bob <## "alice changed address for you" alice <## "bob: you changed address" + threadDelay 100000 alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "started changing address..."), (1, "you changed address")]) bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "started changing address for you..."), (0, "changed address for you")]) alice <##> bob @@ -2317,6 +2324,7 @@ testAbortSwitchContact tmp = do bob <## "alice started changing address for you" bob <## "alice changed address for you" alice <## "bob: you changed address" + threadDelay 100000 alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "started changing address..."), (1, "started changing address..."), (1, "you changed address")]) bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "started changing address for you..."), (0, "started changing address for you..."), (0, "changed address for you")]) alice <##> bob @@ -2331,6 +2339,7 @@ testSwitchGroupMember = alice <## "#team: you started changing address for bob" bob <## "#team: alice changed address for you" alice <## "#team: you changed address for bob" + threadDelay 100000 alice #$> ("/_get chat #1 count=100", chat, [(1, e2eeInfoNoPQStr), (0, "connected"), (1, "started changing address for bob..."), (1, "you changed address for bob")]) bob #$> ("/_get chat #1 count=100", chat, groupFeatures <> [(0, "connected"), (0, "started changing address for you..."), (0, "changed address for you")]) alice #> "#team hey" @@ -2362,6 +2371,7 @@ testAbortSwitchGroupMember tmp = do bob <## "#team: alice started changing address for you" bob <## "#team: alice changed address for you" alice <## "#team: you changed address for bob" + threadDelay 100000 alice #$> ("/_get chat #1 count=100", chat, [(1, e2eeInfoNoPQStr), (0, "connected"), (1, "started changing address for bob..."), (1, "started changing address for bob..."), (1, "you changed address for bob")]) bob #$> ("/_get chat #1 count=100", chat, groupFeatures <> [(0, "connected"), (0, "started changing address for you..."), (0, "started changing address for you..."), (0, "changed address for you")]) alice #> "#team hey" @@ -2511,6 +2521,7 @@ testSyncRatchet tmp = alice <## "bob: connection synchronized" bob <## "alice: connection synchronized" + threadDelay 100000 bob #$> ("/_get chat @2 count=3", chat, [(1, "connection synchronization started"), (0, "connection synchronization agreed"), (0, "connection synchronized")]) alice #$> ("/_get chat @2 count=2", chat, [(0, "connection synchronization agreed"), (0, "connection synchronized")]) @@ -2550,6 +2561,7 @@ testSyncRatchetCodeReset tmp = alice <## "bob: connection synchronized" bob <## "alice: connection synchronized" + threadDelay 100000 bob #$> ("/_get chat @2 count=4", chat, [(1, "connection synchronization started"), (0, "connection synchronization agreed"), (0, "security code changed"), (0, "connection synchronized")]) alice #$> ("/_get chat @2 count=2", chat, [(0, "connection synchronization agreed"), (0, "connection synchronized")]) diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 46fedd1b48..3948168dae 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -69,7 +69,7 @@ chatGroupTests = do it "group is known if host contact was deleted" testPlanHostContactDeletedGroupLinkKnown it "own group link" testPlanGroupLinkOwn it "connecting via group link" testPlanGroupLinkConnecting - xit "re-join existing group after leaving" testPlanGroupLinkLeaveRejoin + it "re-join existing group after leaving" testPlanGroupLinkLeaveRejoin describe "group links without contact" $ do it "join via group link without creating contact" testGroupLinkNoContact it "invitees were previously connected as contacts" testGroupLinkNoContactInviteesWereConnected @@ -2578,13 +2578,15 @@ testPlanGroupLinkOwn tmp = testPlanGroupLinkConnecting :: HasCallStack => FilePath -> IO () testPlanGroupLinkConnecting tmp = do - gLink <- withNewTestChatCfg tmp cfg "alice" aliceProfile $ \alice -> do + -- gLink <- withNewTestChatCfg tmp cfg "alice" aliceProfile $ \alice -> do + gLink <- withNewTestChatCfg tmp cfg "alice" aliceProfile $ \a -> withTestOutput a $ \alice -> do alice ##> "/g team" alice <## "group #team is created" alice <## "to add members use /a team or /create link #team" alice ##> "/create link #team" getGroupLink alice "team" GRMember True - withNewTestChatCfg tmp cfg "bob" bobProfile $ \bob -> do + -- withNewTestChatCfg tmp cfg "bob" bobProfile $ \bob -> do + withNewTestChatCfg tmp cfg "bob" bobProfile $ \b -> withTestOutput b $ \bob -> do threadDelay 100000 bob ##> ("/c " <> gLink) @@ -2598,13 +2600,15 @@ testPlanGroupLinkConnecting tmp = do bob <## "group link: connecting, allowed to reconnect" threadDelay 100000 - withTestChatCfg tmp cfg "alice" $ \alice -> do + -- withTestChatCfg tmp cfg "alice" $ \alice -> do + withTestChatCfg tmp cfg "alice" $ \a -> withTestOutput a $ \alice -> do alice <### [ "1 group links active", "#team: group is empty", "bob (Bob): accepting request to join group #team..." ] - withTestChatCfg tmp cfg "bob" $ \bob -> do + -- withTestChatCfg tmp cfg "bob" $ \bob -> do + withTestChatCfg tmp cfg "bob" $ \b -> withTestOutput b $ \bob -> do threadDelay 500000 bob ##> ("/_connect plan 1 " <> gLink) bob <## "group link: connecting" @@ -2621,9 +2625,8 @@ testPlanGroupLinkConnecting tmp = do testPlanGroupLinkLeaveRejoin :: HasCallStack => FilePath -> IO () testPlanGroupLinkLeaveRejoin = testChatCfg2 testCfgGroupLinkViaContact aliceProfile bobProfile $ - \a b -> do - let alice = a {printOutput = True} - bob = b {printOutput = True} + -- \alice bob -> do + \a b -> withTestOutput a $ \alice -> withTestOutput b $ \bob -> do alice ##> "/g team" alice <## "group #team is created" alice <## "to add members use /a team or /create link #team" @@ -2643,6 +2646,8 @@ testPlanGroupLinkLeaveRejoin = bob <## "#team: you joined the group" ] + threadDelay 100000 + bob ##> ("/_connect plan 1 " <> gLink) bob <## "group link: known group #team" bob <## "use #team to send messages" @@ -2651,6 +2656,8 @@ testPlanGroupLinkLeaveRejoin = bob <## "group link: known group #team" bob <## "use #team to send messages" + threadDelay 100000 + bob ##> "/leave #team" concurrentlyN_ [ do @@ -2659,6 +2666,8 @@ testPlanGroupLinkLeaveRejoin = alice <## "#team: bob left the group" ] + threadDelay 100000 + bob ##> ("/_connect plan 1 " <> gLink) bob <## "group link: ok to connect" @@ -3296,6 +3305,7 @@ testGroupSyncRatchet tmp = alice <## "#team bob: connection synchronized" bob <## "#team alice: connection synchronized" + threadDelay 100000 bob #$> ("/_get chat #1 count=3", chat, [(1, "connection synchronization started for alice"), (0, "connection synchronization agreed"), (0, "connection synchronized")]) alice #$> ("/_get chat #1 count=2", chat, [(0, "connection synchronization agreed"), (0, "connection synchronized")]) @@ -3336,6 +3346,7 @@ testGroupSyncRatchetCodeReset tmp = alice <## "#team bob: connection synchronized" bob <## "#team alice: connection synchronized" + threadDelay 100000 bob #$> ("/_get chat #1 count=4", chat, [(1, "connection synchronization started for alice"), (0, "connection synchronization agreed"), (0, "security code changed"), (0, "connection synchronized")]) alice #$> ("/_get chat #1 count=2", chat, [(0, "connection synchronization agreed"), (0, "connection synchronized")]) diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index a8afa05af3..3d92a73313 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -397,6 +397,7 @@ testDeduplicateContactRequests = testChat3 aliceProfile bobProfile cathProfile $ bob ##> ("/c " <> cLink) bob <## "contact address: known contact alice" bob <## "use @alice to send messages" + threadDelay 100000 alice @@@ [("@bob", lastChatFeature)] bob @@@ [("@alice", lastChatFeature), (":2", ""), (":1", "")] bob ##> "/_delete :1" @@ -470,6 +471,7 @@ testDeduplicateContactRequestsProfileChange = testChat3 aliceProfile bobProfile bob ##> ("/c " <> cLink) bob <## "contact address: known contact alice" bob <## "use @alice to send messages" + threadDelay 100000 alice @@@ [("@robert", lastChatFeature)] bob @@@ [("@alice", lastChatFeature), (":3", ""), (":2", ""), (":1", "")] bob ##> "/_delete :1" @@ -488,6 +490,7 @@ testDeduplicateContactRequestsProfileChange = testChat3 aliceProfile bobProfile bob <## "use @alice to send messages" alice <##> bob + threadDelay 100000 alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(1, "hi"), (0, "hey"), (1, "hi"), (0, "hey")]) bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "hi"), (1, "hey"), (0, "hi"), (1, "hey")]) @@ -655,6 +658,7 @@ testPlanAddressOwn tmp = "alice_2 (Alice): contact is connected" ] + threadDelay 100000 alice @@@ [("@alice_1", lastChatFeature), ("@alice_2", lastChatFeature)] alice `send` "@alice_2 hi" alice @@ -1948,21 +1952,29 @@ testGroupPrefsDirectForRole = testChat4 aliceProfile bobProfile cathProfile danP bob <## "#team: cath added dan (Daniel) to the group (connecting...)" bob <## "#team: new member dan is connected" ] - -- dan cannot send direct messages to alice (owner) + + -- dan cannot send direct messages to alice dan ##> "@alice hello alice" dan <## "bad chat command: direct messages not allowed" (alice hello dan" - dan <## "alice (Alice): contact is connected" - -- and now dan can too + alice + <### [ "member #team dan does not have direct connection, creating", + "contact for member #team dan is created", + "sent invitation to connect directly to member #team dan", + WithTime "@dan hello dan" + ] + dan + <### [ "#team alice is creating direct contact alice with you", + WithTime "alice> hello dan" + ] + concurrently_ + (alice <## "dan (Daniel): contact is connected") + (dan <## "alice (Alice): contact is connected") + + -- now dan can send messages to alice dan #> "@alice hi alice" alice <# "dan> hi alice" where diff --git a/tests/ChatTests/Utils.hs b/tests/ChatTests/Utils.hs index a3ee0d5ca8..8c022d5bfd 100644 --- a/tests/ChatTests/Utils.hs +++ b/tests/ChatTests/Utils.hs @@ -298,7 +298,7 @@ itemId i = show $ length chatFeatures + i (@@@) :: HasCallStack => TestCC -> [(String, String)] -> Expectation (@@@) cc res = do - threadDelay 10000 + threadDelay 100000 getChats mapChats cc res mapChats :: [(String, String, Maybe ConnStatus)] -> [(String, String)]