fixed app launch issue

This commit is contained in:
shekhar-cis 2021-08-05 20:03:05 +05:30
parent 050b113e01
commit ba7eb7eb3e
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635
11 changed files with 89 additions and 65 deletions

View File

@ -13,7 +13,7 @@ import state
from bitmessagekivy.baseclass.common import ( from bitmessagekivy.baseclass.common import (
showLimitedCnt, toast, ThemeClsColor, showLimitedCnt, toast, ThemeClsColor,
avatarImageFirstLetter, CutsomSwipeToDeleteItem, avatarImageFirstLetter, CustomSwipeToDeleteItem,
ShowTimeHistoy ShowTimeHistoy
) )
from bitmessagekivy.baseclass.maildetail import MailDetail from bitmessagekivy.baseclass.maildetail import MailDetail
@ -90,7 +90,7 @@ class Allmails(Screen):
for item in self.all_mails: for item in self.all_mails:
body = item[3].decode() if isinstance(item[3], bytes) else item[3] body = item[3].decode() if isinstance(item[3], bytes) else item[3]
subject = item[2].decode() if isinstance(item[2], bytes) else item[2] subject = item[2].decode() if isinstance(item[2], bytes) else item[2]
message_row = CutsomSwipeToDeleteItem( message_row = CustomSwipeToDeleteItem(
text=item[1], text=item[1],
) )

View File

@ -136,7 +136,7 @@ class SwipeToDeleteItem(MDCardSwipe):
opening_time = NumericProperty(0.5) opening_time = NumericProperty(0.5)
class CutsomSwipeToDeleteItem(MDCardSwipe): class CustomSwipeToDeleteItem(MDCardSwipe):
"""Custom swipe delete class for App UI""" """Custom swipe delete class for App UI"""
text = StringProperty() text = StringProperty()
cla = Window.size[0] / 2 cla = Window.size[0] / 2

View File

@ -16,7 +16,7 @@ import state
from bitmessagekivy.baseclass.common import ( from bitmessagekivy.baseclass.common import (
toast, showLimitedCnt, ThemeClsColor, toast, showLimitedCnt, ThemeClsColor,
CutsomSwipeToDeleteItem, ShowTimeHistoy, CustomSwipeToDeleteItem, ShowTimeHistoy,
avatarImageFirstLetter avatarImageFirstLetter
) )
@ -85,7 +85,7 @@ class Trash(Screen):
for item in self.trash_messages: for item in self.trash_messages:
subject = item[2].decode() if isinstance(item[2], bytes) else item[2] subject = item[2].decode() if isinstance(item[2], bytes) else item[2]
body = item[3].decode() if isinstance(item[3], bytes) else item[3] body = item[3].decode() if isinstance(item[3], bytes) else item[3]
message_row = CutsomSwipeToDeleteItem( message_row = CustomSwipeToDeleteItem(
text=item[1], text=item[1],
) )
message_row.bind(on_swipe_complete=partial(self.on_swipe_complete, message_row)) message_row.bind(on_swipe_complete=partial(self.on_swipe_complete, message_row))

View File

@ -378,7 +378,7 @@ MDNavigationLayout:
size: [120, 140] if app.app_platform == "android" else [64, 80] size: [120, 140] if app.app_platform == "android" else [64, 80]
<CutsomSwipeToDeleteItem>: <CustomSwipeToDeleteItem>:
size_hint_y: None size_hint_y: None
height: content.height height: content.height

View File

@ -6,6 +6,7 @@ import os
import shutil import shutil
import tempfile import tempfile
from time import time, sleep from time import time, sleep
from turtle import Turtle, pd
from telenium.tests import TeleniumTestCase from telenium.tests import TeleniumTestCase
@ -63,8 +64,18 @@ class TeleniumTestProcess(TeleniumTestCase):
pass pass
cleanup() cleanup()
def assertCheck_app_launch(self, selector, timeout=-1):
"""This method is written to check the application is launched otherwise it will wait untill timeout value"""
while timeout > 0:
try:
self.assertTrue(selector, 'inbox')
timeout -= 0.3
except:
raise Exception("Timeout")
sleep(0.3)
def click_on(self, xpath, seconds=0.3): def click_on(self, xpath, seconds=0.3):
"""this methos is used for on_click event with time""" """this method is used for on_click event with time"""
self.cli.click_on(xpath) self.cli.click_on(xpath)
self.cli.sleep(seconds) self.cli.sleep(seconds)

View File

