Exemplo n.º 1
0
    def test_change_profile_name_and_status(self):
        home = HomeView(self.driver)
        set_password_as_new_user(home)
        chats = home.get_chats()
        chats.back_button.click()
        chats.profile_button.click()
        profile = chats.profile_icon.click()

        new_status = '#newstatus'
        new_username = '******'

        profile.user_status_box.click()
        profile.user_status_input.clear()
        profile.user_status_input.send_keys(new_status)
        profile.username_input.clear()
        profile.username_input.send_keys(new_username)
        profile.save_button.click()
        profile.back_button.click()

        chats.profile_button.click()
        login = chats.switch_users_button.click()
        user = login.element_by_text(new_username, 'button')
        user.click()
        login.password_input.send_keys('qwerty1234')
        login.sign_in_button.click()
        home.find_full_text('Chats', 60)
        chats.profile_button.click()
        for text in new_status + ' ', new_username:
            chats.find_full_text(text, 5)
Exemplo n.º 2
0
    def test_send_transaction_from_daap(self):
        home = HomeView(self.driver)
        recover_access(home,
                       transaction_users['B_USER']['passphrase'],
                       transaction_users['B_USER']['password'],
                       transaction_users['B_USER']['username'])
        chats = home.get_chats()

        address = transaction_users['B_USER']['address']
        initial_balance = chats.get_balance(address)
        contacts = chats.contacts_button.click()
        auction_house = contacts.auction_house_button.click()

        auction_house.toggle_navigation_button.click()
        auction_house.new_auction_button.click()
        auction_house.name_to_reserve_input.click()
        auction_name = time.strftime('%Y-%m-%d-%H-%M')
        auction_house.send_as_keyevent(auction_name)
        auction_house.register_name_button.click()

        chats.sign_transaction_button.wait_for_element(20)
        chats.sign_transaction_button.click()
        chats.enter_password_input.send_keys(transaction_users['B_USER']['password'])
        chats.sign_transaction_button.click()
        chats.got_it_button.click()
        auction_house.find_full_text('You are the proud owner of the name: ' + auction_name, 120)
        chats.verify_balance_is_updated(initial_balance, address)
Exemplo n.º 3
0
    def test_send_transaction_from_wallet(self, test, recipient, sender):
        home = HomeView(self.driver)
        recover_access(home, transaction_users[sender]['passphrase'],
                       transaction_users[sender]['password'],
                       transaction_users[sender]['username'])
        chats = home.get_chats()
        chats.wait_for_syncing_complete()

        recipient_key = transaction_users[recipient]['public_key']
        recipient_address = transaction_users[recipient]['address']
        initial_balance_recipient = chats.get_balance(recipient_address)

        chats.plus_button.click()
        chats.add_new_contact.click()
        chats.public_key_edit_box.send_keys(recipient_key)
        chats.confirm()
        chats.confirm_public_key_button.click()

        for _ in range(2):
            chats.back_button.click()
        wallet = chats.wallet_button.click()
        wallet.send_button.click()
        wallet.amount_edit_box.click()
        amount = '0,0%s' % datetime.now().strftime('%-m%-d%-H%-M%-S')
        wallet.send_as_keyevent(amount)
        wallet.confirm()
        wallet.chose_recipient_button.click()
        wallet.deny_button.click()
        wallet.chose_from_contacts_button.click()
        user_contact = chats.element_by_text(
            transaction_users[recipient]['username'], 'button')
        user_contact.click()

        if test == 'sign_later':
            chats.sign_later_button.click()
            wallet.yes_button.click()
            wallet.ok_button_apk.click()
            tr_view = wallet.transactions_button.click()
            tr_view.unsigned_tab.click()
            tr_view.sign_button.click()

        chats.sign_transaction_button.click()
        chats.enter_password_input.send_keys(
            transaction_users[sender]['password'])
        chats.sign_transaction_button.click()
        chats.got_it_button.click()
        chats.verify_balance_is_updated(initial_balance_recipient,
                                        recipient_address)
        if test == 'sign_later':
            tr_view.history_tab.click()
        else:
            chats.wallet_button.click()
            tr_view = wallet.transactions_button.click()
        transaction = tr_view.transactions_table.find_transaction(
            amount=amount.replace(',', '.'))
        details_view = transaction.click()
        transaction_hash = details_view.get_transaction_hash()
        verify_transaction_in_ropsten(
            address=transaction_users[sender]['address'],
            transaction_hash=transaction_hash)
