From 346b1a408424d2d0f0bffe3b208c6d539b41af2e Mon Sep 17 00:00:00 2001
From: shekhar-cis <shekhar.c@cisinlabs.com>
Date: Fri, 2 Dec 2022 12:16:09 +0530
Subject: [PATCH] Fixing navbar in addressbook

---
 src/bitmessagekivy/tests/telenium_process.py  |  6 +-
 src/bitmessagekivy/tests/test_addressbook.py  | 26 +++----
 .../tests/test_allmail_message.py             |  3 +-
 .../tests/test_create_random_address.py       | 12 +--
 .../tests/test_draft_message.py               | 16 ++--
 src/bitmessagekivy/tests/test_filemanager.py  |  4 +-
 .../tests/test_myaddress_screen.py            | 74 ++++++++++++++-----
 .../tests/test_payment_subscription.py        | 12 ++-
 src/bitmessagekivy/tests/test_sent_message.py | 26 +++----
 .../tests/test_setting_screen.py              |  1 +
 .../tests/test_trash_message.py               |  3 +-
 11 files changed, 116 insertions(+), 67 deletions(-)

diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py
index 94745612..460a76f9 100644
--- a/src/bitmessagekivy/tests/telenium_process.py
+++ b/src/bitmessagekivy/tests/telenium_process.py
@@ -78,7 +78,7 @@ class TeleniumTestProcess(TeleniumTestCase):
     def drag(self, xpath1, xpath2):
         """this method is for dragging"""
         self.cli.drag(xpath1, xpath2, 1)
-        self.cli.sleep(0.3)
+        self.cli.sleep(1)
 
     def assertCheckScrollDown(self, selector, timeout=-1):
         """this method is for checking scroll"""
@@ -92,7 +92,7 @@ class TeleniumTestProcess(TeleniumTestCase):
                 return False
             if timeout > 0 and time() - start > timeout:
                 raise Exception("Timeout")
-            sleep(0.1)
+            sleep(0.5)
 
     def assertCheckScrollUp(self, selector, timeout=-1):
         """this method is for checking scroll UP"""
@@ -106,7 +106,7 @@ class TeleniumTestProcess(TeleniumTestCase):
                 return False
             if timeout > 0 and time() - start > timeout:
                 raise Exception("Timeout")
-            sleep(0.1)
+            sleep(0.5)
 
     def open_side_navbar(self):
         """Common method for opening Side navbar (Side Drawer)"""
diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py
index 781af385..e61fef2a 100644
--- a/src/bitmessagekivy/tests/test_addressbook.py
+++ b/src/bitmessagekivy/tests/test_addressbook.py
@@ -30,10 +30,10 @@ class AddressBook(TeleniumTestProcess):
         self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
         # this is for opening addressbook screen
         self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=5)
-        # Checking current screen
-        self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
         # This is for checking the Side nav Bar is closed
         self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
+        # Checking current screen
+        self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
         # Check for rendered button
         self.assertExists('//ActionTopAppBarButton[@icon=\"account-plus\"]', timeout=5)
         # Click on "Account-Plus' Icon to open popup to save a new Address
@@ -46,7 +46,7 @@ class AddressBook(TeleniumTestProcess):
         self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Label\"]', 'text', self.test_label)
         # Checking the Label Field should not be empty
         self.assertExists(
-            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
+            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=5)
         # Add Correct Address
         self.cli.setattr(
             '//AddAddressPopup/BoxLayout[0]/MDTextField[@hint_text=\"Address\"]', 'text',
@@ -57,15 +57,15 @@ class AddressBook(TeleniumTestProcess):
             test_address['autoresponder_address'])
         # Validating the Label field
         self.assertExists(
-            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=2)
+            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format(self.test_label), timeout=5)
         # Validating the Valid Address is entered
         self.assertExists(
             '//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(
-                test_address['autoresponder_address']), timeout=3)
+                test_address['autoresponder_address']), timeout=5)
         # Checking cancel button
         self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
         # Click on 'Cancel' Button to dismiss the popup
-        self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=2)
+        self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
         # Checking current screen
         self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
 
