-
Notifications
You must be signed in to change notification settings - Fork 992
/
Copy pathtest_1_1_public_chats.py
1436 lines (1259 loc) · 81.8 KB
/
test_1_1_public_chats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import random
import time
import emoji
import pytest
from _pytest.outcomes import Failed
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from tests import marks, common_password, run_in_parallel, transl
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_message_sender
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="four_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_STT_3']
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'], enable_notifications=True)
self.home_2 = self.device_2.create_user()
for home in self.home_1, self.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
self.recipient_public_key, self.recipient_username = self.home_2.get_public_key(
return_username=True)
self.wallet_1, self.wallet_2 = self.home_1.wallet_button.click(), self.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (self.wallet_1, self.wallet_2)]
self.chat_1 = self.home_1.add_contact(self.recipient_public_key)
self.chat_1.send_message("hello!")
self.account_name_1 = self.wallet_1.status_account_name
@marks.testrail_id(6253)
def test_1_1_chat_command_send_tx_eth_outgoing_tx_push(self):
amount = self.chat_1.get_unique_amount()
self.home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.recipient_username).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = self.chat_1.get_outgoing_transaction(self.account_name_1)
if not sender_message.is_element_displayed():
self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender')
sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
chat_2 = self.home_2.get_chat(self.sender['username']).click()
receiver_message = chat_2.get_incoming_transaction(self.account_name_1)
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed():
self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
self.home_2.just_fyi('Accept and share address for sender and receiver')
for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address):
if not option.is_element_displayed():
self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(
self.account_name_1).is_element_displayed():
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted)
self.home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(20)
send_bottom_sheet = sender_message.sign_and_send.click()
send_bottom_sheet.next_button.click()
send_bottom_sheet.sign_transaction()
updated_timestamp_sender = sender_message.timestamp_command_message.text
if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction")
self.chat_1.wallet_button.click()
self.wallet_1.find_transaction_in_history(amount=amount)
[wallet.put_app_to_background() for wallet in (self.wallet_1, self.wallet_2)]
self.device_1.open_notification_bar()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount)
pn = self.home_1.get_pn('You sent %s ETH' % amount)
if pn:
pn.click()
if not self.wallet_1.transaction_history_button.is_element_displayed():
self.errors.append('Was not redirected to transaction history after tapping on PN')
else:
self.home_1.click_system_back_button()
self.home_1.status_in_background_button.click_if_shown()
self.wallet_1.home_button.click(desired_view="chat")
self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
chat_2.status_in_background_button.click()
chat_2.wallet_button.click()
self.wallet_2.wait_balance_is_changed()
self.wallet_2.find_transaction_in_history(amount=amount)
self.wallet_2.home_button.click()
self.home_2.get_chat(self.sender['username']).click()
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)]
# TODO: should be added PNs for receiver after getting more stable feature (rechecked 04.10.22, valid)
self.errors.verify_no_errors()
@marks.testrail_id(6265)
def test_1_1_chat_command_decline_eth_push_changing_state(self):
[home.driver.background_app(3) for home in (self.home_1, self.home_2)]
self.home_1.home_button.double_click()
self.home_1.get_chat(username=self.recipient_username).click()
self.home_1.just_fyi('Decline transaction before sharing address and check that state is changed')
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
amount = self.chat_1.get_unique_amount()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
self.home_1.click_system_home_button()
self.home_2.home_button.double_click()
chat_2 = self.home_2.get_chat(self.sender['username']).click()
chat_2_receiver_message = chat_2.get_incoming_transaction()
chat_2_receiver_message.decline_transaction.click()
self.home_1.open_notification_bar()
self.home_1.element_by_text_part('Request address for transaction declined').wait_and_click()
[message.transaction_status.wait_for_element_text(message.declined) for message in
(chat_1_sender_message, chat_2_receiver_message)]
self.home_1.just_fyi('Decline transaction request and check that state is changed')
request_amount = self.chat_1.get_unique_amount()
self.chat_1.commands_button.click()
request_transaction = self.chat_1.request_command.click()
request_transaction.amount_edit_box.set_value(request_amount)
request_transaction.confirm()
request_transaction.request_transaction_button.click()
chat_1_request_message = self.chat_1.get_incoming_transaction()
chat_2_sender_message = chat_2.get_outgoing_transaction()
chat_2_sender_message.decline_transaction.click()
[message.transaction_status.wait_for_element_text(message.declined) for message in
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()
@marks.testrail_id(6263)
def test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline(self):
[home.driver.background_app(2) for home in (self.home_1, self.home_2)]
asset_name = 'STT'
amount = self.device_1.get_unique_amount()
self.device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
self.home_2.get_back_to_home_view()
self.home_2.wallet_button.click()
self.wallet_2.select_asset(asset_name)
self.wallet_2.home_button.click()
self.home_1.wallet_button.double_click()
initial_amount_stt = self.wallet_1.get_asset_amount_by_name('STT')
self.home_1.driver.close_app()
self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_2 = self.home_2.get_chat(username=self.sender['username']).click()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.get_incoming_transaction()
if not chat_2_request_message.is_element_displayed():
self.drivers[1].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
self.home_1.just_fyi('Check that transaction message is fetched from offline and sign transaction')
self.device_1.driver.launch_app()
self.device_1.sign_in()
self.home_1.connection_offline_icon.wait_for_invisibility_of_element(30)
self.home_1.get_chat(self.recipient_username).click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
if not chat_1_sender_message.is_element_displayed():
self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.address_received)
send_message = chat_1_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction()
self.home_2.just_fyi('Check that transaction message is updated with new status after offline')
[chat.toggle_airplane_mode() for chat in (self.chat_1, chat_2)]
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, token=True)
for home in (self.home_1, self.home_2):
home.toggle_airplane_mode()
home.home_button.double_click()
home.connection_offline_icon.wait_for_invisibility_of_element(100)
self.home_2.get_chat(self.sender['username']).click()
self.home_1.get_chat(self.recipient_username).click()
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=120) for message in
(chat_1_sender_message, chat_2_request_message)]
self.home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
self.home_1.wallet_button.click()
self.wallet_1.wait_balance_is_changed('STT', initial_amount_stt)
self.wallet_1.find_transaction_in_history(amount=amount, asset=asset_name)
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="one_2")
@marks.critical
class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1 = self.device_1.create_user(enable_notifications=True)
self.home_2 = self.device_2.create_user(enable_notifications=True)
self.profile_1 = self.home_1.profile_button.click()
self.default_username_1 = self.profile_1.default_username_text.text
self.profile_1.home_button.click()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2)
self.chat_1.send_message('hey')
self.home_2.home_button.double_click()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
@marks.testrail_id(6316)
def test_1_1_chat_audio_message_with_push(self):
self.home_2.just_fyi("Put app on background (to check Push notification received for audio message)")
self.home_2.click_system_home_button()
self.home_2.just_fyi("Sending audio message to device who is on background")
self.chat_1.record_audio_message(message_length_in_seconds=65)
if not self.chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
self.drivers[0].fail("Exceeded 1 min limit of recording time.")
self.chat_1.ok_button.click()
if self.chat_1.audio_message_recorded_time.text != "0:59":
self.errors.append("Timer exceed 2 minutes")
self.chat_1.send_message_button.click()
self.device_2.open_notification_bar()
chat_2 = self.home_2.click_upon_push_notification_by_text("Audio")
listen_time = 5
self.device_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
chat_2.play_audio_message(listen_time)
if chat_2.audio_message_in_chat_timer.text not in ("00:05", "00:06", "00:07", "00:08"):
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
self.errors.verify_no_errors()
@marks.testrail_id(5387)
# think about priority of this
def test_1_1_chat_delete_via_delete_button_relogin(self):
self.home_1.driver.quit()
self.home_2.home_button.click()
self.home_2.get_chat(username=self.default_username_1).click()
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.chat_2.delete_chat()
self.chat_2.get_back_to_home_view()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % self.default_username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
self.errors.append(
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.default_username_1)
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="two_2")
@marks.critical
class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_2']
self.nick = "FFOO_brak!1234"
self.message = self.device_1.get_random_message()
self.pub_chat_name = self.device_1.get_random_chat_name()
self.home_1 = self.device_1.recover_access(self.sender['passphrase'], keycard=True)
self.home_2 = self.device_2.create_user()
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.privacy_and_security_button.click()
self.profile_2.backup_recovery_phrase_button.click()
recovery_phrase = self.profile_2.backup_recovery_phrase()
self.recovery_phrase = ' '.join(recovery_phrase.values())
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(self.nick)
[home.home_button.click() for home in [self.home_1, self.home_2]]
self.home_2.add_contact(self.sender['public_key'])
self.home_2.home_button.click()
[home.join_public_chat(self.pub_chat_name) for home in [self.home_1, self.home_2]]
self.chat_2 = self.home_2.get_chat_view()
self.chat_2.send_message(self.message)
[home.home_button.click() for home in [self.home_1, self.home_2]]
@marks.testrail_id(702186)
def test_keycard_command_send_tx_eth_1_1_chat(self):
self.home_2.get_chat(self.sender['username']).click()
self.chat_2.send_message("hey on kk!")
self.chat_2.home_button.click()
amount = self.chat_1.get_unique_amount()
account_name = self.chat_1.status_account_name
self.chat_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.home_1.get_chat(self.nick).click()
self.chat_1.send_message("hello again!")
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.default_username_2).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.chat_1.driver.fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = self.chat_1.get_outgoing_transaction()
if not sender_message.is_element_displayed():
self.chat_1.driver.fail('No message is shown after sending ETH in 1-1 chat for sender')
sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
self.home_2.get_chat(self.sender['username']).click()
receiver_message = self.chat_2.get_incoming_transaction()
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed(30):
self.chat_2.driver.fail('No message about incoming transaction in 1-1 chat is shown for receiver')
receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
self.chat_1.just_fyi('Accept and share address for sender and receiver')
for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address):
if not option.is_element_displayed():
self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(
account_name).is_element_displayed():
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted)
self.chat_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(20)
send_message = sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
updated_timestamp_sender = sender_message.timestamp_command_message.text
if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction")
wallet_1 = self.chat_1.wallet_button.click()
wallet_1.find_transaction_in_history(amount=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
wallet_1.home_button.click(desired_view='chat')
self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
wallet_2 = self.chat_2.wallet_button.click()
wallet_2.find_transaction_in_history(amount=amount)
sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120)
self.errors.verify_no_errors()
@marks.testrail_id(702175)
def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
self.chat_1.just_fyi('check that can mention user with 3-random name in public chat')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat')
chat_element = self.chat_1.chat_element_by_text(self.message)
expected_username = '%s %s' % (self.nick, self.default_username_2)
if chat_element.username.text != expected_username:
self.errors.append('Username %s in public chat does not match expected %s' % (
chat_element.username.text, expected_username))
self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile')
chat_element.member_photo.click()
self.chat_1.profile_add_to_contacts_button.click()
if not self.chat_1.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
self.chat_1.close_button.click()
self.chat_1.just_fyi('check that can mention user with nickname or default username in public chat')
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=self.nick[0:2])
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention '
'suggestions list by nickname!')
self.chat_1.chat_message_input.clear()
for pattern in (self.nick[0:2], self.default_username_2[0:4]):
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=pattern)
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention suggestions '
'list by default username!')
additional_text = 'and more'
self.chat_1.send_as_keyevent(additional_text)
self.chat_1.send_message_button.click()
if not self.chat_1.chat_element_by_text('%s %s' % (self.nick, additional_text)).is_element_displayed():
self.errors.append("Nickname is not resolved on send message")
self.chat_1.get_back_to_home_view()
self.chat_1.just_fyi('check contact list in Profile after setting nickname')
profile_1 = self.chat_1.profile_button.click()
userprofile = profile_1.open_contact_from_profile(self.nick)
if not userprofile.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts' in profile contacts")
profile_1.close_button.click()
profile_1.home_button.double_click()
self.chat_1.just_fyi(
'Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap')
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
if not self.home_1.element_by_text(self.nick).is_element_displayed():
self.home_1.driver.fail('List of contacts below "Start new chat" does not contain added user')
self.home_1.element_by_text(self.nick).click()
if not self.chat_1.chat_message_input.is_element_displayed():
self.chat_1.driver.fail('No redirect to 1-1 chat if tap on Contact below "Start new chat"')
for element in (self.chat_1.chat_message_input, self.chat_1.element_by_text(self.nick)):
if not element.is_element_displayed():
self.errors.append('Expected element is not found in 1-1 after adding user to contacts from profile')
if self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile')
self.chat_1.just_fyi('Remove user from contacts')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.remove_from_contacts.click_until_absense_of_element(self.chat_1.remove_from_contacts)
if self.chat_1.profile_nickname.text != self.nick:
self.errors.append("Nickname is changed after removing user from contacts")
self.chat_1.just_fyi('Check that user is removed from contact list in profile')
self.chat_1.close_button.click()
if not self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is not shown in 1-1 after removing user from contacts')
self.chat_1.profile_button.double_click()
profile_1.contacts_button.click()
if profile_1.element_by_text(self.nick).is_element_displayed():
self.errors.append('Contact is shown in Profile after removing user from contacts')
self.errors.verify_no_errors()
@marks.testrail_id(702188)
@marks.xfail(
reason="flaky; issue when sometimes history is not fetched from offline for public chat, needs investigation")
def test_cellular_settings_on_off_public_chat_fetching_history(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat'
public_1 = self.home_1.join_public_chat(public_chat_name)
public_1.send_message(public_chat_message)
self.home_2.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working')
self.home_2.set_network_to_cellular_only()
self.home_2.mobile_connection_off_icon.wait_for_visibility_of_element(20)
for element in (self.home_2.continue_syncing_button, self.home_2.stop_syncing_button,
self.home_2.remember_my_choice_checkbox):
if not element.is_element_displayed(10):
self.drivers[0].fail(
'Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator)
self.home_2.stop_syncing_button.click()
if not self.home_2.mobile_connection_off_icon.is_element_displayed():
self.drivers[0].fail('No mobile connection OFF icon is shown')
self.home_2.mobile_connection_off_icon.click()
for element in self.home_2.connected_to_n_peers_text, self.home_2.waiting_for_wi_fi:
if not element.is_element_displayed():
self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator)
self.home_2.click_system_back_button()
public_2 = self.home_2.join_public_chat(public_chat_name)
if public_2.chat_element_by_text(public_chat_message).is_element_displayed(30):
self.errors.append("Chat history was fetched with mobile data fetching off")
public_chat_new_message = 'new message'
public_1.send_message(public_chat_new_message)
if not public_2.chat_element_by_text(public_chat_new_message).is_element_displayed(30):
self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off")
self.home_2.just_fyi('set mobile data to "ON"')
self.home_2.home_button.click()
self.home_2.mobile_connection_off_icon.click()
self.home_2.use_mobile_data_switch.wait_and_click(30)
if not self.home_2.connected_to_node_text.is_element_displayed(10):
self.errors.append("Not connected to history node after enabling fetching on mobile data")
self.home_2.click_system_back_button()
self.home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10)
self.home_2.get_chat('#%s' % public_chat_name).click()
if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180):
self.errors.append("Chat history was not fetched with mobile data fetching ON")
self.home_2.just_fyi('check redirect to sync settings by tapping on "Sync" in connection status bottom sheet')
self.home_2.home_button.click()
self.home_2.mobile_connection_on_icon.click()
self.home_2.connection_settings_button.click()
if not self.home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed():
self.errors.append(
"Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
self.home_2.just_fyi("Check default preferences in Sync settings")
profile_1 = self.home_1.get_profile_view()
self.home_1.profile_button.double_click()
profile_1.sync_settings_button.click()
if not profile_1.element_by_translation_id("mobile-network-use-wifi").is_element_displayed():
self.errors.append("Mobile data is enabled by default")
profile_1.element_by_translation_id("mobile-network-use-wifi").click()
if profile_1.ask_me_when_on_mobile_network.text != "ON":
self.errors.append("'Ask me when on mobile network' is not enabled by default")
profile_1.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
profile_1.ask_me_when_on_mobile_network.click()
profile_1.set_network_to_cellular_only()
if profile_1.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
profile_1.just_fyi("Check 'Restore default' setting")
profile_1.element_by_text('Restore Defaults').click()
if profile_1.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_1.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.errors.verify_no_errors()
@marks.testrail_id(702177)
def test_restore_account_migrate_multiaccount_to_keycard_db_saved(self):
self.home_1.driver.quit()
self.home_2.profile_button.double_click()
self.profile_2.logout()
self.device_2.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)")
self.device_2.options_button.click()
self.device_2.manage_keys_and_storage_button.click()
self.device_2.move_keystore_file_option.click()
self.device_2.enter_seed_phrase_next_button.click()
self.device_2.seedphrase_input.set_value(self.recovery_phrase)
self.device_2.choose_storage_button.click()
self.device_2.keycard_required_option.click()
self.device_2.confirm_button.click()
self.device_2.migration_password_input.set_value(common_password)
self.device_2.confirm_button.click()
from views.keycard_view import KeycardView
keycard = KeycardView(self.device_2.driver)
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not self.device_2.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
self.device_2.ok_button.click()
self.home_2.home_button.wait_for_element(30)
if not self.home_2.element_by_text_part(self.pub_chat_name).is_element_displayed():
self.errors.append("Public chat was removed from home after migration to kk")
self.home_2.get_chat(self.sender['username']).click()
if self.chat_2.add_to_contacts.is_element_displayed():
self.errors.append("User was removed from contacts after migration to kk")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="three_2")
@marks.critical
class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender, self.reciever = transaction_senders['ETH_3'], ens_user
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'])
self.home_2 = self.device_2.recover_access(ens_user['passphrase'], enable_notifications=True)
self.ens = '@%s' % self.reciever['ens']
self.pub_chat_name = self.home_1.get_random_chat_name()
self.chat_1 = self.home_1.join_public_chat(self.pub_chat_name)
self.chat_2 = self.home_2.join_public_chat(self.pub_chat_name)
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.connect_existing_ens(self.reciever['ens'])
self.home_1.add_contact(self.reciever['ens'])
self.home_2.home_button.click()
self.home_2.add_contact(self.sender['public_key'])
# To avoid activity centre for restored users
[chat.send_message("hey!") for chat in (self.chat_1, self.chat_2)]
self.home_1.just_fyi("Close the ENS banner")
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
[home.ens_banner_close_button.click_if_shown() for home in (self.home_1, self.home_2)]
@marks.testrail_id(702152)
def test_ens_purchased_in_profile(self):
self.home_2.profile_button.double_click()
ens_name_after_adding = self.profile_2.default_username_text.text
if ens_name_after_adding != '@%s' % ens_user['ens']:
self.errors.append('ENS name is not shown as default in user profile after adding, "%s" instead' %
ens_name_after_adding)
self.home_2.just_fyi('check ENS name wallet address and public key')
self.home_2.element_by_text(self.reciever['ens']).click()
self.home_2.element_by_text(self.reciever['ens']).click()
for text in (self.reciever['address'].lower(), self.reciever['public_key']):
if not self.home_2.element_by_text_part(text).is_element_displayed(40):
self.errors.append('%s text is not shown' % text)
self.home_2.profile_button.double_click()
self.home_2.just_fyi('check ENS name is shown on share my profile window')
self.profile_2.share_my_profile_button.click()
if self.profile_2.ens_name_in_share_chat_key_text.text != '%s' % ens_user['ens']:
self.errors.append('No ENS name is shown on tapping on share icon in Profile')
self.profile_2.close_share_popup()
self.errors.verify_no_errors()
@marks.testrail_id(702153)
def test_ens_command_send_tx_eth_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
wallet_1 = self.home_1.wallet_button.click()
wallet_1.wait_balance_is_changed()
wallet_1.home_button.click()
self.home_1.get_chat(self.ens).click()
self.chat_1.commands_button.click()
amount = self.chat_1.get_unique_amount()
self.chat_1.just_fyi("Check sending assets to ENS name from sender side")
send_message = self.chat_1.send_command.click()
send_message.amount_edit_box.set_value(amount)
send_message.confirm()
send_message.next_button.click()
from views.send_transaction_view import SendTransactionView
send_transaction = SendTransactionView(self.drivers[0])
send_transaction.ok_got_it_button.click()
send_transaction.sign_transaction()
chat_1_sender_message = self.chat_1.get_outgoing_transaction(transaction_value=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
self.chat_2.just_fyi("Check that message is fetched for receiver")
self.home_2.get_chat(self.sender['username']).click()
chat_2_reciever_message = self.chat_2.get_incoming_transaction(transaction_value=amount)
chat_2_reciever_message.transaction_status.wait_for_element_text(chat_2_reciever_message.confirmed,
wait_time=60)
@marks.testrail_id(702155)
def test_ens_mention_nickname_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi('Mention user by ENS in 1-1 chat')
message, message_ens_owner = '%s hey!' % self.ens, '%s hey!' % self.reciever['ens']
self.home_1.get_chat(self.ens).click()
self.chat_1.send_message(message)
self.home_1.just_fyi('Set nickname and mention user by nickname in 1-1 chat')
russian_nickname = 'МОЙ дорогой ДРУх'
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(russian_nickname)
self.chat_1.select_mention_from_suggestion_list(russian_nickname + ' ' + self.ens)
self.chat_1.just_fyi('Check that nickname is shown in preview for 1-1 chat')
updated_message = '%s hey!' % russian_nickname
self.chat_1.home_button.double_click()
if not self.chat_1.element_by_text(updated_message).is_element_displayed():
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
self.home_1.get_chat(russian_nickname).click()
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
self.chat_1.chat_element_by_text(updated_message).click()
if not self.chat_1.profile_block_contact_button.is_element_displayed():
self.errors.append(
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
else:
self.chat_1.profile_send_message_button.click()
self.chat_2.just_fyi("Check message with mention for ENS owner")
self.home_2.get_chat(self.sender['username']).click()
if not self.chat_2.chat_element_by_text(message_ens_owner).is_element_displayed():
self.errors.append('Expected %s message is not shown for ENS owner' % message_ens_owner)
self.chat_1.just_fyi('Check if after deleting nickname ENS is shown again')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.profile_nickname_button.click()
self.chat_1.nickname_input_field.clear()
self.chat_1.element_by_text('Done').click()
self.chat_1.close_button.click()
if self.chat_1.user_name_text.text != self.ens:
self.errors.append("Username '%s' is not updated to ENS '%s' after deleting nickname" %
(self.chat_1.user_name_text.text, self.ens))
self.errors.verify_no_errors()
@marks.testrail_id(702156)
def test_ens_mention_push_highlighted_public_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
text = "From ENS name user!"
self.chat_2.send_message(text)
self.chat_2.home_button.click()
self.home_2.put_app_to_background()
self.home_2.open_notification_bar()
self.home_1.just_fyi('check that can mention user with ENS name')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.wait_ens_name_resolved_in_chat(message=text, username_value='@%s' % self.reciever['ens'])
self.chat_1.select_mention_from_suggestion_list(self.reciever['ens'])
if self.chat_1.chat_message_input.text != self.ens + ' ':
self.errors.append(
'ENS username is not resolved in chat input after selecting it in mention suggestions list!')
self.chat_1.send_message_button.click()
self.home_2.just_fyi(
'check that PN is received and after tap you are redirected to chat, mention is highligted')
pn = self.home_2.get_pn(self.reciever['username'])
if pn:
pn.click()
else:
self.errors.append('No PN on mention in public chat! ')
self.home_2.click_system_back_button(2)
if self.home_2.element_starts_with_text(self.reciever['ens']).is_element_differs_from_template('ment_new_1.png',
2):
self.errors.append('Mention is not highlighted!')
self.errors.verify_no_errors()
@marks.testrail_id(702157)
def test_sticker_1_1_public_chat_mainnet(self):
self.home_2.status_in_background_button.click_if_shown()
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
profile_2 = self.home_2.profile_button.click()
profile_2.switch_network()
self.home_2.just_fyi('Check that can use purchased stickerpack on Mainnet')
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
self.chat_2.install_sticker_pack_by_name('Tozemoon')
self.chat_2.sticker_icon.click()
if not self.chat_2.chat_item.is_element_displayed():
self.errors.append('Cannot use purchased stickers')
self.home_2.profile_button.click()
profile_2.switch_network('Goerli with upstream RPC')
self.home_1.just_fyi('Install free sticker pack and use it in 1-1 chat on Goerli')
self.home_1.get_chat(self.ens).click()
self.chat_1.chat_message_input.clear()
self.chat_1.install_sticker_pack_by_name()
self.chat_1.sticker_icon.click()
if not self.chat_1.sticker_message.is_element_displayed():
self.errors.append('Sticker was not sent')
self.chat_1.swipe_right()
if not self.chat_1.sticker_icon.is_element_displayed():
self.errors.append('Sticker is not shown in recently used list')
self.chat_1.get_back_to_home_view()
self.home_1.just_fyi('Send stickers in public chat from Recent')
self.home_1.join_public_chat(self.home_1.get_random_chat_name())
self.chat_1.show_stickers_button.click()
self.chat_1.sticker_icon.click()
if not self.chat_1.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent from Recent')
# self.home_2.just_fyi('Check that can install stickers by tapping on sticker message')
# TODO: disabled because of #13683 (rechecked 04.10.22, valid)
self.home_2.home_button.double_click()
self.home_2.get_chat(self.sender['username']).click()
# self.chat_2.chat_item.click()
# self.chat_2.element_by_text_part('Free').wait_and_click(40)
# if self.chat_2.element_by_text_part('Free').is_element_displayed():
# self.errors.append('Stickerpack was not installed')
self.chat_2.just_fyi('Check that can navigate to another user profile via long tap on sticker message')
# self.chat_2.close_sticker_view_icon.click()
self.chat_2.chat_item.long_press_element()
self.chat_2.element_by_text('View Details').click()
self.chat_2.profile_send_message_button.wait_and_click()
self.errors.verify_no_errors()
@marks.testrail_id(702158)
def test_start_new_chat_public_key_validation(self):
[home.get_back_to_home_view() for home in (self.home_1, self.home_2)]
self.home_2.driver.quit()
public_key = basic_user['public_key']
self.home_1.plus_button.click()
chat = self.home_1.start_new_chat_button.click()
self.home_1.just_fyi("Validation: invalid public key and invalid ENS")
for invalid_chat_key in (basic_user['public_key'][:-1], ens_user_message_sender['ens'][:-2]):
chat.public_key_edit_box.clear()
chat.public_key_edit_box.set_value(invalid_chat_key)
chat.confirm()
if not self.home_1.element_by_translation_id("profile-not-found").is_element_displayed():
self.errors.append('Error is not shown for invalid public key')
self.home_1.just_fyi("Check that valid ENS is resolved")
chat.public_key_edit_box.clear()
chat.public_key_edit_box.set_value(ens_user_message_sender['ens'])
resolved_ens = '%s.stateofus.eth' % ens_user_message_sender['ens']
if not chat.element_by_text(resolved_ens).is_element_displayed(10):
self.errors.append('ENS name is not resolved after pasting chat key')
self.home_1.close_button.click()
self.home_1.just_fyi("Check that can paste public key from keyboard and start chat")
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
chat.send_message(public_key)
chat.copy_message_text(public_key)
chat.back_button.click()
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
chat.public_key_edit_box.paste_text_from_clipboard()
if chat.public_key_edit_box.text != public_key:
self.errors.append('Public key is not pasted from clipboard')
if not chat.element_by_text(basic_user['username']).is_element_displayed():
self.errors.append('3 random-name is not resolved after pasting chat key')
self.home_1.just_fyi('My_profile button at Start new chat view opens own QR code with public key pop-up')
self.home_1.my_profile_on_start_new_chat_button.click()
account = self.home_1.get_profile_view()
if not (account.public_key_text.is_element_displayed() and account.share_button.is_element_displayed()
and account.qr_code_image.is_element_displayed()):
self.errors.append('No self profile pop-up data displayed after My_profile button tap')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="new_one_2")
@marks.new_ui_critical
class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.username_1, self.username_2 = 'sender', 'receiver'
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}),
(self.device_2.create_user, {'enable_notifications': True,
'username': self.username_2}))))
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.homes = (self.home_1, self.home_2)
self.profile_1, self.profile_2 = (home.get_profile_view() for home in self.homes)
self.public_key_2 = self.home_2.get_public_key()
self.profile_1.just_fyi("Sending contact request via Profile > Contacts")
for home in (self.home_1, self.home_2):
home.click_system_back_button_until_element_is_shown()
home.chats_tab.click()
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2)
self.home_2.just_fyi("Accepting contact request from activity centre")
self.home_2.handle_contact_request(self.username_1)
self.profile_1.just_fyi("Sending message to contact via Messages > Recent")
self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1.send_message('hey')
self.home_2.click_system_back_button_until_element_is_shown()
self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.message_1, self.message_2, self.message_3, self.message_4 = \
"Message 1", "Message 2", "Message 3", "Message 4"
@marks.testrail_id(702730)
def test_1_1_chat_message_reaction(self):
message_from_sender = "Message sender"
self.device_1.just_fyi("Sender start 1-1 chat, set 'thumbs-up' emoji and check counter")
self.chat_1.send_message(message_from_sender)
self.chat_1.chat_element_by_text(message_from_sender).wait_for_sent_state(120)
self.chat_1.set_reaction(message_from_sender)
message_sender = self.chat_1.chat_element_by_text(message_from_sender)
message_sender.emojis_below_message().wait_for_element_text(1)
self.device_2.just_fyi(
"Receiver also sets 'thumbs-up' emoji and verifies counter on received message in 1-1 chat")
message_receiver = self.chat_2.chat_element_by_text(message_from_sender)
message_receiver.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1, 90)
self.chat_2.add_remove_same_reaction(message_from_sender)
message_receiver.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2)
message_sender.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2, 90)
self.device_2.just_fyi(
"Receiver removes 'thumbs-up' emoji and verify that counter will decrease for both users")
self.chat_2.add_remove_same_reaction(message_from_sender)
message_receiver.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
message_sender.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1, 90)
self.device_2.just_fyi("Receiver sets another reaction ('love'). Check it's shown for both sender and receiver")
self.chat_2.set_reaction(message_from_sender, emoji="love")
message_receiver.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
message_sender.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1, 90)
message_receiver.emojis_below_message(emoji="love").wait_for_element_text(1)
message_sender.emojis_below_message(emoji="love").wait_for_element_text(1, 90)
self.device_1.just_fyi("Sender votes for 'love' reaction. Check reactions counters")
self.chat_1.add_remove_same_reaction(message_from_sender, emoji="love")
message_receiver.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
message_sender.emojis_below_message(emoji="thumbs-up").wait_for_element_text(1)
message_receiver.emojis_below_message(emoji="love").wait_for_element_text(2, 90)
message_sender.emojis_below_message(emoji="love").wait_for_element_text(2)
self.device_1.just_fyi("Check emojis info")
message_sender.emojis_below_message(emoji="love").long_press_until_element_is_shown(
self.chat_1.authors_for_reaction(emoji="love"))
if not self.chat_1.user_list_element_by_name(
self.username_1).is_element_displayed() or not self.chat_1.user_list_element_by_name(
self.username_2).is_element_displayed():
self.errors.append("Incorrect users are shown for 'love' reaction.")
self.chat_1.authors_for_reaction(emoji="thumbs-up").click()
if not self.chat_1.user_list_element_by_name(
self.username_1).is_element_displayed() or self.chat_1.user_list_element_by_name(
self.username_2).is_element_displayed():
self.errors.append("Incorrect users are shown for 'thumbs-up' reaction.")
self.chat_1.driver.press_keycode(4)
self.errors.verify_no_errors()
@marks.testrail_id(702782)
def test_1_1_chat_emoji_send_reply_and_open_link(self):
for chat in self.chat_1, self.chat_2:
element = chat.chat_message_input
if not element.is_element_displayed():
chat.click_system_back_button_until_element_is_shown(element)
self.home_1.just_fyi("Check that can send emoji in 1-1 chat")
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
self.chat_1.send_message(emoji.emojize(emoji_name))
for chat in self.chat_1, self.chat_2:
if not chat.chat_element_by_text(emoji_unicode).is_element_displayed():
self.errors.append('Message with emoji was not sent or received in 1-1 chat')
self.chat_1.quote_message(emoji_unicode)
actual_text = self.chat_1.quote_username_in_message_input.text
if actual_text != "You":
self.errors.append(
"'You' is not displayed in reply quote snippet replying to own message, '%s' instead" % actual_text)
self.chat_1.just_fyi("Clear quote and check there is not snippet anymore")
self.chat_1.cancel_reply_button.click()
if self.chat_1.cancel_reply_button.is_element_displayed():
self.errors.append("Message quote kept in public chat input after it was cancelled")
self.chat_1.just_fyi("Send reply")
self.chat_1.quote_message(emoji_unicode)
reply_to_message_from_sender = "hey, reply"
self.chat_1.send_message(reply_to_message_from_sender)
self.chat_1.just_fyi("Receiver verifies received reply...")
if self.chat_2.chat_element_by_text(reply_to_message_from_sender).replied_message_text != emoji_unicode:
self.errors.append("No reply received in 1-1 chat")
else:
self.chat_2.just_fyi("Device 2 sets a reaction on the message reply. Device 1 checks the reaction")
self.chat_1.set_reaction(reply_to_message_from_sender)
try:
self.chat_1.chat_element_by_text(
reply_to_message_from_sender).emojis_below_message().wait_for_element_text(1)
except Failed:
self.errors.append("Reply message reaction is not shown for the sender")
self.home_1.just_fyi("Check that link can be opened and replied from 1-1 chat")
reply = 'reply to link'
url_message = 'Test with link: https://status.im/ here should be nothing unusual.'
self.chat_1.send_message(url_message)
self.chat_2.chat_element_by_text(url_message).wait_for_element(20)
self.chat_2.quote_message(url_message)
self.chat_2.send_message(reply)
replied_message = self.chat_1.chat_element_by_text(reply)
if replied_message.replied_message_text != url_message:
self.errors.append("Reply for '%s' not present in message received in public chat" % url_message)
self.chat_2.just_fyi("Device 2 sets a reaction on the message with a link. Device 1 checks the reaction")
self.chat_2.set_reaction(url_message)
try:
self.chat_1.chat_element_by_text(url_message).emojis_below_message().wait_for_element_text(1)
except Failed:
self.errors.append("Link message reaction is not shown for the sender")
self.home_2.just_fyi("Check 'Open in Status' option")
url_message = 'http://status.im'
self.chat_1.send_message(url_message)
try:
element = self.chat_2.chat_view_element_starts_with_text(url_message)
element.wait_for_visibility_of_element(120)
element.click_inside_element_by_coordinate(0.2, 0.5)
web_view = self.chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
except TimeoutException:
self.errors.append("Message with URL was not received")
self.errors.verify_no_errors()
@marks.xfail(reason="Pin feature is in development", run=False)
@marks.testrail_id(702731)
def test_1_1_chat_pin_messages(self):
self.home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
self.chat_2.jump_to_card_by_text(self.username_1)
self.chat_1.send_message(self.message_1)
self.chat_1.send_message(self.message_2)
self.chat_1.chat_element_by_text(self.message_1).wait_for_status_to_be("Delivered")