Exemplo n.º 4
0
    def test_send_transaction(self, test, recipient, sender):
        home = HomeView(self.driver)
        recover_access(home,
                       transaction_users[sender]['passphrase'],
                       transaction_users[sender]['password'],
                       transaction_users[sender]['username'])
        chats = home.get_chats()
        chats.wait_for_syncing_complete()

        sender_address = transaction_users[sender]['address']
        recipient_address = transaction_users[recipient]['address']
        recipient_key = transaction_users[recipient]['public_key']
        initial_balance_recipient = chats.get_balance(recipient_address)

        chats.plus_button.click()
        chats.add_new_contact.click()
        chats.public_key_edit_box.send_keys(recipient_key)
        chats.confirm()
        chats.confirm_public_key_button.click()

        if test == 'group_chat':
            user_name = chats.user_name_text.text
            chats.back_button.click()
            chats.new_group_chat_button.click()
            user_contact = chats.element_by_text(user_name, 'button')
            user_contact.scroll_to_element()
            user_contact.click()
            chats.next_button.click()
            chats.name_edit_box.send_keys('chat_send_transaction')
            chats.save_button.click()

        chats.send_funds_button.click()
        if test == 'group_chat':
            chats.first_recipient_button.click()
            chats.send_as_keyevent('0,1')
        else:
            chats.send_as_keyevent('0,1')
        chats.send_message_button.click()
        chats.sign_transaction_button.wait_for_element(20)
        chats.sign_transaction_button.click()

        if test == 'wrong_password':
            chats.enter_password_input.send_keys('invalid')
            chats.sign_transaction_button.click()
            chats.find_full_text('Wrong password', 20)

        else:
            chats.enter_password_input.send_keys(transaction_users[sender]['password'])
            chats.sign_transaction_button.click()
            chats.got_it_button.click()
            chats.find_full_text('0.1')
            try:
                chats.find_full_text('Sent', 10)
            except NoSuchElementException:
                chats.find_full_text('Delivered', 10)
            if test == 'group_chat':
                chats.find_full_text('to  ' + transaction_users[recipient]['username'], 60)
            chats.verify_balance_is_updated(initial_balance_recipient, recipient_address)
Exemplo n.º 5
0
    def test_wallet_error_messages(self):
        home = HomeView(self.driver)
        set_password_as_new_user(home)
        chats = home.get_chats()
        chats.back_button.click()

        wallet_view = chats.wallet_button.click()
        wallet_view.send_button.click()
        wallet_view.amount_edit_box.send_keys('asd')
        wallet_view.find_full_text('Amount is not a valid number')
        wallet_view.amount_edit_box.send_keys('0,1')
        wallet_view.find_full_text('Insufficient funds')
Exemplo n.º 6
0
 def test_recover_access(self):
     home = HomeView(self.driver)
     set_password_as_new_user(home)
     chats = home.get_chats()
     chats.back_button.click()
     chats.profile_button.click()
     login = chats.switch_users_button.click()
     login.recover_access_button.click()
     login.passphrase_input.send_keys(basic_user['passphrase'])
     login.password_input.send_keys(basic_user['password'])
     login.confirm_recover_access.click()
     recovered_user = login.element_by_text(basic_user['username'], 'button')
     recovered_user.click()
     login.password_input.send_keys(basic_user['password'])
     login.sign_in_button.click()
     home.find_full_text('Chats', 60)
