From 496ec73e34b1b72a62f6eccc9d0aea769e828b2e Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Tue, 20 Jul 2021 18:57:22 +0530 Subject: [PATCH] fixed swap to delete feature --- .../tests/test_allmail_message.py | 17 +++++++++-------- src/bitmessagekivy/tests/test_network_screen.py | 2 +- .../tests/test_payment_subscription.py | 8 ++++---- src/bitmessagekivy/tests/test_trash_message.py | 13 ++++++++++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index 919f2e39..ecc22dc2 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -13,12 +13,11 @@ class AllMailMessage(TeleniumTestProcess): # 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) + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5) # this is for opening All Mail screen - self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=2) - self.cli.sleep(3) + self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5) # Assert for checking Current Screen(All mail) - self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=2) + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) @ordered def test_delete_message_from_allmail_list(self): @@ -28,10 +27,12 @@ class AllMailMessage(TeleniumTestProcess): 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) + '//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=3) # Assert for checking Current Screen(Mail Detail) - self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=2) + self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=3) # CLicking on Trash-Can icon to delete Message - self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[1]', timeout=2) + self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5) # After deleting msg, screen is redirected to All mail screen - self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=0) + self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) + + diff --git a/src/bitmessagekivy/tests/test_network_screen.py b/src/bitmessagekivy/tests/test_network_screen.py index d498df31..42628371 100644 --- a/src/bitmessagekivy/tests/test_network_screen.py +++ b/src/bitmessagekivy/tests/test_network_screen.py @@ -21,6 +21,6 @@ class NetwrokStatusScreen(TeleniumTestProcess): # 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) + self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', 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 2bb20f8d..51f921f4 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -1,4 +1,6 @@ from time import time + +from kivy.core.window import Animation from .telenium_process import TeleniumTestProcess @@ -30,12 +32,10 @@ class PaymentScreen(TeleniumTestProcess): self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) # Click on BUY Button self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2) - # Checking the pop up opend by clicking on BUY button - # self.assertExists('//PaymentMethodLayout/BoxLayout[0]/MDLabel[@text=\"Select Payment Method\"]', timeout=2) # CLick on the Payment Method self.cli.click_on('//ScrollView[0]/ListItemWithLabel[0]') - # Click checked - # self.assertExists('//PaymentMethodLayout/BoxLayout[0]/MDLabel[@text=\"Select Payment Method\"]', timeout=2) + # Check pop up is opened + self.assertEqual(self.cli.getattr('//PaymentMethodLayout/BoxLayout[0]/MDLabel[0]', 'text'), 'Select Payment Method') # Click out side to dismiss the popup self.cli.wait_click('//MDRaisedButton[3]', timeout=2) # Checking Current screen(Payment screen) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index bbd20794..57b45433 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -28,12 +28,17 @@ class TrashMessage(TeleniumTestProcess): 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) + self.assertExists("//Trash[@name~=\"trash\"]", timeout=5) + # Transition Effect taking time, so halt is required + self.cli.sleep(2) + # Checking Popup is closed + self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False) # This is for swiping message to activate delete icon. self.drag( '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') + # Checking Popup is Opened + self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), True) 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) @@ -42,7 +47,9 @@ class TrashMessage(TeleniumTestProcess): # 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.click_on('//MDFlatButton[@text=\"Yes\"]', seconds=1.1) + # Checking Pop is closed + self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False) # Checking Trash Screen self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem"))