@@ -83,18 +83,18 @@ class AddressBook(TeleniumTestProcess):
         self.cli.setattr('//AddAddressPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test_label2')
         # Checking the Label Field should not be empty
         self.assertExists(
-            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=2)
+            '//AddAddressPopup/BoxLayout[0]/MDTextField[0][@text=\"{}\"]'.format('test_label2'), timeout=5)
         # Add Address to Address Field
         self.cli.setattr(
             '//AddAddressPopup/BoxLayout[0]/MDTextField[1]', 'text', test_address['recipient'])
         # Checking the Address Field should not be empty
         self.assertExists(
             '//AddAddressPopup/BoxLayout[0]/MDTextField[1][@text=\"{}\"]'.format(test_address['recipient']),
-            timeout=2)
+            timeout=5)
         # Checking for "Cancel" button is rendered
         self.assertExists('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
         # Click on 'Cancel' Button to dismiss the popup
-        self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=2)
+        self.cli.wait_click('//MDRaisedButton[@text=\"Cancel\"]', timeout=5)
         # Check Current Screen (Address Book)
         self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=5)
 
@@ -103,13 +103,13 @@ class AddressBook(TeleniumTestProcess):
     def test_send_message_to_saved_address(self):
         """This method is to send msg to the saved address from addressbook"""
         # Checking the Message detail Dialog box is not opened
-        self.assertNotExists('//MDDialog', timeout=3)
+        self.assertNotExists('//MDDialog', timeout=5)
         # Checking the saved address is rendered
         self.assertExists('//AddressBook/BoxLayout[0]//SwipeToDeleteItem[0]', timeout=5)
         # Click on a Address to open address Details popup
         self.cli.wait_click('//AddressBook/BoxLayout[0]//SwipeToDeleteItem[0]', timeout=5)
         # Checking the Message detail Dialog is opened
-        self.assertExists('//MDDialog', timeout=3)
+        self.assertExists('//MDDialog', timeout=5)
         # Checking the buttons are rendered
         self.assertExists('//MDRaisedButton', timeout=5)
         # Click on the Send to message Button
@@ -132,9 +132,9 @@ class AddressBook(TeleniumTestProcess):
         # Method to open side navbar (written in telenium_process.py)
         self.open_side_navbar()
         # this is for opening setting screen
-        self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=2)
+        self.cli.wait_click('//NavigationItem[@text=\"Address Book\"]', timeout=5)
         # checking state of Nav drawer(closed)
-        self.assertExists("//MDNavigationDrawer[@state~=\"close\"]", timeout=2)
+        self.assertExists("//MDNavigationDrawer[@state~=\"close\"]", timeout=5)
         # Checking current screen
         self.assertExists("//ScreenManager[@current=\"addressbook\"]", timeout=8)
         # Checking the Address is rendered
diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py
index a85e9b60..b08e0f29 100644
--- a/src/bitmessagekivy/tests/test_allmail_message.py
+++ b/src/bitmessagekivy/tests/test_allmail_message.py
@@ -16,6 +16,7 @@ class AllMailMessage(TeleniumTestProcess):
         self.open_side_navbar()
         # this is for opening All Mail screen
         self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5)
+        self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
         # Assert for checking Current Screen(All mail)
         self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)
 
@@ -25,7 +26,7 @@ class AllMailMessage(TeleniumTestProcess):
         """Delete Message From Message body of Mail Screen/Window"""
         # click on a Message to get message details screen
         self.cli.wait_click(
-            '//MDList[0]/CustomSwipeToDeleteItem[0]', timeout=3)
+            '//MDList[0]/CustomSwipeToDeleteItem[0]', timeout=5)
         # Assert for checking Current Screen(Mail Detail)
         self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
         # CLicking on Trash-Can icon to delete Message
diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py
index 32ec87a4..f3ca30b7 100644
--- a/src/bitmessagekivy/tests/test_create_random_address.py
+++ b/src/bitmessagekivy/tests/test_create_random_address.py
@@ -59,7 +59,7 @@ class CreateRandomAddress(TeleniumTestProcess):
             '//Random//RandomBoxlayout//MDTextField[@hint_text=\"Label\"]', timeout=1)
         # Click on Label Text Field to give address Label
         self.cli.wait_click(
-            '//Random//RandomBoxlayout//MDTextField[@hint_text=\"Label\"]', timeout=2)
+            '//Random//RandomBoxlayout//MDTextField[@hint_text=\"Label\"]', timeout=5)
         # Enter a Label Randomly
         random_label = ""
         for _ in range(10):
