Best Python code snippet using robotframework-pageobjects_python
editor_test.py
Source:editor_test.py
...26 def test_run(self):27 """Search in runs."""28 self._finder.set_search_domain('run')29 for r in self._runs:30 self._finder.set_search_term(r.id)31 self.assertEquals([self._run_tuple(self._runs.index(r))], 32 self._finder.get_results()33 )34 def test_sicard(self):35 """Search in sicards."""36 self._finder.set_search_domain('sicard')37 for r in self._runs:38 self._finder.set_search_term(r.sicard.id)39 self.assertEquals([self._run_tuple(self._runs.index(r))], 40 self._finder.get_results()41 )42 self._finder.set_search_term('abc')43 self.assertEquals([], self._finder.get_results())44 self._finder.set_search_term(u'xyz')45 self.assertEquals([], self._finder.get_results())46 self._finder.set_search_term(0)47 self.assertEquals([], self._finder.get_results())48 self._finder.set_search_term([])49 self.assertEquals([], self._finder.get_results())50 def test_runner(self):51 """Search in runners."""52 self._finder.set_search_domain('runner')53 # Search for full given name54 hanses = [self._run_tuple(0),55 self._run_tuple(2),56 ]57 self._finder.set_search_term("Hans")58 self.assertEquals(hanses,59 self._finder.get_results()60 )61 self._finder.set_search_term("hans")62 self.assertEquals(hanses,63 self._finder.get_results()64 )65 # Search for number66 self._finder.set_search_term("102")67 self.assertEquals([(self._runs[1].id,68 "A",69 "unknown",70 "102",71 "Trudi Gerster",72 "The best team ever",73 "D135",74 )],75 self._finder.get_results()76 )77 # Search for runner by given and surname78 result = [(self._runs[4].id,79 "A",80 "unknown",81 "unknown",82 "Dada Gugus",83 "unknown",84 "HAM",85 )]86 self._finder.set_search_term("Gugus Dada")87 self.assertEquals(result,88 self._finder.get_results()89 )90 self._finder.set_search_term("Dada Gugus")91 self.assertEquals(result,92 self._finder.get_results()93 )94 self._finder.set_search_term("Da Gu")95 self.assertEquals(result, self._finder.get_results())96 def test_team(self):97 """Search in teams."""98 self._finder.set_search_domain('team')99 team_runs = [ self._run_tuple(i) 100 for i in range(3)101 ]102 self._finder.set_search_term('1')103 self.assertEquals(team_runs, self._finder.get_results())104 self._finder.set_search_term('best')105 self.assertEquals(team_runs, self._finder.get_results())106 def test_category(self):107 """Search in categories."""108 self._finder.set_search_domain('category')109 HAM = [self._run_tuple(i)110 for i in range(6)]111 self._finder.set_search_term('HAM')112 self.assertEquals(HAM, self._finder.get_results())113 self._finder.set_search_term('HA')114 self.assertEquals([], self._finder.get_results())115 self._finder.set_search_term('D135')116 self.assertEquals([self._run_tuple(i) for i in range(3)],117 self._finder.get_results())118 def test_course(self):119 """Search in courses."""120 self._finder.set_search_domain('course')121 self._finder.set_search_term('A')122 self.assertEquals([self._run_tuple(i) for i in range(6)],123 self._finder.get_results())124 def test_run_without_runner(self):125 """Test that runs without a runner and a course"""126 self._finder.set_search_domain('sicard')127 self._finder.set_search_term(9999)128 self.assertEquals([self._run_tuple(6)],129 self._finder.get_results())130 def _run_tuple(self, run_id):131 """132 @param run_id Index of the run in self._runs133 @return Tuple formatted like RunFinder.get_results()"""134 r = self._runs[run_id]135 number = r.sicard.runner and r.sicard.runner.number or None136 team = r.sicard.runner and r.sicard.runner.team or None137 runner = r.sicard.runner138 return (r.id,139 r.course and unicode(r.course.code) or "unknown",140 "unknown",141 number and unicode(number) or "unknown",...
searchtree.py
Source:searchtree.py
...34 self._search_timeout = None35 self.search_entry.connect('icon-press', self.hide_search)36 self.search_entry.connect('changed', self.on_entry_changed)37 self.search_entry.connect('key-press-event', self.on_entry_key_press)38 def set_search_term(self, text):39 self.model.set_search_term(text)40 self._search_timeout = None41 return False42 def on_entry_changed(self, editable):43 if self.search_box.get_property('visible'):44 if self._search_timeout is not None:45 GLib.source_remove(self._search_timeout)46 self._search_timeout = GLib.timeout_add(47 self.config.ui.gtk.live_search_delay,48 self.set_search_term, editable.get_chars(0, -1))49 def on_entry_key_press(self, editable, event):50 if event.keyval == Gdk.KEY_Escape:51 self.hide_search()52 return True53 def hide_search(self, *args):54 if self._search_timeout is not None:55 GLib.source_remove(self._search_timeout)56 self._search_timeout = None57 if not self.config.ui.gtk.search_always_visible:58 self.search_box.hide()59 self.search_entry.set_text('')60 self.model.set_search_term(None)61 self.tree.grab_focus()62 def show_search(self, input_char=None, grab_focus=True):63 self.search_box.show()64 if input_char:65 self.search_entry.insert_text(input_char, -1)66 if grab_focus:67 self.search_entry.grab_focus()...
test_search.py
Source:test_search.py
...17 # For cleanup, quit the driver18 driver.quit()19 def test_search_001(self,browser):20 self.search = DuckDuckGo(browser)21 self.search.set_search_term(word)22 self.search.click_search_button()23 def test_page_title_002(self,browser):24 self.home = DuckDuckGo(browser)25 self.home.set_search_term(word)26 self.home.click_search_button()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!