Skip to content

Commit

Permalink
test_: wait for logout/login
Browse files Browse the repository at this point in the history
  • Loading branch information
antdanchenko committed Feb 11, 2025
1 parent 955a948 commit 5774be6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests-functional/clients/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SignalType(Enum):
NODE_READY = "node.ready"
NODE_STARTED = "node.started"
NODE_LOGIN = "node.login"
NODE_LOGOUT = "node.stopped"
MEDIASERVER_STARTED = "mediaserver.started"
WALLET_SUGGESTED_ROUTES = "wallet.suggested.routes"
WALLET_ROUTER_SIGN_TRANSACTIONS = "wallet.router.sign-transactions"
Expand Down Expand Up @@ -98,6 +99,10 @@ def wait_for_login(self):
assert not signal["event"]["error"]
return signal

def wait_for_logout(self):
signal = self.wait_for_signal(SignalType.NODE_LOGOUT.value)
return signal

def find_signal_containing_pattern(self, signal_type, event_pattern, timeout=20):
start_time = time.time()
while True:
Expand Down
1 change: 1 addition & 0 deletions tests-functional/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class MessengerTestCase(NetworkConditionTestCase):
SignalType.MESSAGES_NEW.value,
SignalType.MESSAGE_DELIVERED.value,
SignalType.NODE_LOGIN.value,
SignalType.NODE_LOGOUT.value
]

@pytest.fixture(scope="function", autouse=False)
Expand Down
3 changes: 3 additions & 0 deletions tests-functional/tests/test_waku_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ def setup_two_nodes(self, request):
key_uid = user.node_login_event["event"]["account"]["key-uid"]
user.wakuext_service.set_light_client(True)
user.logout()
user.wait_for_logout()
user.login(key_uid)
user.prepare_wait_for_signal("node.login", 1)
user.wait_for_login()

0 comments on commit 5774be6

Please sign in to comment.