@@ -68,10 +68,10 @@ class CreateRandomAddress(TeleniumTestProcess):
             self.cli.sleep(0.1)
         # Checking the Button is rendered
         self.assertExists(
-            '//Random//RandomBoxlayout//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=3)
+            '//Random//RandomBoxlayout//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
         # Click on Proceed Next button to generate random Address
         self.cli.wait_click(
-            '//Random//RandomBoxlayout//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=3)
+            '//Random//RandomBoxlayout//MDFillRoundFlatIconButton[@text=\"Proceed Next\"]', timeout=5)
         # Checking "My Address" Screen after creating a address
         self.assertExists("//ScreenManager[@current=\"myaddress\"]", timeout=5)
         # Checking the new address is created
@@ -85,7 +85,7 @@ class CreateRandomAddress(TeleniumTestProcess):
         # This is for opening side navbar
         self.open_side_navbar()
         # Click to open Address Dropdown
-        self.assertExists('//NavigationItem[0][@text=\"dropdown_nav_item\"]', timeout=2)
+        self.assertExists('//NavigationItem[0][@text=\"dropdown_nav_item\"]', timeout=5)
         self.assertExists(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
             '/IdentitySpinner[@name=\"identity_dropdown\"]', timeout=1
@@ -96,7 +96,7 @@ class CreateRandomAddress(TeleniumTestProcess):
         self.assertEqual(is_open, False)
         self.cli.wait(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
-            '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=2
+            '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=5
         )
         self.cli.wait_click(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
@@ -104,7 +104,7 @@ class CreateRandomAddress(TeleniumTestProcess):
         )
         if self.cli.wait(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
-                '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=2):
+                '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=5):
             sleep(0.2)
         # Check the state of dropdown.
         is_open = self.cli.getattr(
diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py
index 9a2efed8..e876f418 100644
--- a/src/bitmessagekivy/tests/test_draft_message.py
+++ b/src/bitmessagekivy/tests/test_draft_message.py
@@ -20,7 +20,7 @@ class DraftMessage(TeleniumTestProcess):
         # Method to open side navbar
         self.open_side_navbar()
         # this is for opening Draft screen
-        self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=2)
+        self.cli.wait_click('//NavigationItem[@text=\"Draft\"]', timeout=5)
         # Checking the drawer is in 'closed' state
         self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
         # Checking Draft Screen
@@ -70,9 +70,9 @@ class DraftMessage(TeleniumTestProcess):
         # Checking Receiver Address filled or not
         self.assertExists(
             '//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"{}\"]'.format(test_address['auto_responder']),
-            timeout=2)
+            timeout=5)
         # Checking the sender's Field is empty
-        self.assertExists('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"\"]', timeout=3)
+        self.assertExists('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"\"]', timeout=5)
         # Assert to check Sender's address dropdown open or not
         self.assertEqual(self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open'), False)
         # Open Sender's Address DropDown
@@ -88,7 +88,7 @@ class DraftMessage(TeleniumTestProcess):
         # Checking sender address is selected
         sender_address = self.cli.getattr('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text]', 'text')
         self.assertExists(
-            '//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=3)
+            '//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=5)
         # CLICK BACK-BUTTON
         self.cli.wait_click('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[@icon=\"arrow-left\"]', timeout=5)
         # Checking current screen(Login) after "BACK" Press
@@ -104,11 +104,11 @@ class DraftMessage(TeleniumTestProcess):
         # Checking messages in draft box
         self.assertEqual(len(self.cli.select('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem')), 1)
         # Wait to render the widget
-        self.cli.wait('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=3)
+        self.cli.wait('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=5)
         # Click on a Message to view its details (Message Detail screen)
         self.cli.wait_click('//SwipeToDeleteItem[0]//TwoLineAvatarIconListItem[0]', timeout=5)
         # Checking current screen Mail Detail
-        self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=3)
+        self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
 
         # CLICK on EDIT(Pencil) BUTTON
         self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"pencil\"]', timeout=5)
@@ -117,11 +117,11 @@ class DraftMessage(TeleniumTestProcess):
         # Checking the recipient is in the receiver field
         self.assertExists(
             '//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"{}\"]'.format(test_address['auto_responder']),
-            timeout=2)
+            timeout=5)
         # Checking the sender address is in the sender field
         sender_address = self.cli.getattr('//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text]', 'text')
         self.assertExists(
-            '//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=3)
+            '//DropDownWidget/ScrollView[0]//BoxLayout[1]/MDTextField[@text=\"{}\"]'.format(sender_address), timeout=5)
         # Checking the subject text is in the subject field
         self.assertExists(
             '//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.test_subject), timeout=5)
diff --git a/src/bitmessagekivy/tests/test_filemanager.py b/src/bitmessagekivy/tests/test_filemanager.py
index 3a3b366e..6d25553c 100644
--- a/src/bitmessagekivy/tests/test_filemanager.py
+++ b/src/bitmessagekivy/tests/test_filemanager.py
@@ -12,7 +12,7 @@ class FileManagerOpening(TeleniumTestProcess):
         # Method to open side navbar
         self.open_side_navbar()
         # Click to open Address Dropdown
-        self.assertExists('//NavigationItem[0][@text=\"dropdown_nav_item\"]', timeout=2)
+        self.assertExists('//NavigationItem[0][@text=\"dropdown_nav_item\"]', timeout=5)
         self.assertExists(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
             '/IdentitySpinner[@name=\"identity_dropdown\"]', timeout=1
@@ -24,7 +24,7 @@ class FileManagerOpening(TeleniumTestProcess):
         )
         self.cli.wait(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
-            '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=2
+            '/IdentitySpinner[@name=\"identity_dropdown\"][@state=\"normal\"]', timeout=5
         )
         self.cli.wait_click(
             '//NavigationItem[0][@text=\"dropdown_nav_item\"]'
diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py
index c98a4bf0..78740b79 100644
--- a/src/bitmessagekivy/tests/test_myaddress_screen.py
+++ b/src/bitmessagekivy/tests/test_myaddress_screen.py
@@ -25,6 +25,7 @@ class MyAddressScreen(TeleniumTestProcess):
         self.assertExists('//NavigationItem[@text=\"My addresses\"]', timeout=5)
         # this is for opening setting screen
         self.cli.wait_click('//NavigationItem[@text=\"My addresses\"]', timeout=5)
+        self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
         # Checking current screen
         self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
 
@@ -36,6 +37,7 @@ class MyAddressScreen(TeleniumTestProcess):
             '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test2\"]',
             '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]'
         )
+        self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
         # Checking list of Addresses
         self.assertExists("//MyAddress//CustomTwoLineAvatarIconListItem", timeout=5)
         # Checking the Toggle button is rendered on addresses
@@ -64,27 +66,17 @@ 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
+        # Checking the address is disabled
         self.assertExists(
-            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=false]",
             timeout=5
         )
-        # Clicking on toggle button to enable the address
-        self.cli.wait_click(
-            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
-            timeout=5
-        )
-        # Checking the address is enabled
-        self.assertExists(
-            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]",
-            timeout=15
-        )
-        # Checking the current screen is MyAddress
-        self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
 
     @ordered
     def test_show_Qrcode(self):
         """Show the Qr code of selected address"""
+        # Checking the current screen is MyAddress
+        self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
         # Checking first label
         self.assertExists(
             '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text=\"test1\"]',
@@ -95,20 +87,66 @@ class MyAddressScreen(TeleniumTestProcess):
             '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text=\"test2\"]',
             timeout=5
         )
+        self.assertExists(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=false]",
+            timeout=5
+        )
+        self.assertExists(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test1\"]//ToggleBtn[@active=true]",
+            timeout=5
+        )
         # Click on Address to open popup
         self.cli.wait_click('//MDList[0]/CustomTwoLineAvatarIconListItem[@text=\"test1\"]', timeout=5)
         # Check the Popup is opened
         self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]', timeout=5)
         # Cick on 'Show QR code' button to view QR Code
-        self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]')
+        self.cli.wait_click('//MyaddDetailPopup//MDLabel[@text=\"Show QR code\"]', timeout=5)
         # Check Current screen is QR Code screen