@ -1,4 +1,3 @@
from tkinter.constants import S
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
from .common import ordered from .common import ordered
@ -120,14 +119,14 @@ class AddressBook(TeleniumTestProcess):
# Checking current screen # Checking current screen
self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2) self.assertExists("//AddressBook[@name~=\"addressbook\"]", timeout=2)
# Swipe to delete # Swipe to delete
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True') self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True')
self.drag( self.drag(
'//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
'//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') '//MDList[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]')
# Click on trash-can icon # Click on trash-can icon
self.cli.wait_click('//MDList[0]//SwipeToDeleteItem[0]', timeout=3) self.cli.wait_click('//MDList[0]//SwipeToDeleteItem[0]', timeout=3)
# Checking the trash icon is acrivated # Checking the trash icon is acrivated
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False')
# Click on trash icon # Click on trash icon
self.cli.click_on('//MDList[0]//MDIconButton[@icon=\"delete-forever\"]') self.cli.click_on('//MDList[0]//MDIconButton[@icon=\"delete-forever\"]')
# Checking current screen # Checking current screen

View File

@ -7,8 +7,13 @@ class AllMailMessage(TeleniumTestProcess):
@ordered @ordered
def test_show_allmail_list(self): def test_show_allmail_list(self):
"""Show All Messages on Mail Screen/Window""" """Show All Messages on Mail Screen/Window"""
print("=====================Test -Show Messages Of Mail Screen=====================") try:
self.cli.sleep(8) # checking current screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
except:
self.cli.sleep(8)
# checking current screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer # checking state of Nav drawer
@ -16,20 +21,17 @@ class AllMailMessage(TeleniumTestProcess):
# this is for opening All Mail screen # this is for opening All Mail screen
self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5) self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5)
# Assert for checking Current Screen(All mail) # Assert for checking Current Screen(All mail)
self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)
@ordered @ordered
def test_delete_message_from_allmail_list(self): def test_delete_message_from_allmail_list(self):
"""Delete Message From Message body of Mail Screen/Window""" """Delete Message From Message body of Mail Screen/Window"""
print("=====================Test -Delete Messages Of Mail Screen=====================")
# Assert for checking Current Screen(All mail)
self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=2)
# click on a Message to get message details screen # click on a Message to get message details screen
self.cli.wait_click( self.cli.wait_click(
'//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=3) '//MDList[0]/CustomSwipeToDeleteItem[0]', timeout=3)
# Assert for checking Current Screen(Mail Detail) # Assert for checking Current Screen(Mail Detail)
self.assertExists("//MailDetail[@name~=\"mailDetail\"]", timeout=3) self.assertExists("//ScreenManager[@current=\"mailDetail\"]", timeout=5)
# CLicking on Trash-Can icon to delete Message # CLicking on Trash-Can icon to delete Message
self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5) self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5)
# After deleting msg, screen is redirected to All mail screen # After deleting msg, screen is redirected to All mail screen
self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)

View File

@ -1,13 +1,17 @@
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
class NetwrokStatusScreen(TeleniumTestProcess): class NetworkStatusScreen(TeleniumTestProcess):
"""NetwrokStatus Screen Functionality Testing""" """NetwrokStatus Screen Functionality Testing"""
def test_network_status(self): def test_network_status(self):
"""Show NetwrokStatus""" """Show Netwrok Status"""
print("=====================Test -Show NetwrokStatus=====================") try:
self.cli.sleep(8) # checking current screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
except:
self.cli.sleep(8)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2)
# checking state of Nav drawer # checking state of Nav drawer
@ -18,9 +22,9 @@ class NetwrokStatusScreen(TeleniumTestProcess):
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# Clicking on Network Status tab # Clicking on Network Status tab
self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=2) self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=2)
# Checking for current screen (Network Status) # checking current screen
self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2)
# Clicking on Processes Tab # Clicking on Processes Tab
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=1) self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=2)
# Checking for current screen (Network Status) # this is for checking current screen
self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2)

View File

