From 071454c68fac7cb295596430ed414e239046085d Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Wed, 14 Jul 2021 20:53:03 +0530 Subject: [PATCH] conflict resolved and fixed on_click in test cases --- .../tests/test_allmail_message.py | 32 ++++++++------ .../tests/test_network_screen.py | 32 +++++++++----- .../tests/test_payment_subscription.py | 43 +++++++++++++------ .../tests/test_setting_screen.py | 4 +- .../tests/test_trash_message.py | 19 +++++--- 5 files changed, 86 insertions(+), 44 deletions(-) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index d7d1d12f..88d565a4 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -1,3 +1,4 @@ +from requests.packages.urllib3.util import Timeout, timeout from .telenium_process import TeleniumTestProcess from .common import ordered @@ -9,22 +10,29 @@ class AllMailMessage(TeleniumTestProcess): def test_show_allmail_list(self): """Show All Messages on Mail Screen/Window""" print("=====================Test -Show Messages Of Mail Screen=====================") - self.cli.sleep(10) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(4) - self.cli.click_on('//NavigationItem[5]') - self.cli.sleep(4) + self.cli.sleep(8) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # this is for opening All Mail screen + self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=2) + self.cli.sleep(3) + # Assert for checking Current Screen(All mail) self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=2) @ordered def test_delete_message_from_allmail_list(self): """Delete Message From Message body of Mail Screen/Window""" print("=====================Test -Delete Messages Of Mail Screen=====================") - self.cli.sleep(4) - self.cli.click_on( - '//Allmails[0]/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/CutsomSwipeToDeleteItem[0]') - self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=0) - self.cli.sleep(5) - self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]') - self.cli.sleep(5) + # Assert for checking Current Screen(All mail) + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=2) + # click on a Message to get message details screen + self.cli.wait_click( + '//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=2) + # Assert for checking Current Screen(Mail Detail) + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) + # CLicking on Trash-Can icon to delete Message + self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]', timeout=2) + # After deleting msg, screen is redirected to All mail screen self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=0) diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index a44870a2..2bafa74e 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -1,3 +1,4 @@ +from requests.packages.urllib3.util import timeout from .telenium_process import TeleniumTestProcess @@ -6,14 +7,25 @@ class NetwrokStatusScreen(TeleniumTestProcess): def test_network_status(self): """Show NetwrokStatus""" - print("=====================Test -Show Network Status=====================") - self.cli.sleep(10) - self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') - self.cli.sleep(3) - self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) - self.cli.sleep(3) - self.cli.click_on('//NavigationItem[10]') - self.cli.sleep(4) - self.cli.click_on('//NetworkStat/MDTabs[0]/MDTabsBar[0]/MDTabsScrollView[0]/MDGridLayout[0]/MDTabsLabel[1]') - self.cli.sleep(4) + print("=====================Test -Show NetwrokStatus=====================") + self.cli.sleep(8) + # this is for opening Nav drawer + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) + # this is for scrolling Nav drawer + self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") + # Assert for checking scroller run till Network tab. + self.assertExists("//NavigationItem[@text=\"Network status\"]", timeout=2) + # assert for checking scroll function + scroll_distance = self.cli.getattr('//ContentNavigationDrawer//ScrollView[0]', 'scroll_y') + self.assertCheckScrollDown(scroll_distance, -0.0, timeout=2) + # Clicking on Network Status tab + self.click_on('//NavigationItem[@text=\"Network status\"]', seconds=1) + # Checking for current screen (Network Status) self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) + # Clicking on Processes Tab + self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[1]', timeout=1) + # Checking for current screen (Network Status) + self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) + diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 421279e4..8f40f4d0 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -1,3 +1,5 @@ +from time import time +from requests.packages.urllib3.util import timeout from .telenium_process import TeleniumTestProcess @@ -7,23 +9,36 @@ class PaymentScreen(TeleniumTestProcess): def test_select_subscripton(self): """Select Subscripton From List of Subscriptons""" print("=====================Test -Select Subscripton From List of Subscriptons=====================") - self.cli.sleep(10) + self.cli.sleep(7) # this is for opening Nav drawer - self.click_on('//MDActionTopAppBarButton[@icon=\"menu\"]') + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) + # checking state of Nav drawer + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) # Dragging from sent to inbox to get Payment tab. self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") + self.assertExists('//NavigationItem[@text=\"Network status\"]', timeout=3) + + # assert for checking scroll funcation + scroll_distance = self.cli.getattr('//ContentNavigationDrawer//ScrollView[0]', 'scroll_y') + + self.assertCheckScrollDown(scroll_distance, 0.0, timeout=3) + self.assertExists('//NavigationItem[@text=\"Purchase\"]', timeout=3) # this is for opening Payment screen - self.click_on('//NavigationItem[@text=\"Purchase\"]', seconds=1) - self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) - self.cli.drag( - '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[1]', - '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[0]', 1) - self.cli.sleep(2) - self.click_on('//MDRaisedButton[3]') - self.cli.sleep(2) - self.cli.click_on('//ListItemWithLabel[0]') - self.cli.sleep(2) - self.cli.click_on('//MDRaisedButton[3]') - self.cli.sleep(2) + self.click_on('//NavigationItem[@text=\"Purchase\"]', seconds=2) + # Assert for checking Current Screen + self.assertExists("//Payment[@name~=\"payment\"]", timeout=4) + self.drag( + '//ProductCategoryLayout[0]/ProductLayout[1]', + '//ProductCategoryLayout[0]/ProductLayout[0]') + # assert for checking scroll funcation + scroll_distance = self.cli.getattr('//Payment//ScrollView[0]', 'scroll_y') + self.assertCheckScrollDown(scroll_distance, 0.0, timeout=3) + self.assertExists('//MDRaisedButton[3]', timeout=3) + self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2) + self.click_on('//ScrollView[0]/ListItemWithLabel[0]', seconds=1) + self.click_on('//MDRaisedButton[3]', seconds=1) self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) + + + diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py index d9d9183f..e704d2df 100644 --- a/src/bitmessagekivy/tests/test_setting_screen.py +++ b/src/bitmessagekivy/tests/test_setting_screen.py @@ -7,9 +7,9 @@ class SettingScreen(TeleniumTestProcess): def test_setting_screen(self): """Show Setting Screen""" print("=====================Test -Show Setting Screen=====================") - self.cli.sleep(3) + self.cli.sleep(12) # this is for checking current screen - self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=2) + self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) # this is for opening Nav drawer self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) # checking state of Nav drawer diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index b71cc386..b2bf13de 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -21,12 +21,13 @@ class TrashMessage(TeleniumTestProcess): print("=====================Test -Delete Message From Trash Message Listing=====================") self.cli.sleep(8) # this is for opening Nav drawer - self.click_on('//MDActionTopAppBarButton[@icon=\"menu\"]') + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5) # checking state of Nav drawer - self.assertEqual(self.cli.getattr('//MDNavigationDrawer', 'state'), 'open') + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) # this is for opening Trash screen - self.click_on('//NavigationItem[@text=\"Trash\"]') + self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=2) # self.cli.click_on('//NavigationItem[4]') + # Checking Trash Screen self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) self.cli.sleep(4) # This is for swiping message to activate delete icon. @@ -34,10 +35,16 @@ class TrashMessage(TeleniumTestProcess): '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') self.click_on('//MDList[0]/CutsomSwipeToDeleteItem[0]', seconds=1) + # Checking the Trash Icon after swipe. + self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2) # clicking on Trash Box icon to delete message. - self.click_on('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', seconds=2) + self.cli.wait_click('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2) + # Checking the popup box screen. + self.assertExists("//MDDialog//MDFlatButton[@text=\"Yes\"]", timeout=2) # Clicking on 'Yes' Button on Popup to confirm delete. self.click_on('//MDDialog//MDFlatButton[@text=\"Yes\"]', seconds=1.1) - # self.cli.click_on('//MDDialog/DialogFakeCard[0]/AnchorLayout[0]/MDBoxLayout[0]/MDFlatButton[0]') + # Checking Trash Screen + self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem")) - self.assertEqual(total_trash_msgs, 1) + # Checking the number of messages after delete. + self.assertEqual(total_trash_msgs, 1) \ No newline at end of file