-        self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=2)
+        self.assertExists("//ShowQRCode[@name~=\"showqrcode\"]", timeout=5)
         # Check BACK button
         self.assertExists('//ActionTopAppBarButton[@icon~=\"arrow-left\"]', timeout=5)
         # Click on BACK button
         self.cli.wait_click('//ActionTopAppBarButton[@icon~=\"arrow-left\"]', timeout=5)
         # Checking current screen(My Address) after BACK press
         self.assertExists("//MyAddress[@name~=\"myaddress\"]", timeout=5)
+        # Checking first label
+        self.assertExists(
+            '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[1][@text=\"test1\"]',
+            timeout=5
+        )
+        # Checking second label
+        self.assertExists(
+            '//MyAddress//MDList[0]/CustomTwoLineAvatarIconListItem[0][@text=\"test2\"]',
+            timeout=5
+        )
+        self.cli.sleep(0.3)
+
+    @ordered
+    def test_enable_address(self):
+        """Test to enable the disabled address"""
+        # Checking list of Addresses
+        self.assertExists("//MyAddress//CustomTwoLineAvatarIconListItem", timeout=5)
+        # Check the thumb button on address
+        self.assertExists(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
+            timeout=5
+        )
+        # Checking the address is disabled
+        self.assertExists(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=false]",
+            timeout=5
+        )
+        self.cli.sleep(0.3)
+        # Clicking on toggle button to enable the address
+        self.cli.wait_click(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn/Thumb",
+            timeout=10
+        )
+        # Checking the address is enabled
+        self.assertExists(
+            "//MyAddress//CustomTwoLineAvatarIconListItem[@text=\"test2\"]//ToggleBtn[@active=true]",
+            timeout=10
+        )
 
     @ordered
     def test_send_message_from(self):
