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

View File

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

View File

@ -16,7 +16,7 @@ import state
from bitmessagekivy.baseclass.common import (
toast, showLimitedCnt, ThemeClsColor,
CutsomSwipeToDeleteItem, ShowTimeHistoy,
CustomSwipeToDeleteItem, ShowTimeHistoy,
avatarImageFirstLetter
)
@ -85,7 +85,7 @@ class Trash(Screen):
for item in self.trash_messages:
subject = item[2].decode() if isinstance(item[2], bytes) else item[2]
body = item[3].decode() if isinstance(item[3], bytes) else item[3]
message_row = CutsomSwipeToDeleteItem(
message_row = CustomSwipeToDeleteItem(
text=item[1],
)
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]
<CutsomSwipeToDeleteItem>:
<CustomSwipeToDeleteItem>:
size_hint_y: None
height: content.height

View File

@ -6,6 +6,7 @@ import os
import shutil
import tempfile
from time import time, sleep
from turtle import Turtle, pd
from telenium.tests import TeleniumTestCase
@ -63,8 +64,18 @@ class TeleniumTestProcess(TeleniumTestCase):
pass
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):
"""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.sleep(seconds)

View File

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

View File

@ -7,8 +7,13 @@ class AllMailMessage(TeleniumTestProcess):
@ordered
def test_show_allmail_list(self):
"""Show All Messages on Mail Screen/Window"""
print("=====================Test -Show Messages Of Mail Screen=====================")
try:
# 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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer
@ -16,20 +21,17 @@ class AllMailMessage(TeleniumTestProcess):
# this is for opening All Mail screen
self.cli.wait_click('//NavigationItem[@text=\"All Mails\"]', timeout=5)
# Assert for checking Current Screen(All mail)
self.assertExists("//Allmails[@name~=\"allmails\"]", timeout=5)
self.assertExists("//ScreenManager[@current=\"allmails\"]", timeout=5)
@ordered
def test_delete_message_from_allmail_list(self):
"""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
self.cli.wait_click(
'//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=3)
'//MDList[0]/CustomSwipeToDeleteItem[0]', timeout=3)
# 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
self.cli.wait_click('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[@icon=\"delete-forever\"]', timeout=5)
# 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
class NetwrokStatusScreen(TeleniumTestProcess):
class NetworkStatusScreen(TeleniumTestProcess):
"""NetwrokStatus Screen Functionality Testing"""
def test_network_status(self):
"""Show NetwrokStatus"""
print("=====================Test -Show NetwrokStatus=====================")
"""Show Netwrok Status"""
try:
# 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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2)
# checking state of Nav drawer
@ -18,9 +22,9 @@ class NetwrokStatusScreen(TeleniumTestProcess):
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# Clicking on Network Status tab
self.cli.wait_click('//NavigationItem[@text=\"Network status\"]', timeout=2)
# Checking for current screen (Network Status)
self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2)
# checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2)
# Clicking on Processes Tab
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=1)
# Checking for current screen (Network Status)
self.assertExists("//NetworkStat[@name~=\"networkstat\"]", timeout=2)
self.cli.wait_click('//NetworkStat/MDTabs[0]//MDTabsLabel[@text=\"Processes\"]', timeout=2)
# this is for checking current screen
self.assertExists("//ScreenManager[@current=\"networkstat\"]", timeout=2)

View File

@ -1,3 +1,4 @@
from requests import sessions
from .telenium_process import TeleniumTestProcess
@ -6,8 +7,12 @@ class PaymentScreen(TeleniumTestProcess):
def test_select_subscripton(self):
"""Select Subscripton From List of Subscriptons"""
print("=====================Test -Select Subscripton From List of Subscriptons=====================")
try:
# 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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=3)
# checking state of Nav drawer
@ -19,9 +24,9 @@ class PaymentScreen(TeleniumTestProcess):
# this is for opening Payment screen
self.cli.wait_click('//NavigationItem[@text=\"Purchase\"]', timeout=2)
# Assert for checking Current Screen
self.assertExists("//Payment[@name~=\"payment\"]", timeout=3)
self.assertExists("//ScreenManager[@current=\"payment\"]", timeout=3)
# Scrolling Down Product list
self.cli.sleep(0.5)
self.click_on('//ProductCategoryLayout[0]/ProductLayout[1]', seconds=1)
self.drag(
'//ProductCategoryLayout[0]/ProductLayout[1]',
'//ProductCategoryLayout[0]/ProductLayout[0]')
@ -36,4 +41,4 @@ class PaymentScreen(TeleniumTestProcess):
# Click out side to dismiss the popup
self.cli.wait_click('//MDRaisedButton[3]', timeout=2)
# 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):
"""Show Setting Screen"""
print("=====================Test -Show Setting Screen=====================")
self.cli.sleep(8)
# this is for checking current screen
self.assertExists("//Inbox[@name~=\"inbox\"]", timeout=3)
# self.cli.sleep(8)
self.assertCheck_app_launch('//ScreenManager[@current]', timeout=5)
# 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.assertTrue('//ScreenManager[@current]', 'inbox')
# self.assertCheck_app_launch('//ScreenManager[@current=\"inbox\"]', timeout=5)
# this is for opening Nav drawer
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=2)
# checking state of Nav drawer
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
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=3)
# assert for checking scroll function
self.assertCheckScrollDown('//ContentNavigationDrawer//ScrollView[0]', timeout=5)
# 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
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
class TrashMessage(TeleniumTestProcess):
"""Trash Screen Functionality Testing"""
def test_delete_trash_message(self):
"""Delete Trash message permanently from trash message listing"""
print("=====================Test -Delete Message From Trash Message Listing=====================")
try:
# 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
self.cli.wait_click('//MDActionTopAppBarButton[@icon=\"menu\"]', timeout=5)
# 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
self.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=2)
# self.cli.click_on('//NavigationItem[4]')
# Checking Trash Screen
self.assertExists("//Trash[@name~=\"trash\"]", timeout=5)
# Transition Effect taking time, so halt is required
self.cli.sleep(2)
self.click_on('//NavigationItem[@text=\"Trash\"]', seconds=2)
# checking current screen(Trash Screen)
self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=3)
# 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.
self.drag(
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]',
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]')
# Assert to check the drag is worked (Trash icon Activated)
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[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)
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False')
# 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.
self.cli.wait_click('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2)
# Checking the popup box screen.
self.assertExists("//MDDialog//MDFlatButton[@text=\"Yes\"]", timeout=2)
self.cli.wait_click('//MDList[0]/CustomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=2)
# Checking the popup screen is closed.
self.assertTrue('//MDList[0]/CustomSwipeToDeleteItem[@_opens_process]', 'False')
# Clicking on 'Yes' Button on Popup to confirm delete.
self.click_on('//MDFlatButton[@text=\"Yes\"]', seconds=1.1)
# Checking Pop is closed
self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False)
# Checking Trash Screen
self.assertExists("//Trash[@name~=\"trash\"]", timeout=2)
total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem"))
# Checking the number of messages after delete.
# checking current screen(Trash Screen)
self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=2)
total_trash_msgs = len(self.cli.select("//CustomSwipeToDeleteItem"))
# Checking messages count after delete.
self.assertEqual(total_trash_msgs, 1)