From 4ac0d308d1ea6083c0754745682b71d6bbf1ab72 Mon Sep 17 00:00:00 2001 From: prachi Date: Mon, 6 Apr 2020 22:00:42 +0530 Subject: [PATCH] Access xpath of next button --- src/tests_ui_test1.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/tests_ui_test1.py diff --git a/src/tests_ui_test1.py b/src/tests_ui_test1.py new file mode 100644 index 00000000..5a9a290a --- /dev/null +++ b/src/tests_ui_test1.py @@ -0,0 +1,41 @@ +import time +from telenium.tests import TeleniumTestCase +import random +import string + + +class TestTestCase(TeleniumTestCase): + cmd_entrypoint = [u'/home/cis/peterwork_new/PyBitmessage/src/main.py'] + + def runTest(self): + print(self,"-------------Welcome To Kivy Testing Application-------------") + + def test_press_button(self): + print(self,"---------------------------") + time.sleep(5) + self.cli.drag("/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/MDCheckbox[0]","/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]",2) + time.sleep(5) + self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Login[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[2]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]') + time.sleep(5) + self.cli.setattr(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/MDTextField[0]', "text", self.generate_random_string()) + time.sleep(5) + + def test_next_button(self): + self.cli.wait_click(u'/NavigationLayout/BoxLayout[1]/FloatLayout[0]/BoxLayout[0]/ScreenManager[0]/Random[0]/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/AnchorLayout[0]/MDRaisedButton[0]/MDLabel[0]') + time.sleep(5) + + def generate_random_string(self): + """Generate a random string of fixed length """ + # return ''.join(random.choice(letters) for i in range(stringLength)) + letters = string.ascii_letters + return ''.join(random.choice(letters) for i in range(10)) + + + +if __name__ == '__main__': + TeleniumTestCase.start_process() + TestTestCase().runTest() + TestTestCase().test_press_button() + TestTestCase().test_next_button() + +