コード例 #1
0
ファイル: test_gui.py プロジェクト: marmistrz/gourmet
 def testEditingNewCard (self):
     dp.focus.application(APPNAME)
     dp.focus.frame('Gourmet Recipe Manager')
     #dp.keyCombo('<Ctrl>n')
     dp.click('File')
     dp.click('New')
     dp.focus.frame(u'New Recipe (Edit)')
     dp.keyCombo('<Alt>l')
     dp.focus.widget('Title Entry')
     time.sleep(1)
     dp.type('Testing!')
     dp.focus.widget('Preparation Time Entry')
     time.sleep(1)
     dp.type('30 minutes')
     dp.focus.widget('Rating Entry')
     time.sleep(1)
     dp.type('4')
     screenshot('Edited_recipe.png')
     #dp.keyCombo('<Ctrl>w')
     dp.click("Recipe")
     dp.click("Close")
     screenshot('save_changes_to_edited_rec.png')
     dp.focus.dialog('Question')
     #dp.keyCombo('<Alt>C')
     dp.click("Cancel")
     #self.assertEqual(hasattr(rc,'recipe_editor'),True,'Cancelling save-changes did not work')
     dp.focus.frame(u'New Recipe (Edit)')
     time.sleep(3)
     dp.keyCombo('<Ctrl>w')
     time.sleep(3)
     dp.focus.dialog('Question')
     dp.keyCombo('<Alt>s')
     screenshot('new_rec_saved.png')
コード例 #2
0
ファイル: test_procedural.py プロジェクト: Lorquas/dogtail
    def testDeselect(self):
        type('Icon View')
        click('Icon View')
        type('+')
        self.runDemo('Icon View Basics')
        focus.window('GtkIconView demo')

        focus.widget(roleName='icon')
        select()
        deselect()
        self.assertFalse(focus.widget.isSelected)
コード例 #3
0
ファイル: test_gui.py プロジェクト: marmistrz/gourmet
 def testShoppingListGenerationFromCard (self):
     # Test multiplication + no multiplication
     self.focus_nth_recipe()
     dp.keyCombo('<Ctrl>o') # open recipe card
     dp.focus.frame('')
     dp.click('Actions')
     dp.click('Shop') # using shop button
     dp.focus.frame('Shopping List')
     screenshot('add-to-shopping-list-from-card-w-button.png')
     dp.keyCombo('<Ctrl>w')
     dp.focus.frame('')
     dp.click('Recipe')
     dp.click("Add to Shopping List") # from menu
     dp.focus.frame('Shopping List')
     screenshot('add-to-shopping-list-from-card-w-menu.png')
     screenshot('Adding Shopping List from Card')
     dp.keyCombo('<Ctrl>w')
     dp.focus.frame('')
     dp.keyCombo('<Alt>y')
     dp.focus.text()
     dp.type('12') # double...
     dp.keyCombo('<Ctrl>l') # from keyboard
     dp.keyCombo('<Return>')
     screenshot('add-to-shopping-list-from-card-w-keyboard-multiplied-by-2.png')
     dp.keyCombo('<Ctrl>w')
コード例 #4
0
    def test_deselect(self):
        type('Icon View')
        click('Icon View')
        type('+')
        sleep(0.5)
        self.runDemo('Icon View Basics')
        try:
            wnd = self.app.child('GtkIconView demo', roleName='frame', recursive=False, retry=False)
        except SearchError:
            wnd = self.app.child('Icon View Basics', roleName='frame', recursive=False, retry=False)
        focus.window(wnd.name)

        focus.widget(roleName='icon')
        select()
        deselect()
        self.assertFalse(focus.widget.isSelected)
コード例 #5
0
ファイル: test_gui.py プロジェクト: marmistrz/gourmet
 def do_testFileImport (self, fn):
     shortname = os.path.split(fn)[1]
     dp.focus.application(APPNAME)
     dp.focus.frame('Gourmet Recipe Manager')
     dp.click("File")
     dp.click("Import file")
     dp.focus.dialog('Open recipe...')
     dp.keyCombo("<Alt>l")
     dp.type(fn)
     screenshot('import_dialog-%s-.png'%shortname)
     dp.keyCombo("Return")
     time.sleep(5) # wait for import to complete...
     print 'DONE SLEEPING -- IMPORT SHOULD BE DONE!'
     screenshot('import_done-%s.png'%shortname)
     dp.keyCombo("<Alt>C") # close dialog
     dp.focus.frame('Gourmet Recipe Manager')
     screenshot('with_imported_recs-%s.png'%shortname)