@@ -128,9 +166,9 @@ class MyAddressScreen(TeleniumTestProcess):
         # Checking Popup Opened
         self.assertExists('//MyaddDetailPopup//MDLabel[@text=\"Send message from\"]', timeout=5)
         # Click on Send Message Button to redirect Create Screen
-        self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[0]', timeout=2)
+        self.cli.wait_click('//MyaddDetailPopup//MDRaisedButton[0]/MDLabel[0]', timeout=5)
         # Checking Current screen(Create)
-        self.assertExists("//Create[@name~=\"create\"]", timeout=2)
+        self.assertExists("//Create[@name~=\"create\"]", timeout=5)
         # Entering Receiver Address
         self.cli.setattr(
             '//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", data[1])
diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py
index c86b0ae2..5de59015 100644
--- a/src/bitmessagekivy/tests/test_payment_subscription.py
+++ b/src/bitmessagekivy/tests/test_payment_subscription.py
@@ -1,9 +1,12 @@
 from .telenium_process import TeleniumTestProcess
+from .common import skip_screen_checks
+from .common import ordered
 
 
 class PaymentScreen(TeleniumTestProcess):
     """SubscriptionPayment Screen Functionality Testing"""
 
+    @ordered
     def test_select_subscription(self):
         """Select Subscription From List of Subscriptions"""
         # This is for checking Current screen
@@ -13,7 +16,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=5)
+        self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
         # this is for opening Payment screen
         self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=5)
         # Checking the navbar is in closed state
@@ -31,7 +34,12 @@ class PaymentScreen(TeleniumTestProcess):
             '//ProductCategoryLayout[0]/ProductLayout[1]',
             '//ProductCategoryLayout[0]/ProductLayout[0]')
         # assert for checking scroll function
-        self.assertCheckScrollDown('//Payment//ScrollView[0]', timeout=5)
+        self.assertCheckScrollUp('//Payment//ScrollView[0]', timeout=10)
+
+    @skip_screen_checks
+    @ordered
+    def test_buy_option(self):
+        """Check subscription"""
         # Click on BUY Button
         self.cli.wait_click('//MDRaisedButton[@text=\"BUY\"]', timeout=5)
         # CLick on the Payment Method
diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py
index 3e9f450e..a7fd576b 100644
--- a/src/bitmessagekivy/tests/test_sent_message.py
+++ b/src/bitmessagekivy/tests/test_sent_message.py
@@ -20,17 +20,17 @@ class SendMessage(TeleniumTestProcess):
         # Checking current Screen(Inbox screen)
         self.assert_wait_no_except('//ScreenManager[@current]', timeout=10, value='inbox')
         # Click on Composer Icon(Plus icon)
-        self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=2)
+        self.cli.wait_click('//ComposerButton[0]/MDFloatingActionButton[@icon=\"plus\"]', timeout=5)
         # Checking Message Composer Screen(Create)
-        self.assertExists("//ScreenManager[@current=\"create\"]", timeout=4)
+        self.assertExists("//ScreenManager[@current=\"create\"]", timeout=5)
         # Checking State of Sender's Address Input Field (should be Empty)
-        self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=3)
+        self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=5)
         # Checking State of Receiver's Address Input Field (should be Empty)
-        self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=2)
+        self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=5)
         # Checking State of Subject Input Field (shoudl be Empty)
-        self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"\"]', timeout=2)
+        self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"\"]', timeout=5)
         # Click on Send Icon to check validation working
-        self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=2)
+        self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
         # Checking validation Pop up is Opened
         self.assertExists('//MDDialog[@open]', timeout=5)
         # Checking the 'Ok' Button is rendered
@@ -49,10 +49,10 @@ class SendMessage(TeleniumTestProcess):
             Validate the half filled form and press back button to save message in draft box.
         """
         # Checking current screen (Msg composer screen)
-        self.assertExists("//ScreenManager[@current=\"create\"]", timeout=2)
+        self.assertExists("//ScreenManager[@current=\"create\"]", timeout=5)
         # ADD SENDER'S ADDRESS
         # Checking State of Sender's Address Input Field (Empty)
-        self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=2)
+        self.assertExists('//DropDownWidget/ScrollView[0]//MDTextField[@text=\"\"]', timeout=5)
         # Assert to check Sender's address dropdown closed
         is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
         self.assertEqual(is_open, False)
@@ -61,7 +61,7 @@ class SendMessage(TeleniumTestProcess):
         # Checking the Address Dropdown is in open State
         is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
         # Select Sender's Address from Dropdown
-        self.cli.wait_click('//ComposerSpinnerOption[0]', timeout=3)
+        self.cli.wait_click('//ComposerSpinnerOption[0]', timeout=5)
         # Assert to check Sender's address dropdown closed
         is_open = self.cli.getattr('//Create//CustomSpinner[@is_open]', 'is_open')
         self.assertEqual(is_open, False)
@@ -69,7 +69,7 @@ class SendMessage(TeleniumTestProcess):
         sender_address = self.cli.getattr(
             '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[@text]', 'text')
         self.assertExists(
-            '//DropDownWidget/ScrollView[0]//MDTextField[@text=\"{}\"]'.format(sender_address), timeout=2)
+            '//DropDownWidget/ScrollView[0]//MDTextField[@text=\"{}\"]'.format(sender_address), timeout=5)
         # Assert check for empty Subject Field
         self.assertExists('//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"\"]', timeout=5)
         # ADD SUBJECT
@@ -78,14 +78,14 @@ class SendMessage(TeleniumTestProcess):
         self.assertExists(
             '//DropDownWidget/ScrollView[0]//MyMDTextField[@text=\"{}\"]'.format(self.test_subject), timeout=5)
         # Checking BODY Field(EMPTY)
-        self.assertExists('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"\"]', timeout=2)
+        self.assertExists('//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"\"]', timeout=5)
         # ADD BODY
         self.cli.setattr(
             '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/MDTextField[0]', 'text', self.test_body)
         # Checking BODY is Entered
         self.assertExists(
             '//DropDownWidget/ScrollView[0]//ScrollView[0]/MDTextField[@text=\"{}\"]'.format(self.test_body),
-            timeout=2)
+            timeout=5)
         # click on send icon
         self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"send\"]', timeout=5)
         # Checking validation Pop up is Opened
@@ -103,7 +103,7 @@ class SendMessage(TeleniumTestProcess):
         """
         # ADD RECEIVER ADDRESS
         # Checking Receiver Address Field
-        self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=2)
+        self.assertExists('//DropDownWidget/ScrollView[0]//MyTextInput[@text=\"\"]', timeout=5)
         # Entering Receiver Address
         self.cli.setattr(
             '//DropDownWidget/ScrollView[0]//MyTextInput[0]', "text", test_address['autoresponder_address'])
diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py
index 6cf608f3..4f3a0a59 100644
--- a/src/bitmessagekivy/tests/test_setting_screen.py
+++ b/src/bitmessagekivy/tests/test_setting_screen.py
@@ -18,6 +18,7 @@ class SettingScreen(TeleniumTestProcess):
         self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=10)
         # this is for opening setting screen
         self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=5)
+        self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
         # Checking current screen
         self.assertExists("//ScreenManager[@current=\"set\"]", timeout=5)
         # Scrolling down currrent screen
diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py
index 0d93fd9e..d7cdb467 100644
--- a/src/bitmessagekivy/tests/test_trash_message.py
+++ b/src/bitmessagekivy/tests/test_trash_message.py
@@ -13,8 +13,9 @@ class TrashMessage(TeleniumTestProcess):
         # Method to open side navbar
         self.open_side_navbar()
         # this is for opening Trash screen
-        self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=2)
+        self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=5)
         # Checking the drawer is in 'closed' state
         self.assertExists('//MDNavigationDrawer[@status~=\"closed\"]', timeout=5)
         # Checking Trash Screen
         self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=5)
+        self.cli.sleep(0.5)