This repository has been archived on 2025-02-03. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2025-02-03/src/bitmessagekivy/tests/test_sent_message.py

122 lines
5.5 KiB
Python
Raw Normal View History

2021-03-06 00:14:43 +01:00
import os
import queues
import shutil
import tempfile
import time
2021-03-06 00:14:43 +01:00
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
from bmconfigparser import BMConfigParser
2021-03-06 00:14:43 +01:00
class SendMessage(TeleniumTestProcess):
"""Sent Screen Functionality Testing"""
2021-03-06 00:14:43 +01:00
def __init__(self):
print('you are inside telenium init...................................................................................')
# import pdb;pdb.set_trace()
old_source_file = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'sampleData', 'keys.dat')
# new_destination_file = os.path.join(tempfile.gettempdir(), 'keys.dat')
if not os.path.exists(os.environ['BITMESSAGE_HOME']):
os.mkdir(os.environ['BITMESSAGE_HOME'])
new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], 'keys.dat')
shutil.copyfile(old_source_file, new_destination_file)
self.data = BMConfigParser().addresses()
# print(__file__, '...............................addreses in configfile', BMConfigParser().addresses())
def test_select_sent(self):
"""Sending Message From Inbox Screen
opens a pop-up(screen)which send message from sender to reciever"""
print("=====================Test - Sending Message From Inbox Screen=====================")
time.sleep(2)
2021-03-06 00:14:43 +01:00
# self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")')
self.cli.execute('app.clickNavDrawer()')
time.sleep(1)
self.cli.click_on('//NavigationItem[1]')
time.sleep(1)
self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]')
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/MyMDTextField[0]')
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]')
time.sleep(3)
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]', "text", "second add")
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]')
time.sleep(4)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]')
time.sleep(4)
self.cli.click_on('//MDIconButton[2]')
time.sleep(3)
self.cli.click_on('//MDFlatButton[0]')
time.sleep(5)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]')
time.sleep(2)
self.cli.click_on('//MyTextInput[0]')
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]')
time.sleep(2)
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'heyyyyyy')
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]')
time.sleep(4)
random_label=""
for char in "how are you this is message body":
random_label += char
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]','text',random_label)
time.sleep(0.2)
time.sleep(3)
self.cli.click_on('//MDIconButton[2]')
time.sleep(3)
self.cli.click_on('//MDFlatButton[0]')
time.sleep(6)
2021-03-06 00:14:43 +01:00
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]',"text",self.data[0])
time.sleep(3)
self.cli.click_on('//MDIconButton[2]')
time.sleep(3)
self.cli.click_on('//MDFlatButton[0]')
time.sleep(3)
def test_sent_multiple_message(self):
"""Sending Second Message From Inbox Screen
for testing the search and delete functionality for two messages on the screen"""
print("=====================Test - Sending Message From Inbox Screen=====================")
time.sleep(3)
2021-03-06 00:14:43 +01:00
# self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")')
self.cli.execute('app.clickNavDrawer()')
time.sleep(5)
self.cli.click_on('//NavigationItem[1]')
time.sleep(3)
self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]')
time.sleep(3)
self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]')
time.sleep(2)
self.cli.click_on('//MyTextInput[0]')
time.sleep(3)
data = BMConfigParser().addresses()
2021-03-06 00:14:43 +01:00
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", self.data[0])
time.sleep(3)
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second')
time.sleep(3)
random_label=""
for char in "Hey This Is Second Message Body":
random_label += char
self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]',"text",random_label)
time.sleep(0.2)
time.sleep(2)
self.cli.click_on('//MDIconButton[2]')
time.sleep(5)
self.cli.execute('app.clickNavDrawer()')
time.sleep(3)
self.cli.click_on('//NavigationItem[2]')
time.sleep(3)
if __name__ == '__main__':
"""Start Application"""
obj = SendMessage()
2021-03-06 00:14:43 +01:00
obj.setUpClass()
obj.test_select_sent()
obj.test_sent_multiple_message()
2021-03-06 00:14:43 +01:00
obj.remove_temp_data()