Worked on modifying test_setting module
This commit is contained in:
parent
1d20859486
commit
7e87ece36b
|
@ -1 +0,0 @@
|
|||
16342
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in New Issue
Block a user