コード例 #6
0
ファイル: ffsettings.py プロジェクト: dev344/Daskalos
	def mainProgram(self):
		""" In this function things are hardcoded a bit.Also dogtail modules are imported inside.
		"""
		####types####
		# observer : object of class Observer
		# children_of_firefox : list of objects of class Accessibility.Accessible    
		# prefWindowNum,newWindowNum : integer
		# frameName = string
		
		from observer import Observer
		from dogtail.procedural import FocusApplication, click                             
		import dogtail.rawinput
	
		observer = Observer()                              
	
	
		observer.openWindowFromMenu(['Applications', 'Internet', 'Firefox Web Browser'])
		if(not observer.isFocussed('Firefox')):                         #if i can somehow avoid such statements i can make this code more general i think
			raise Error("Could not focus Firefox")       
    
		children_of_firefox = FocusApplication.node.children
		newWindowNum = len(children_of_firefox) - 1
		frameName = children_of_firefox[newWindowNum].name
		if(not observer.frameFocussed(frameName)): 
			raise Error("Could not focus frame " + frameName)
		
		click('Edit', roleName='menu')
		click('Preferences', roleName='menu item')
		time.sleep(2)
		children_of_firefox = FocusApplication.node.children
		prefWindowNum = len(children_of_firefox) - 1
		if(prefWindowNum <= newWindowNum ): 
			raise Error("Preference window did not open.Please make sure nothing interferes with the focussing of the created window.")        
		prefWindow = children_of_firefox[prefWindowNum].name
		if(not(prefWindow == "Firefox Preferences")):                     #double-check.Can also be removed to make the code more general
			raise Error("Preference Window did not open")
		if(not observer.frameFocussed(prefWindow)): 
			raise Error("Could not focus frame " + prefWindow)
		
		click('Advanced')
		time.sleep(1)
		click('Network')
		time.sleep(1)
		scroll_pane = children_of_firefox[prefWindowNum].children
		panel = scroll_pane[7].children       #scroll_pane[7] is Advanced options
		scroll_pane2 = panel[0].children    
		panel2 = scroll_pane2[2].children
		next_child = panel2[0].children       #panel2 is Connection option in Network option in Advanced options
		settings = next_child[2]
		x,y = settings.position
		dogtail.rawinput.click(x, y, 1)
		children_of_firefox = FocusApplication.node.children
		cntnsWindowNum = len(children_of_firefox) - 1
		cnctn_sttngs_win = children_of_firefox[cntnsWindowNum].name
		if(not observer.frameFocussed(cnctn_sttngs_win)): 
			raise Error("Could not focus frame " + cnctn_sttngs_win)
コード例 #7
0
ファイル: test_gui.py プロジェクト: marmistrz/gourmet
 def do_testWebImport (self, url):
     shortname = url.split('/')[-1]
     dp.focus.application(APPNAME)
     dp.focus.frame('Gourmet Recipe Manager')
     dp.click("File")
     dp.click('Import webpage')
     time.sleep(2)
     dp.focus.frame('Enter website address')
     print 'TYPING URL!'
     dp.type(url)
     dp.keyCombo("Return")
     time.sleep(1)
     screenshot('manual_web_import-%s.png'%shortname)
     dp.click('OK')
     screenshot('manual_web_import_done-%s.png'%shortname)
     dp.focus.dialog('Gourmet Import/Export')
     dp.click('Close')
コード例 #8
0
ファイル: test_gui.py プロジェクト: marmistrz/gourmet
 def testShoppingListGenerationFromIndex (self):
     self.focus_nth_recipe(0)
     dp.click('Actions')
     dp.click('Add to Shopping List')
     screenshot('generate_shopping_list_from_index.png')
     dp.focus.dialog('')
     dp.click('OK')
     screenshot('generated_shopping_list_from_index.png')
     dp.focus.frame('Shopping List')
     dp.keyCombo('<Ctrl>w')
     # Add a second recipe to the list...
     self.focus_nth_recipe(1)
     dp.keyCombo('<Ctrl>l') # Add with keycombo...
     dp.focus.dialog('')
     dp.focus.text()
     dp.type('12')
     dp.keyCombo('<Return>')
     screenshot('shopping list With two recipes+mult.png')
     dp.keyCombo('<Ctrl>w')
コード例 #9
0
ファイル: test_procedural.py プロジェクト: vhumpa/dogtail
 def test_click(self):
     click('Source')
     self.assertTrue(focus.widget.isSelected)
コード例 #10
0
ファイル: test_procedural.py プロジェクト: Lorquas/dogtail
 def testClickWithRaw(self):
     click('Source', raw=True)
     self.assertTrue(focus.widget.isSelected)
コード例 #11
0
ファイル: test_procedural.py プロジェクト: Lorquas/dogtail
 def testClick(self):
     click('Source')
     self.assertTrue(focus.widget.isSelected)
コード例 #12
0
 def test_click_with_raw(self):
     click('Source', raw=True)
     self.assertTrue(focus.widget.isSelected)
コード例 #13
0
 def test_click_on_invisible_element(self):
     with self.assertRaises(ValueError):
         click("Spinner")
コード例 #14
0
ファイル: test_procedural.py プロジェクト: unal55/dogtail
 def test_click_with_raw(self):
     click('Source', raw=True)
     self.assertTrue(focus.widget.isSelected)
コード例 #15
0
ファイル: test_procedural.py プロジェクト: unal55/dogtail
 def test_click_on_invisible_element(self):
     with self.assertRaises(ValueError):
         click("Transparent")
コード例 #16
0
 def test_click_on_invisible_element(self):
     with self.assertRaises(ValueError):
         click("Spinner")