Kivy[Trash box]

This commit is contained in:
shekhar-cis 2021-10-13 13:11:37 +05:30
parent 9c1a814602
commit 7abb2bc55c
Signed by untrusted user: shekhar-cis
GPG Key ID: 8B2A6C8D5F7F1635

View File

@ -1,3 +1,4 @@
import pdb
from .telenium_process import TeleniumTestProcess from .telenium_process import TeleniumTestProcess
class TrashMessage(TeleniumTestProcess): class TrashMessage(TeleniumTestProcess):
@ -5,42 +6,66 @@ class TrashMessage(TeleniumTestProcess):
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=====================") # Checking current Screen(Inbox screen)
self.cli.sleep(8) self.assert_wait_no_except('//ScreenManager[@current]', timeout=15, value='inbox')
# Checking "Menu" is rendered
self.assertExists('//MDActionTopAppBarButton[@icon=\"menu\"]', 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.cli.wait_click('//NavigationItem[@text=\"Trash\"]', timeout=2)
# self.cli.click_on('//NavigationItem[4]') # self.cli.click_on('//NavigationItem[4]')
# Checking Trash Screen # Checking Trash Screen
self.assertExists("//Trash[@name~=\"trash\"]", timeout=5) self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=5)
# Transition Effect taking time, so halt is required # import pdb; pdb.set_trace()
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.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'disabled'), True)
# This is for swiping message to activate delete icon. # This is for swiping message to activate delete icon.
self.drag( self.cli.wait_drag('//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2, timeout=5)
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', # self.assertExists('//Trash[0]//TwoLineAvatarIconListItem', timeout=3)
'//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]') # self.cli.wait_drag('//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[1]', '//Trash[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2, timeout=5)
# Assert to check the drag is worked (Trash icon Activated) # self.cli.wait(self.cli.wait_click('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', timeout=2))
self.assertTrue('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'False') # Assert to check the drag is worked (Trash icon should be Activated)
# Checking Popup is Opened # self.cli.wait('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]', timeout=5)
self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), True) # self.cli.setattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton', 'disabled', False)
self.click_on('//MDList[0]/CutsomSwipeToDeleteItem[0]', seconds=1) # self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'disabled'), False)
# Checking the Trash Icon after swipe.
self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2) self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2)
self.cli.setattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', 'disabled', False)
# if self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'disabled') is True:
# self.cli.setattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton', 'disabled', False)
# else:
# self.assertExists('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton', timeout=5)
# self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'disabled'), False)
# Checking the Trash Icon after swipe.
# self.assertExists("//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon~=\"trash-can\"]", timeout=2)
# self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@icon]', 'disabled')
# self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[@disabled]', 'disabled'), False)
self.assertNotExists('//MDDialog[@open]', timeout=5)
self.assertExists('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=5)
import pdb; pdb.set_trace()
# 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]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=5)
# Checking the popup box screen. # Checking Confirm Popup is Opened
self.assertExists("//MDDialog//MDFlatButton[@text=\"Yes\"]", timeout=2) self.assertExists('//MDDialog[@open]', timeout=5)
# Checking the popup button is rendered.
self.assertExists("//MDDialog//MDFlatButton[@text=\"Yes\"]", timeout=5)
# 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.cli.wait_click('//MDFlatButton[@text=\"Yes\"]', timeout=5)
# self.cli.wait('//Trash[0]//TwoLineAvatarIconListItem', timeout=5)
# Checking Pop is closed # Checking Pop is closed
self.assertEqual(self.cli.getattr('//MDList[0]/CutsomSwipeToDeleteItem[0]', '_opens_process'), False) self.assertNotExists('//MDDialog[@open]', timeout=5)
# self.assertExists('//MDList[0]/CutsomSwipeToDeleteItem[0]//MDIconButton[0]', timeout=5)
self.assertExists('//MDList[0]/CutsomSwipeToDeleteItem[0]', timeout=5)
# self.assertNotExists('//MDDialog', timeout=5)
# self.assertExists('//Trash[0]//TwoLineAvatarIconListItem[0]', timeout=3)
# Checking Trash Screen # Checking Trash Screen
self.assertExists("//Trash[@name~=\"trash\"]", timeout=2) self.assertExists("//ScreenManager[@current=\"trash\"]", timeout=5)
total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem")) # print(len(self.cli.select("//Trash[0]//CutsomSwipeToDeleteItem")),'__________________-------')
# Checking the number of messages after delete. # total_trash_msgs = len(self.cli.select("//CutsomSwipeToDeleteItem"))
self.assertEqual(total_trash_msgs, 1) # Checking the message count of messages of draft screen after delete.
# self.assertEqual(len(self.cli.select("//Trash[0]//CutsomSwipeToDeleteItem")), 1)
# self.cli.sleep(5)