From 2d327352e2ccea5e80f4b4ddeab3477f5379be80 Mon Sep 17 00:00:00 2001 From: osamacis Date: Mon, 28 Nov 2022 19:13:02 +0530 Subject: [PATCH] In test cases assertEqual replaced with assertExist --- .../tests/test_myaddress_screen.py | 20 +++++++++++++------ .../tests/test_payment_subscription.py | 18 +++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py index 57888abc..c98a4bf0 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -64,6 +64,11 @@ class MyAddressScreen(TeleniumTestProcess): ) # Clicking on 'Ok' Button To Dismiss the popup self.cli.wait_click('//MDFlatButton[@text=\"Ok\"]', timeout=5) + # Check the thumb button on address + self.assertExists( + "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb", + timeout=5 + ) # Clicking on toggle button to enable the address self.cli.wait_click( "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb", @@ -72,7 +77,7 @@ class MyAddressScreen(TeleniumTestProcess): # Checking the address is enabled self.assertExists( "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]", - timeout=5 + timeout=15 ) # Checking the current screen is MyAddress self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5) @@ -80,13 +85,16 @@ class MyAddressScreen(TeleniumTestProcess): @ordered def test_show_Qrcode(self): """Show the Qr code of selected address""" - # Checking labels from addresss list - first_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text]', 'text') - second_label = self.cli.getattr('//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text]', 'text') # Checking first label - self.assertEqual(first_label, 'test1') + self.assertExists( + '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text=\"test1\"]', + timeout=5 + ) # Checking second label - self.assertEqual(second_label, 'test2') + self.assertExists( + '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text=\"test2\"]', + timeout=5 + ) # Click on Address to open popup self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5) # Check the Popup is opened diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 403bb515..c86b0ae2 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -13,7 +13,7 @@ class PaymentScreen(TeleniumTestProcess): # Dragging from sent to inbox to get Payment tab self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") # assert for checking scroll function - self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3) + self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5) # this is for opening Payment screen self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5) # Checking the navbar is in closed state @@ -25,18 +25,20 @@ class PaymentScreen(TeleniumTestProcess): '//ProductCategoryLayout[0]/ProductLayout[0]', '//ProductCategoryLayout[0]/ProductLayout[1]') # assert for checking scroll function - self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) + self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5) # Scrolling Up Product list self.drag( '//ProductCategoryLayout[0]/ProductLayout[1]', '//ProductCategoryLayout[0]/ProductLayout[0]') # assert for checking scroll function - self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=3) + self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5) # Click on BUY Button - self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=2) - # assert check the buying option popup is closed - self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=5) + self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=5) + # CLick on the Payment Method + self.cli.click_on('//ScrollView[0]//ListItemWithLabel[0]') + # Check pop up is opened + self.assertExists('//PaymentMethodLayout[@disabled=false]', timeout=10) # Click out side to dismiss the popup - self.cli.wait_click('//MDRaisedButton[3]', timeout=2) + self.cli.wait_click('//MDRaisedButton[5]', timeout=5) # Checking Current screen(Payment screen) - self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3) + self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=5)