@ -1,3 +1,4 @@
from requests import sessions
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
@ -6,8 +7,12 @@ class PaymentScreen(TeleniumTestProcess):
def test_select_subscripton(self): def test_select_subscripton(self):
"""Select Subscripton From List of Subscriptons""" """Select Subscripton From List of Subscriptons"""
print("=====================Test -Select Subscripton From List of Subscriptons=====================") try:
self.cli.sleep(8) # checking current screen
self.assertExists("//Scre enManager[@current=\"inbox\"]", timeout=5)
except:
self.cli.sleep(8)
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer # checking state of Nav drawer
@ -19,9 +24,9 @@ class PaymentScreen(TeleniumTestProcess):
# this is for opening Payment screen # this is for opening Payment screen
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2) self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2)
# Assert for checking Current Screen # Assert for checking Current Screen
self.assertExists("//Payment[@name~=\"payment\"]", timeout=3) self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3)
# Scrolling Down Product list # Scrolling Down Product list
self.cli.sleep(0.5) self.click_on('//ProductCategoryLayout[0]/ProductLayout[1]', seconds=1)
self.drag( self.drag(
'//ProductCategoryLayout[0]/ProductLayout[1]', '//ProductCategoryLayout[0]/ProductLayout[1]',
'//ProductCategoryLayout[0]/ProductLayout[0]') '//ProductCategoryLayout[0]/ProductLayout[0]')
@ -36,4 +41,4 @@ class PaymentScreen(TeleniumTestProcess):
# Click out side to dismiss the popup # Click out side to dismiss the popup
self.cli.wait_click('//MDRaisedButton[3]', timeout=2) self.cli.wait_click('//MDRaisedButton[3]', timeout=2)
# Checking Current screen(Payment screen) # Checking Current screen(Payment screen)
self.assertExists("//Payment[@name~=\"payment\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3)

View File

@ -6,19 +6,20 @@ class SettingScreen(TeleniumTestProcess):
def test_setting_screen(self): def test_setting_screen(self):
"""Show Setting Screen""" """Show Setting Screen"""
print("=====================Test -Show Setting Screen=====================") # self.cli.sleep(8)
self.cli.sleep(8) self.assertCheck_app_launch('//ScreenManager[@current]', timeout=5)
# this is for checking current screen # print(self.assertTrue('//ScreenManager[@current]', 'inbox'), "self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')self.assertTrue('//ScreenManager[@current]', 'inbox')")
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3) # self.assertTrue('//ScreenManager[@current]', 'inbox')
# self.assertCheck_app_launch('//ScreenManager[@current=\"inbox\"]', timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2)
# checking state of Nav drawer # checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2)
# this is for scrolling Nav drawer # this is for scrolling Nav drawer
self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]") self.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]")
# assert for checking scroll funcation # assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3) self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
# this is for opening setting screen # this is for opening setting screen
self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=1) self.cli.wait_click('//NavigationItem[@text=\"Settings\"]', timeout=3)
# Checking current screen # Checking current screen
self.assertExists("//Setting[@name~=\"set\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"set\"]", timeout=2)

View File

@ -1,46 +1,48 @@
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
class TrashMessage(TeleniumTestProcess): class TrashMessage(TeleniumTestProcess):
"""Trash Screen Functionality Testing""" """Trash Screen Functionality Testing"""
def test_delete_trash_message(self): def test_delete_trash_message(self):
"""Delete Trash message permanently from trash message listing""" """Delete Trash message permanently from trash message listing"""
print("=====================Test -Delete Message From Trash Message Listing=====================") try:
self.cli.sleep(8) # checking current screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
except:
self.cli.sleep(8)
# checking current screen
self.assertExists("//ScreenManager[@current=\"inbox\"]", timeout=5)
# this is for opening Nav drawer # this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5) self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
# checking state of Nav drawer # checking state of Nav drawer
self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=2) self.assertExists("//MDNavigationDrawer[@state~=\"open\"]", timeout=5)
# this is for opening Trash screen # this is for opening Trash screen
self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=2) self.click_on('//NavigationItem[@text=\"Trash\"]', seconds=2)
# self.cli.click_on('//NavigationItem[4]') # checking current screen(Trash Screen)
# Checking Trash Screen self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=3)
self.assertExists("//Trash[@name~=\"trash\"]", timeout=5)
# Transition Effect taking time, so halt is required
self.cli.sleep(2)
# Checking Trash Icon is in disable state # Checking Trash Icon is in disable state
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True') self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'True')
# This is for swiping message to activate delete icon. # This is for swiping message to activate delete icon.
self.drag( self.drag(
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]')
# Assert to check the drag is worked (Trash icon Activated) # Assert to check the drag is worked (Trash icon Activated)
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False')
# 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. # Checking the Trash Icon after swipe.
self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2) self.assertExists("//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2)
# Clicking on Trash icon to open Confirm delete pop up
self.click_on('//MDList[0]/CustomSwipeToDeleteItem[0]', seconds=1)
# Checking Confirm delete Popup is Opened
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', 'True')
# clicking on Trash Box icon to delete message. # clicking on Trash Box icon to delete message.
self.cli.wait_click('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2) self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2)
# Checking the popup box screen. # Checking the popup screen is closed.
self.assertExists("//MDDialog//MDFlatButton[@text=\"Yes\"]", timeout=2) self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', 'False')
# Clicking on 'Yes' Button on Popup to confirm delete. # Clicking on 'Yes' Button on Popup to confirm delete.
self.click_on('//MDFlatButton[@text=\"Yes\"]', seconds=1.1) self.click_on('//MDFlatButton[@text=\"Yes\"]', seconds=1.1)
# Checking Pop is closed # checking current screen(Trash Screen)
self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False) self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=2)
# Checking Trash Screen total_trash_msgs = len(self.cli.select("//CustomSwipeToDeleteItem"))
self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) # Checking messages count after delete.
total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem"))
# Checking the number of messages after delete.
self.assertEqual(total_trash_msgs, 1) self.assertEqual(total_trash_msgs, 1)