How to use assert_element method in SeleniumBase

Best Python code snippet using SeleniumBase

volvox_biodb_test.py

Source:volvox_biodb_test.py Github

copy

Full Screen

...23 self.sequence()24 # test that the frame usage track claims to have links to NCBI25 self.turn_on_track( 'HTMLFeatures - mRNAs' )26 self.do_typed_query('ctgA:2,381..21,220')27 self.assert_element("//div[contains(@title,'Search for Apple3 at NCBI')]")28 self.turn_off_track( 'HTMLFeatures - mRNAs' )29 # test bigwig30 self.bigwig()31 # test data export32 self.export()33 # test bam34 self.bam()35 # test cram36 self.cram()37 # test vcf38 self.vcf()39 # test CanvasFeatures tracks40 self.canvasfeatures()41 # test search tracks42 self.search_track()43 # test combination tracks44 self.combination()45 def canvasfeatures( self ):46 # turn on CanvasFeatures tracks and make sure they are created47 self.do_typed_query( 'Apple1' )48 self.click_search_disambiguation('CanvasFeatures','Go')49 self.turn_on_track('CanvasFeatures - Protein-coding genes')50 self.assert_elements("//div[@id='track_Genes']//canvas")51 self.assert_elements("//div[@id='track_CDS']//canvas")52 self.assert_no_js_errors()53 self.turn_off_track('CanvasFeatures - mixed')54 # test left-clicking on CanvasFeatures track55 self.do_typed_query( 'ctgA:1049..9000' )56 self.assert_no_element("//*[@class='dijitDialogTitle'][contains(text(), 'details')]")57 canvas = self.assert_element("//div[@id='track_Genes']/canvas")58 canvas.click()59 self.assert_element("//*[@class='dijitDialogTitle'][contains(text(), 'gene EDEN')]")60 self.close_dialog("gene EDEN")61 self.assert_no_element("//*[@class='dijitDialogTitle'][contains(text(), 'snippet')]")62 # test Canvas-features context menu functionality63 # right-click one of them64 self.actionchains() \65 .context_click(canvas) \66 .perform()67 self.menu_item_click("Popup with content snippet from string (feature EDEN)")68 self.assert_element("//*[@class='dijitDialogTitle'][contains(text(), 'from a JS callback')]")69 self.close_dialog('from a JS callback')70 # turn off canvasFeatures tracks so they're not cluttering everything up71 self.turn_off_track('CanvasFeatures - Protein-coding genes')72 def vcf( self ):73 self.do_typed_query('ctgA:18918..19070')74 self.turn_on_track('VCF - volvox-sorted')75 self.turn_on_track('VCF - additional')76 self.assert_elements("//div[@id='track_volvox_sorted_vcf']//canvas")77 self.assert_elements("//div[@id='track_volvox_vcf_test']//canvas")78 self.turn_off_track('VCF - volvox-sorted')79 self.turn_off_track('VCF - additional')80 def bam( self ):81 self.do_typed_query('ctgA:18918..19070')82 self.turn_on_track('volvox-sorted.bam')83 self.turn_on_track('volvox-sorted SNPs/Coverage')84 self.assert_elements("//div[@id='track_volvox_sorted_bam']//canvas")85 self.assert_elements("//div[@id='track_volvox_sorted_bam_coverage']//canvas")86 self.turn_off_track('volvox-sorted.bam')87 self.turn_off_track('volvox-sorted SNPs/Coverage')88 def cram( self ):89 self.do_typed_query('ctgA:18918..19070')90 self.turn_on_track('volvox-sorted.cram')91 self.assert_elements("//div[@id='track_volvox_sorted_cram']//canvas")92 self.turn_off_track('volvox-sorted.cram')93 def export( self ):94 self.do_typed_query('ctgA')95 self.turn_on_track( 'BigWig XY - volvox_microarray' )96 trackname = 'volvox_microarray_bw_xyplot'97 self.export_track( trackname, 'Visible region','GFF3','View')98 self.close_dialog('export')99 self.export_track( trackname, 'Whole', 'bedGraph', 'Save' )100 time.sleep( 0.5 * JBrowseTest.time_dilation )101 self.export_track( trackname, 'Whole', 'Wiggle', 'Save' )102 self.turn_off_track( 'BigWig XY - volvox_microarray' )103 self.turn_on_track( 'HTMLFeatures - Example Features' )104 trackname = 'ExampleFeatures'105 self.export_track( trackname, 'Visible region','GFF3','View')106 self.close_dialog('export')107 self.export_track( trackname, 'Visible region','BED','Save')108 self.turn_off_track( 'HTMLFeatures - Example Features' )109 self.turn_on_track( 'CanvasFeatures - transcripts' )110 trackname = 'Transcript'111 self.export_track( trackname, 'Visible region', 'GFF3', 'View')112 self.close_dialog('export')113 self.export_track( trackname, 'Visible region', 'BED', 'Save')114 self.turn_off_track( 'CanvasFeatures - transcripts' )115 self.do_typed_query('ctgA:8379..31627')116 self.export_track( 'DNA', 'Visible region','FASTA','View')117 self.assert_no_js_errors()118 self.close_dialog('export')119 self.assert_no_js_errors()120 def bigwig( self ):121 self.turn_on_track('BigWig XY - volvox_microarray')122 self.assert_elements("//div[@id='track_volvox_microarray.bw_xyplot']//canvas")123 self.assert_no_js_errors()124 self.turn_on_track('BigWig Density - volvox_microarray')125 self.assert_elements("//div[@id='track_volvox_microarray.bw_density']//canvas")126 self.assert_no_js_errors()127 self.turn_off_track('BigWig XY - volvox_microarray')128 self.turn_off_track('BigWig Density - volvox_microarray')129 def sequence( self ):130 self.do_typed_query( '0..80' )131 sequence_div_xpath_templ = "//table[contains(@class,'sequence')]//*[contains(.,'%s')]"132 sequence_div_xpath_1 = sequence_div_xpath_templ % 'aacaACGG'133 self.assert_element( sequence_div_xpath_1)134 self.turn_off_track( 'Reference sequence' )135 self.assert_no_element( sequence_div_xpath_1 )136 self.turn_on_track( 'Reference sequence' )137 self.assert_element( sequence_div_xpath_1 )138 self.do_typed_query( '1..20000')139 self.assert_no_element( sequence_div_xpath_1 )140 self.do_typed_query( 'ctgA:19961..20040')141 self.assert_element( sequence_div_xpath_templ % 'ccgcgtgtagtc' )142 def context_menus( self ):143 self.turn_on_track( 'HTMLFeatures - Features with right-click menus' )144 self.do_typed_query( '20147..35574' )145 # check that there is no dialog open146 self.assert_no_element("//*[@class='dijitDialogTitle'][contains(text(),'snippet')]")147 # get the example alignments features148 feature_elements = self.assert_elements("//div[@id='track_malformed_alignments']//div[contains(@class,'plus-feature4')]")149 time.sleep(1*JBrowseTest.time_dilation) # wait a second to make sure their click handlers are installed150 # right-click one of them151 self.actionchains() \152 .context_click(feature_elements[int(len(feature_elements)/2)]) \153 .perform()154 self.menu_item_click( 'Open popup' )155 # check that the proper HTML snippet popped up in the dialog156 self.assert_element("//div[contains(@class,'dijitDialog')]//span[@class='amazingTestSnippet']")157 self.close_dialog('Random XHR')158 # check that the dialog closed159 self.assert_no_element("//*[@class='dijitDialogTitle'][contains(text(),'Random XHR')]")160 self.turn_off_track( 'HTMLFeatures - Features with right-click menus' )161 def click( self ):162 self.turn_on_track('ChromHMM')163 self.assert_elements("//div[@id='track_ChromeHMM']//canvas")164 self.assert_no_js_errors()165 # test left-clicking on CanvasFeatures track166 self.do_typed_query( 'ctgA:20000..30000' )167 self.assert_no_element("//*[@class='featureTooltip'][contains(text(), '15_Quies')]")168 canvas = self.assert_element("//div[@id='track_ChromHMM']/canvas")169 canvas.mouseover()170 self.assert_element("//*[@class='featureTooltip'][contains(text(), '15_Quies')]")171 self.turn_off_track('ChromHMM')172 def search_f15( self ):173 # check that a f15 feature label is not yet in the DOM174 xpath = "//div[contains(@class,'feature-label')]//*[contains(.,'f15')]"175 # check that f15 is not already in the DOM at load time176 self.assert_no_element( xpath )177 self.do_typed_query( "f15" )178 # click "Go" on the first row179 self.click_search_disambiguation('HTMLFeatures','Go')180 # test that f15 appeared in the DOM (TODO: check that it's181 # actually centered in the window), and that the protein-coding182 # genes track is now selected183 assert self.assert_element(xpath).text =='f15'184 self.turn_off_track('HTMLFeatures - Example Features')185 def search_track( self ):186 self.assert_element("#dropdownbutton_file").click()187 self.assert_element("//*[contains(@class,'dijitMenuTable')]//*[contains(@class,'dijitMenuItemLabel')][contains(text(),'Add sequence search')]").click()188 self.assert_element("//div[contains(@class,'dijitDialogPaneContent')]//input[@type='text'][contains(@class,'dijitInputInner')]").send_keys( "aaaccc" )189 self.assert_element("//div[contains(@class,'dijitDialogPaneContent')]//span[contains(@class,'dijitButtonText')][text()='Search']").click()190 self.assert_element("//div[contains(@id, 'track_search_track')]//canvas")191 self.wait_for_dialog_disappearance()192 self.turn_off_track("Search reference sequence for")193 def combination( self ):194 self.assert_element("#dropdownbutton_file").click()195 self.assert_element("#menubar_combotrack_text").click()196 self.assert_element("//div[contains(@id, 'track_combination_track')]")197 self.turn_off_track("Combination Track")198class VolvoxBiodbTest( AbstractVolvoxBiodbTest, unittest.TestCase ):199 pass200if __name__ == '__main__':201 import unittest...