Exemplo n.º 7
0
    def test_new_profile_name_and_status_on_discover(self):
        device_1, device_2 = HomeView(self.driver_1), HomeView(self.driver_2)
        set_password_as_new_user(device_1, device_2)
        device_1.back_button.click()
        device_2.back_button.click()

        chats_d1, chats_d2 = device_1.get_chats(), device_2.get_chats()
        chats_d2.profile_button.click()
        profile_d2 = chats_d2.profile_icon.click()
        d2_public_key = profile_d2.public_key_text.text

        chats_d1.plus_button.click()
        chats_d1.add_new_contact.click()
        chats_d1.public_key_edit_box.send_keys(d2_public_key)
        chats_d1.confirm()
        chats_d1.confirm_public_key_button.click()
        chats_d1.chat_message_input.send_keys('test123')
        chats_d1.send_message_button.click()
        chats_d2.back_button.click()

        new_chat_d2 = chats_d2.element_by_text('test123', 'button')
        new_chat_d2.click()

        chats_d1.back_button.click()
        chats_d1.back_button.click()
        chats_d2.add_to_contacts.click()
        chats_d2.back_button.click()
        chats_d1.profile_button.click()
        chats_d2.profile_button.click()

        profile_d1, profile_d2 = chats_d1.profile_icon.click(
        ), chats_d2.profile_icon.click()
        users_details = change_user_details(profile_d1, profile_d2)
        profile_d1.back_button.click()
        profile_d2.back_button.click()
        discover_d1 = profile_d1.discover_button.click()
        discover_d2 = profile_d2.discover_button.click()
        for device in discover_d1, discover_d2:
            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'] + ' ')
Exemplo n.º 8
0
    def test_sign_in(self, verification):

        verifications = {"valid":
                             {"input": "qwerty1234",
                              "outcome": "Chats"},
                         "invalid":
                             {"input": "12345ewq",
                              "outcome": "Wrong password"}}
        home = HomeView(self.driver)
        set_password_as_new_user(home)
        chats = home.get_chats()
        chats.back_button.click()
        chats.profile_button.click()
        login = chats.switch_users_button.click()
        login.first_account_button.click()
        login.password_input.send_keys(verifications[verification]['input'])
        login.sign_in_button.click()
        home.find_full_text(verifications[verification]["outcome"], 60)
Exemplo n.º 9
0
 def test_balance_and_eth_rate(self):
     errors = list()
     home = HomeView(self.driver)
     recover_access(home,
                    passphrase=transaction_users['A_USER']['passphrase'],
                    password=transaction_users['A_USER']['password'],
                    username=transaction_users['A_USER']['username'])
     chats = home.get_chats()
     address = transaction_users['A_USER']['address']
     balance = chats.get_balance(address) / 1000000000000000000
     eth_rate = get_ethereum_price_in_usd()
     wallet = chats.wallet_button.click()
     wallet_balance = wallet.get_eth_value()
     if wallet_balance != balance:
         errors.append('Balance %s is not equal to the expected %s' %
                       (wallet_balance, balance))
     wallet.verify_eth_rate(eth_rate, errors)
     assert not errors, 'errors occurred:\n{}'.format('\n'.join(errors))
Exemplo n.º 10
0
    def test_one_to_one_chat(self):

        device_1, device_2 = HomeView(self.driver_1), HomeView(self.driver_2)
        set_password_as_new_user(device_1, device_2)
        device_1.back_button.click()

        chats_d1 = device_1.get_chats()
        chats_d1.profile_button.click()
        profile_d1 = chats_d1.profile_icon.click()
        key = profile_d1.public_key_text.text
        device_2.back_button.click()

        chats_d2 = device_2.get_chats()
        chats_d2.plus_button.click()
        chats_d2.add_new_contact.click()
        chats_d2.public_key_edit_box.send_keys(key)
        chats_d2.confirm()
        chats_d2.confirm_public_key_button.click()

        message_1 = 'SOMETHING'
        message_2 = 'another SOMETHING'
        user_d1_name = chats_d2.user_name_text.text

        chats_d2.chat_message_input.send_keys(message_1)
        chats_d2.send_message_button.click()

        chats_d1.back_button.click()
        chats_d1.find_full_text(message_1)
        one_to_one_chat_d1 = chats_d1.element_by_text(message_1, 'button')
        one_to_one_chat_d1.click()

        one_to_one_chat_d2 = chats_d2.element_by_text(user_d1_name, 'button')
        one_to_one_chat_d2.click()
        chats_d2.chat_message_input.send_keys(message_2)
        chats_d2.send_message_button.click()

        chats_d1.find_full_text(message_2)
