def step_drag_longitude_field(context): context.browser.find_element_by_xpath(".//*[starts-with(@id,'container')][6]/li/ng-include/label").click() UtilityHelperClass(context.browser).wait_interval(0.5) 'Make sure latitude and longitude fields are not summarize' context.browser.find_element_by_xpath( "//field-well-bucket[@ng-repeat='bucket in viewModel.buckets'][1]//field-well-field[contains(@id,'container')]/li/h2/button[2]").click() UtilityHelperClass(context.browser).wait_interval(1)
def add_datafile_loadesriviz(context, packagename): try: UtilityHelperClass(context.browser).wait_interval(1) add_data.AddData(context.browser).adddata_open_dataset() 'Add Map Visual to the Esri Viz' add_map_visual.Add_Map_Visual( context.browser).import_custom_visual() add_map_visual.Add_Map_Visual(context.browser).import_from_file() add_map_visual.Add_Map_Visual( context.browser).select_import_button() 'Reading PBIX package from command line argument' add_map_visual.Add_Map_Visual( context.browser).add_pbix_package(packagename) 'Select Fields into Esri Viz' select_data_fields.Select_Fields_EsriViz( context.browser).add_fields_esri_viz() 'Switch to Infocus Edit Mode' switch_to_edit_mode.Switch_Edit_Mode( context.browser).move_to_infocus_edit_mode() UtilityHelperClass(context.browser).wait_interval(1) except Exception as e: print_error_msg(e) sys.exit(2)
def step_fields_not_summarized(context): context.browser.find_element_by_xpath( "//field-well-bucket[@ng-repeat='bucket in viewModel.buckets'][2]//field-well-field[contains(@id,'container')]/li/h2/button[1]").click() UtilityHelperClass(context.browser).wait_interval(0.5) dont_summarize_string = '//*[text()="{} summarize"]'.format("Don't") context.browser.find_element_by_xpath(dont_summarize_string).click() UtilityHelperClass(context.browser).wait_interval(0.5) context.browser.find_element_by_xpath( "//field-well-bucket[@ng-repeat='bucket in viewModel.buckets'][3]//field-well-field[contains(@id,'container')]/li/h2/button[1]").click() UtilityHelperClass(context.browser).wait_interval(0.5) context.browser.find_element_by_xpath(dont_summarize_string).click() UtilityHelperClass(context.browser).wait_interval(2)
def step_select_the_arcgis_label(context): #context.browser.find_element_by_xpath("//*[contains(text(),'ArcGIS')]").click() #ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath(".//*[contains(@id,'dojox_mvc_Templated')]/div/div[1]/span[2]")).click().perform() element = context.browser.find_element_by_xpath( ".//*[contains(@id,'dojox_mvc_Templated')]/div/div[1]/span[2]") context.browser.execute_script("return arguments[0].click();", element) UtilityHelperClass(context.browser).selenium_wait_interval(1)
def step_i_select_analytics_tool_from_toolbar(context): UtilityHelperClass(context.browser).wait_interval(1) #context.browser.find_element_by_xpath(".//*[starts-with(@id, 'uniqName')][2]/div/span/span[1]").click() ActionChains(context.browser).move_to_element( context.browser.find_element_by_xpath( ".//*[starts-with(@id, 'uniqName')][2]/div/span/span[1]")).click( ).perform()
def step_impl(context): backgroundmap = context.browser.find_element_by_xpath( "//*[contains(text(),'Streets')]") backgroundMapRoot = backgroundmap.find_element_by_xpath( "./parent::*").find_element_by_xpath("./parent::*") streetsbasemap = backgroundMapRoot.find_element_by_class_name( "esriBasemapGalleryThumbnail") context.browser.execute_script("arguments[0].click();", streetsbasemap) UtilityHelperClass(context.browser).wait_interval(1)
def step_impl(context, mapthemes): context.mapthemes = mapthemes if (context.mapthemes == "Heat Map"): elem = context.browser.find_element_by_xpath( ".//*[contains(@id,'MyLayer_layer')]") assert elem.get_attribute('opacity') == "0.6" if (context.mapthemes == "Clustering"): assert len( context.browser.find_elements_by_xpath( ".//*[starts-with(@fill, 'rgb')]")) == 9 if (context.mapthemes == "Location Only"): elem = context.browser.find_element_by_xpath( ".//*[contains(@id,'MyLayer_layer')]") assert elem.get_attribute('opacity') == "1" UtilityHelperClass(context.browser).wait_interval(0.5)
def step_referencelayer_from_analytics_menu(context): context.browser.find_element_by_xpath( "//*[contains(text(),'Reference layer')]").click() UtilityHelperClass(context.browser).selenium_wait_interval(2)
def step_pin_display_map_area(context): if ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath("//div[@class='infographicsVariableGroup']/table/tbody/tr/td[1]/div[1]/span")) is True: print ("USA Total Population Card is Visible ") UtilityHelperClass(context.browser).wait_interval(1)
def step_search_for_text_pizza_place_in_usa(context): #ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath("//div[@class='demographicsPanel']/div[1]/div[2]/div[1]/div/input")).click().perform() element = context.browser.find_element_by_xpath("//div[@class='demographicsPanel']/div[1]/div[2]/div[1]/div/input") context.browser.execute_script("return arguments[0].click();", element) UtilityHelperClass(context.browser).wait_interval(1)
def step_driv_time_from_analytics_menu(context): context.browser.find_element_by_xpath("//*[contains(text(),'Infographics')]").click() UtilityHelperClass(context.browser).selenium_wait_interval(1)
def step_customer_opens_map_themes_panel(context): UtilityHelperClass(context.browser).wait_interval(1) mapthemepanel = context.browser.find_element_by_xpath( "//*[contains(text(),'Map theme')]") context.browser.execute_script("arguments[0].click();", mapthemepanel) UtilityHelperClass(context.browser).wait_interval(0.5)
def step_pin_display_map_area(context): assert context.browser.find_element_by_xpath( "//*[starts-with(@id,'dijit__TemplatedMixin')]/div[2]/div/div/div[2]/div[2]" ).text == "1 locations" UtilityHelperClass(context.browser).wait_interval(1)
def steps_close_the_reference_layer_panel(context): ActionChains(context.browser).move_to_element( context.browser.find_element_by_xpath( "//div[@class='esriMapsSidePanelButton esriMapsClose'][@title='Close']" )).click().perform() UtilityHelperClass(context.browser).selenium_wait_interval(2)
def step_enter_text_san_diego(context): textbx = context.browser.find_element_by_xpath( "//table[@class='searchInputTable']/tbody/tr/td[1]/div/div/input") textbx.send_keys("San Diego") textbx.send_keys(Keys.ENTER) UtilityHelperClass(context.browser).selenium_wait_interval(1)
def step_i_loaded_data_powebi(context): UtilityHelperClass(context.browser).wait_interval(1) """data is already loaded to the mafp""" #context.browser.find_element_by_xpath(".//*[@id='pvExplorationHost']/div/div/div/div[1]/div[2]/div/ul/li[1]/button").click() pass
def step_impl(context): basemapname = context.browser.find_element_by_xpath( "//*[text()='Streets']").text assert basemapname == "Streets", "Wrong Basemap Found, Expected Output - StreetsMap to get open" UtilityHelperClass(context.browser).wait_interval(1)
def step_drag_latitude_field(context): context.browser.switch_to.default_content() UtilityHelperClass(context.browser).wait_interval(0.5) context.browser.find_element_by_xpath("//*[contains(@id,'container')][5]/li/ng-include/label").click()
def step_impl(context): basemapmenu = context.browser.find_element_by_xpath( "//*[contains(text(),'Basemap')]") context.browser.execute_script("arguments[0].click();", basemapmenu) UtilityHelperClass(context.browser).wait_interval(1)
def steps_select_san_diego_layer_from_panel(context): #context.browser.find_element_by_xpath(".//*[contains(@id,'dojox_mvc_Templated')]/div/div[2]/div[1]/div[3]/div[3]/div/input").click() context.browser.find_element_by_xpath( ".//*[contains(@name,'54a936f770de4b409b71901d1f0d9ff7')]").click() UtilityHelperClass(context.browser).selenium_wait_interval(2)
def step_select_the_demographic_usa_density_index_reference_layer(context): #ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath(".//*[@id='dojox_mvc_Templated_0']/div/div[2]/div[3]/div/div[3]/div/input")).click().perform() ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath("//*[contains(@name,'bbf7e47981234e48b958b9344a2e27db')]")).click().perform() ActionChains(context.browser).move_to_element(context.browser.find_element_by_xpath("//div[@class='esriMapsSidePanelButton esriMapsClose'][@title='Close']")).click().perform() UtilityHelperClass(context.browser).wait_interval(2)
def step_impl(context, mapthemes): context.mapthemes = mapthemes xpath_elem = "//*[contains(@title,{})]".format(context.mapthemes) context.browser.find_element_by_xpath(xpath_elem).click() UtilityHelperClass(context.browser).wait_interval(1.5)
def step_search_for_text_pizza_place_in_usa(context): pin_search_box = context.browser.find_element_by_xpath( "//*[contains(@id,'dijit_form_TextBox')]/div/input") pin_search_box.send_keys("Pizza place in USA") pin_search_box.send_keys(Keys.ENTER) UtilityHelperClass(context.browser).wait_interval(0.5)