示例#1
0
 def test_one_to_one_chat(self):
     device_1, device_2 = ConsoleView(self.driver_1), ConsoleView(
         self.driver_2)
     for device in device_1, device_2:
         user_flow.create_user(device)
     device_1.back_button.click()
     device_2.back_button.click()
     device_1_chat = device_1.get_chat_view()
     device_2_chat = device_2.get_chat_view()
     device_1_public_key = user_flow.get_public_key(device_1_chat)
     user_flow.add_contact(device_2_chat, device_1_public_key)
     message_1 = 'SOMETHING'
     message_2 = 'another SOMETHING'
     user_d1_name = device_2_chat.user_name_text.text
     device_2_chat.chat_message_input.send_keys(message_1)
     device_2_chat.send_message_button.click()
     device_1_chat.back_button.click()
     device_1_chat.find_full_text(message_1)
     one_to_one_chat_d1 = device_1_chat.element_by_text(message_1, 'button')
     one_to_one_chat_d1.click()
     one_to_one_chat_d2 = device_2_chat.element_by_text(
         user_d1_name, 'button')
     one_to_one_chat_d2.click()
     device_2_chat.chat_message_input.send_keys(message_2)
     device_2_chat.send_message_button.click()
     device_1_chat.find_full_text(message_2)
示例#2
0
 def test_change_profile_name_and_status(self):
     new_status = '#newstatus'
     new_username = '******'
     console_view = ConsoleView(self.driver)
     user_flow.create_user(console_view)
     chats_view = console_view.get_chat_view()
     chats_view.back_button.click()
     profile_drawer = chats_view.profile_button.click()
     profile_view = profile_drawer.profile_icon.click()
     profile_view.user_status_box.click()
     profile_view.user_status_input.clear()
     profile_view.user_status_input.send_keys(new_status)
     profile_view.username_input.clear()
     profile_view.username_input.send_keys(new_username)
     profile_view.save_button.click()
     profile_view.back_button.click()
     chats_view.profile_button.click()
     sign_in_view = profile_drawer.switch_users_button.click()
     user = sign_in_view.element_by_text(new_username, 'button')
     user.click()
     sign_in_view.password_input.send_keys('qwerty1234')
     sign_in_view.sign_in_button.click()
     chats_view.find_full_text('Chats', 60)
     chats_view.profile_button.click()
     for text in new_status + ' ', new_username:
         chats_view.find_full_text(text, 5)
示例#3
0
 def test_one_to_one_chat_between(self, network):
     device_1, device_2 = ConsoleView(self.driver_1), ConsoleView(
         self.driver_2)
     for device in device_1, device_2:
         user_flow.create_user(device)
     device_1.back_button.click()
     device_1_chats = device_1.get_chat_view()
     device_1_profile_drawer = device_1_chats.profile_button.click()
     device_1_profile_view = device_1_profile_drawer.profile_icon.click()
     device_1_public_key = device_1_profile_view.public_key_text.text
     if network[0] != 'Ropsten with upstream RPC':
         login_d1 = device_1_profile_view.switch_network(network[0])
         login_d1.first_account_button.click()
         login_d1.password_input.send_keys('qwerty1234')
         login_d1.sign_in_button.click()
         login_d1.find_full_text('Chats', 60)
     else:
         device_1_profile_view.back_button.click()
     device_2.back_button.click()
     device_2_chats = device_2.get_chat_view()
     if network[1] != 'Ropsten with upstream RPC':
         device_2_profile_drawer = device_2_chats.profile_button.click()
         device_2_profile_view = device_2_profile_drawer.profile_icon.click(
         )
         device_2_sign_in = device_2_profile_view.switch_network(network[1])
         device_2_sign_in.first_account_button.click()
         device_2_sign_in.password_input.send_keys('qwerty1234')
         device_2_sign_in.sign_in_button.click()
         device_2_sign_in.find_full_text('Chats', 60)
     user_flow.add_contact(device_2_chats, device_1_public_key)
     message_1 = network[0]
     message_2 = network[1]
     user_d1_name = device_2_chats.user_name_text.text
     device_2_chats.chat_message_input.send_keys(message_2)
     device_2_chats.send_message_button.click()
     errors = list()
     try:
         device_1_chats.find_full_text(message_2)
     except TimeoutException:
         errors.append("Message '%s' wasn't received by Device #1")
     one_to_one_chat_d1 = device_1_chats.element_by_text(
         message_2, 'button')
     one_to_one_chat_d1.click()
     one_to_one_chat_d2 = device_2_chats.element_by_text(
         user_d1_name, 'button')
     one_to_one_chat_d2.click()
     device_1_chats.chat_message_input.send_keys(message_1)
     device_1_chats.send_message_button.click()
     try:
         device_2_chats.find_full_text(message_1)
     except TimeoutException:
         errors.append("Message '%s' wasn't received by Device #2")
     if errors:
         msg = ''
         for error in errors:
             msg += (error + '\n')
         pytest.fail(msg, pytrace=False)