Full Screen

Full Screen

test_e2e.py

Source:test_e2e.py Github

copy

Full Screen

...25 NEWLY_CREATED_NODE_PROCESSES.clear()26class MyTestClass(BaseCase):27 def test_frontend_server_available(self):28 self.open(FRONTEND_ADDRESS)29 self.assert_element('#SCV')30 self.assert_element('#Marine')31 self.assert_element('#CommandCenter')32 self.assert_element('#TerranInfantryWeaponsLevel1')33 # TODO loop over all actions, units, structures and upgrades that should be available for terran34 def test_protoss_page_loads(self):35 self.open(FRONTEND_ADDRESS)36 self.assert_element('#SCV')37 self.assert_element('#Marine')38 # Load protoss page39 self.click('#protoss')40 self.assert_element('#Probe')41 self.assert_element('#Zealot')42 self.assert_element('#Nexus')43 self.assert_element('#ProtossGroundWeaponsLevel1')44 def test_zerg_page_loads(self):45 self.open(FRONTEND_ADDRESS)46 self.assert_element('#SCV')47 self.assert_element('#Marine')48 # Load protoss page49 self.click('#zerg')50 self.assert_element('#Drone')51 self.assert_element('#Zergling')52 self.assert_element('#Hatchery')53 self.assert_element('#ZergMeleeWeaponsLevel1')54 # TODO Other test ideas:55 # Add and remmove an item by clicking on it56 # Drag and drop example57 # Load a specific url to load a build order from encoded string58class MyBenchClass(BaseCase):59 def __init__(self, *args, **kwargs):60 super().__init__(*args, **kwargs)61 self.benchmark: Optional[BenchmarkFixture] = None62 @pytest.fixture(autouse=True)63 def setup_benchmark(self, benchmark):64 """65 Assign the benchmark to a class variable66 For more info see https://pytest-benchmark.readthedocs.io/en/latest/usage.html67 https://github.com/ionelmc/pytest-benchmark/blob/master/tests/test_with_testcase.py68 """69 self.benchmark = benchmark70 def basic_site_display(self):71 """ Check if HOME site is visible """72 self.open(FRONTEND_ADDRESS)73 self.assert_element('#SCV')74 self.assert_element('#Marine')75 self.assert_element('#CommandCenter')76 self.assert_element('#TerranInfantryWeaponsLevel1')77 # TODO in a new benchmark check how long it takes to click multiple buttons and create a fresh/example build order78 def test_bench_basic_site_display(self):79 """ Benchmark how fast the site loads """80 self.benchmark(self.basic_site_display)81if __name__ == '__main__':82 setup_module()83 test_class = MyTestClass()84 test_class.test_frontend_server_available()...

Full Screen

Full Screen

assert_element.py

Source:assert_element.py Github

copy

Full Screen

1import sst2import sst.actions3sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)4sst.actions.go_to('/')5sst.actions.assert_element(id='select_with_id_1')6sst.actions.assert_element(css_class='unique_class', id='some_id')7sst.actions.assert_element(name='longscroll', href='/longscroll')8sst.actions.fails(sst.actions.assert_element, id='nonexistent')9sst.actions.fails(...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful