diff --git a/src/bitmessagekivy/tests/sampleData/singleton.lock b/src/bitmessagekivy/tests/sampleData/singleton.lock deleted file mode 100644 index 97ee3ea3..00000000 --- a/src/bitmessagekivy/tests/sampleData/singleton.lock +++ /dev/null @@ -1 +0,0 @@ -16342 diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py index 03ec0e98..cd7ac94a 100644 --- a/src/bitmessagekivy/tests/telenium_process.py +++ b/src/bitmessagekivy/tests/telenium_process.py @@ -1,6 +1,7 @@ import os import shutil import tempfile +from time import time, sleep from telenium.tests import TeleniumTestCase @@ -58,5 +59,19 @@ class TeleniumTestProcess(TeleniumTestCase): self.cli.sleep(seconds) def drag(self, xpath1, xpath2): - self.cli.drag(xpath1, xpath2, 1) + """this method is for dragging""" + self.cli.drag(xpath1, xpath2, 1.5) self.cli.sleep(0.3) + + def assertCheckScrollDown(self, scroll_distance, destination, timeout=-1): + """this method is for checking scroll""" + start = time() + while True: + if scroll_distance <= destination: + self.assertLessEqual(scroll_distance, destination) + return True + if timeout == -1: + return False + if timeout > 0 and time() - start > timeout: + raise Exception("Timeout") + sleep(0.1) diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py index 57490e36..76844817 100644 --- a/src/bitmessagekivy/tests/test_setting_screen.py +++ b/src/bitmessagekivy/tests/test_setting_screen.py @@ -9,15 +9,15 @@ class SettingScreen(TeleniumTestProcess): print("=====================Test -Show Setting Screen=====================") self.cli.sleep(3) # this is for opening Nav drawer - self.click_on('//MDActionTopAppBarButton[@icon=\"menu\"]') + self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) # checking state of Nav drawer - self.assertEqual(self.cli.getattr('//MDNavigationDrawer', 'state'), 'open') + self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) # this is for scrolling Nav drawer self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") # assert for checking scroll funcation scroll_distance = self.cli.getattr('//ContentNavigationDrawer//ScrollView[0]', 'scroll_y') - self.assertLessEqual(scroll_distance, -0.0) + self.assertCheckScrollDown(scroll_distance, -0.0, timeout=1) # this is for opening setting screen - self.click_on('//NavigationItem[@text=\"Settings\"]') + self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=1) # Checking current screen self.assertExists("//Setting[@name~=\"set\"]", timeout=2) diff --git a/src/fake_addressGenerator.py b/src/fake_addressGenerator.py index d9072ef6..a41fdc07 100644 --- a/src/fake_addressGenerator.py +++ b/src/fake_addressGenerator.py @@ -35,6 +35,7 @@ fake_addresses = { class FakeAddressGenerator(StoppableThread): """A thread for creating fake addresses""" name = "addressGenerator" + address_list = list(fake_addresses.keys()) def stopThread(self): try: @@ -52,11 +53,7 @@ class FakeAddressGenerator(StoppableThread): queueValue = queues.addressGeneratorQueue.get() streamNumber = 1 try: - if len(BMConfigParser().addresses()) > 0: - address = list(fake_addresses.keys())[len(BMConfigParser().addresses())] - else: - address = list(fake_addresses.keys())[0] - + address = self.address_list.pop(0) label = queueValue[3] BMConfigParser().add_section(address)