示例#4
0
    def test_transaction_send_command(self, test, recipient):
        console_view = ConsoleView(self.driver)
        user_flow.create_user(console_view)
        console_view.back_button.click()
        chats_view = console_view.get_chat_view()
        recipient_address = transaction_users[recipient]['address']
        recipient_key = transaction_users[recipient]['public_key']
        transaction_amount = '0.001'
        sender_address = user_flow.get_address(chats_view)
        chats_view.back_button.click()
        api_requests.get_donate(sender_address)
        initial_balance_recipient = api_requests.get_balance(recipient_address)

        # next 2 lines are bypassing issue #2417
        wallet_view = chats_view.wallet_button.click()
        wallet_view.chats_button.click()

        user_flow.add_contact(chats_view, recipient_key)
        if test == 'group_chat':
            for _ in range(3):
                chats_view.back_button.click()
            user_flow.create_group_chat(
                chats_view, transaction_users[recipient]['username'],
                'trg_%s' % get_current_time())
        else:
            chats_view.element_by_text(
                transaction_users[recipient]['username'], 'button').click()
        chats_view.send_command.click()
        if test == 'group_chat':
            chats_view.first_recipient_button.click()
            chats_view.send_as_keyevent(transaction_amount)
        else:
            chats_view.send_as_keyevent(transaction_amount)
        chats_view.send_message_button.click()
        send_transaction_view = chats_view.get_send_transaction_view()
        send_transaction_view.sign_transaction_button.wait_for_element(5)
        send_transaction_view.sign_transaction_button.click()
        if test == 'wrong_password':
            send_transaction_view.enter_password_input.send_keys('invalid')
            send_transaction_view.sign_transaction_button.click()
            send_transaction_view.find_full_text('Wrong password', 20)
        else:
            send_transaction_view.enter_password_input.send_keys('qwerty1234')
            send_transaction_view.sign_transaction_button.click()
            send_transaction_view.got_it_button.click()
            send_transaction_view.find_full_text(transaction_amount)
            try:
                chats_view.find_full_text('Sent', 10)
            except TimeoutException:
                chats_view.find_full_text('Delivered', 10)
            if test == 'group_chat':
                chats_view.find_full_text(
                    'to  ' + transaction_users[recipient]['username'], 60)
            api_requests.verify_balance_is_updated(initial_balance_recipient,
                                                   recipient_address)
示例#5
0
    def test_group_chat_send_receive_messages_and_remove_user(self):
        device_1, device_2 = ConsoleView(self.driver_1), \
                             ConsoleView(self.driver_2)
        for device in device_1, device_2:
            user_flow.create_user(device)
        device_1.back_button.click()
        device_2.back_button.click()
        device_1_chat = device_1.get_chat_view()
        device_2_chat = device_2.get_chat_view()
        device_1_public_key = user_flow.get_public_key(device_1_chat)
        user_flow.add_contact(device_2_chat, device_1_public_key)
        device_1_user_name = device_2_chat.user_name_text.text
        for _ in range(3):
            device_2.back_button.click()
        chat_name = 'new_chat'
        message_1 = 'first SOMETHING'
        message_2 = 'second SOMETHING'
        message_3 = 'third SOMETHING'
        user_flow.create_group_chat(device_2_chat, device_1_user_name,
                                    chat_name)

        # send_and_receive_messages
        device_2_chat.chat_message_input.send_keys(message_1)
        device_2_chat.send_message_button.click()
        device_1.back_button.click()
        device_1_chat = device_1.get_chat_view()
        device_1_chat.find_full_text(message_1)
        group_chat_d1 = device_1_chat.element_by_text(chat_name, 'button')
        group_chat_d1.click()
        device_2_chat.chat_message_input.send_keys(message_2)
        device_2_chat.send_message_button.click()
        device_1_chat.find_full_text(message_2)

        # remove user
        device_2_chat.group_chat_options.click()
        device_2_chat.chat_settings.click()
        for _ in range(2):
            try:
                device_2_chat.user_options.click()
            except (NoSuchElementException, TimeoutException):
                pass
        device_2_chat.remove_button.click()
        device_2_chat.confirm()
        device_2.back_button.click()

        # verify removed user receives no messages
        device_2_chat.chat_message_input.send_keys(message_3)
        device_2_chat.send_message_button.click()
        device_1_chat.find_text_part("removed you from group chat")
        message_text = device_1_chat.element_by_text(message_3, 'text')
        if message_text.is_element_present(20):
            pytest.fail(
                'Message is shown for the user which has been removed from the GroupChat',
                False)