Exemplo n.º 11
0
    def test_private_chat(self):

        device_1, device_2 = HomeView(self.driver_1), HomeView(self.driver_2)
        set_chat_for_users_from_scratch(device_1, device_2)

        device_1.back_button.click()
        chats_d1 = device_1.get_chats()
        chats_d1.profile_button.click()
        profile_d1 = chats_d1.profile_icon.click()
        key = profile_d1.public_key_text.get_key()

        device_2.back_button.click()
        chats_d2 = device_2.get_chats()
        chats_d2.plus_button.click()
        chats_d2.add_new_contact.click()
        chats_d2.public_key_edit_box.send_keys(key)
        chats_d2.confirm()
        chats_d2.confirm_public_key_button.click()

        chats_d2.chat_message_input.send_keys('SOMETHING')
        chats_d2.send_message_button.click()

        profile_d1.back_button.click()
        profile_d1.find_text('SOMETHING')
Exemplo n.º 12
0
    def test_group_chat_send_receive_messages_and_remove_user(self):

        device_1, device_2 = HomeView(self.driver_1), \
                             HomeView(self.driver_2)
        set_password_as_new_user(device_2, device_1)

        device_1.back_button.click()
        chats_d1 = device_1.get_chats()
        chats_d1.profile_button.click()
        profile_d1 = chats_d1.profile_icon.click()
        key = profile_d1.public_key_text.text

        device_2.back_button.click()
        chats_d2 = device_2.get_chats()
        chats_d2.plus_button.click()
        chats_d2.add_new_contact.click()
        chats_d2.public_key_edit_box.send_keys(key)
        chats_d2.confirm()
        chats_d2.confirm_public_key_button.click()
        user_name_d1 = chats_d2.user_name_text.text

        device_2.back_button.click()
        chats_d2.new_group_chat_button.click()

        user_contact = chats_d2.element_by_text(user_name_d1, 'button')
        user_contact.scroll_to_element()
        user_contact.click()
        chats_d2.next_button.click()

        chat_name = 'new_chat'
        message_1 = 'first SOMETHING'
        message_2 = 'second SOMETHING'
        message_3 = 'third SOMETHING'

        chats_d2.name_edit_box.send_keys(chat_name)
        chats_d2.save_button.click()

        # send_and_receive_messages

        chats_d2.chat_message_input.send_keys(message_1)
        chats_d2.send_message_button.click()

        profile_d1.back_button.click()
        chats_d1 = profile_d1.get_chats()
        chats_d1.find_full_text(message_1)
        group_chat_d1 = chats_d1.element_by_text(chat_name, 'button')
        group_chat_d1.click()

        chats_d2.chat_message_input.send_keys(message_2)
        chats_d2.send_message_button.click()

        chats_d1.find_full_text(message_2)

        # remove_user

        chats_d2.group_chat_options.click()
        chats_d2.chat_settings.click()
        chats_d2.confirm()
        chats_d2.user_options.click()
        chats_d2.remove_button.click()
        device_2.back_button.click()

        # chats_d2.find_full_text("You\'ve removed " + user_name_d1)

        chats_d2.chat_message_input.send_keys(message_3)
        chats_d2.send_message_button.click()

        chats_d1.find_text_part("removed you from group chat")
        message_text = chats_d1.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)