示例#6
0
 def test_wallet_error_messages(self):
     console = ConsoleView(self.driver)
     user_flow.create_user(console)
     chats = console.get_chat_view()
     chats.back_button.click()
     wallet_view = chats.wallet_button.click()
     wallet_view.send_button.click()
     send_transaction = wallet_view.get_send_transaction_view()
     send_transaction.amount_edit_box.send_keys('asd')
     send_transaction.find_full_text('Amount is not a valid number')
     send_transaction.amount_edit_box.send_keys('0,1')
     send_transaction.find_full_text('Insufficient funds')
示例#7
0
    def test_network_switch(self, network):

        console = ConsoleView(self.driver)
        user_flow.create_user(console)
        console.back_button.click()
        chats = console.get_chat_view()
        profile_drawer = chats.profile_button.click()
        profile_view = profile_drawer.profile_icon.click()
        sign_in_view = profile_view.switch_network(network)
        sign_in_view.first_account_button.click()
        sign_in_view.password_input.send_keys('qwerty1234')
        sign_in_view.sign_in_button.click()
        sign_in_view.find_full_text('Chats', 20)
示例#8
0
 def test_recover_access(self):
     console_view = ConsoleView(self.driver)
     user_flow.create_user(console_view)
     chats_view = console_view.get_chat_view()
     chats_view.back_button.click()
     profile_drawer = chats_view.profile_button.click()
     sign_in_view = profile_drawer.switch_users_button.click()
     recover_access_view = sign_in_view.recover_access_button.click()
     recover_access_view.passphrase_input.send_keys(basic_user['passphrase'])
     recover_access_view.password_input.send_keys(basic_user['password'])
     recover_access_view.confirm_recover_access.click()
     recovered_user = sign_in_view.element_by_text(basic_user['username'], 'button')
     recovered_user.click()
     sign_in_view.password_input.send_keys(basic_user['password'])
     sign_in_view.sign_in_button.click()
     console_view.find_full_text('Chats', 60)
     if basic_user['password'] in str(console_view.logcat):
         pytest.fail('Password in logcat!!!', pytrace=False)
示例#9
0
 def test_sign_in(self, verification):
     verifications = {"valid":
                          {"input": "qwerty1234",
                           "outcome": "Chats"},
                      "invalid":
                          {"input": "12345ewq",
                           "outcome": "Wrong password"}}
     console_view = ConsoleView(self.driver)
     user_flow.create_user(console_view)
     chats_view = console_view.get_chat_view()
     chats_view.back_button.click()
     profile_drawer = chats_view.profile_button.click()
     sign_in_view = profile_drawer.switch_users_button.click()
     sign_in_view.first_account_button.click()
     sign_in_view.password_input.send_keys(verifications[verification]['input'])
     sign_in_view.sign_in_button.click()
     console_view.find_full_text(verifications[verification]["outcome"], 60)
     if verifications[verification]["input"] in str(console_view.logcat):
         pytest.fail('Password in logcat!!!', pytrace=False)
示例#10
0
 def test_new_profile_name_and_status_on_discover(self):
     device_1, device_2 = ConsoleView(self.driver_1), ConsoleView(
         self.driver_2)
     for device in device_1, device_2:
         user_flow.create_user(device)
     device_1.back_button.click()
     device_2.back_button.click()
     device_1_chat, device_2_chat = device_1.get_chat_view(
     ), device_2.get_chat_view()
     device_2_public_key = user_flow.get_public_key(device_2_chat)
     user_flow.add_contact(device_1_chat, device_2_public_key)
     device_1_chat.chat_message_input.send_keys('test123')
     device_1_chat.send_message_button.click()
     device_1_chat.back_button.click()
     device_2_chat.back_button.click()
     new_chat_d2 = device_2_chat.element_by_text('test123', 'button')
     new_chat_d2.click()
     device_2_chat.add_to_contacts.click()
     for _ in range(2):
         device_1_chat.back_button.click()
     device_2_chat.back_button.click()
     device_1_profile_drawer = device_1_chat.profile_button.click()
     device_2_profile_drawer = device_2_chat.profile_button.click()
     device_1_profile, device_2_profile = \
         device_1_profile_drawer.profile_icon.click(), device_2_profile_drawer.profile_icon.click()
     users_details = user_flow.get_new_username_and_status(
         device_1_profile, device_2_profile)
     device_1_profile.back_button.click()
     device_2_profile.back_button.click()
     device_1_discover = device_1_profile.discover_button.click()
     device_2_discover = device_2_profile.discover_button.click()
     for device in device_1_discover, device_2_discover:
         device.all_popular.click()
         for k in users_details:
             device.find_full_text(users_details[k]['name'])
             device.find_full_text(' ' + users_details[k]['status'])
         device.back_button.click()
         device.all_recent.click()
         for k in users_details:
             device.find_full_text(users_details[k]['name'])
             device.find_full_text(users_details[k]['status'] + ' ')