def test_schedule_observations_past(self): self.test_login() # Bart has heard about a new website for NEOs. He goes to the # page of the first target # (XXX semi-hardwired but the targets link should be being tested in # test_targets_validation.TargetsValidationTest start_url = reverse('calibsource', kwargs={'pk': 1}) self.browser.get(self.live_server_url + start_url) # He sees a Schedule Observations button link = self.browser.find_element_by_id('schedule-spectro-obs') target_url = "{0}{1}".format( self.live_server_url, reverse('schedule-calib-spectra', kwargs={ 'instrument_code': 'F65-FLOYDS', 'pk': 1 })) actual_url = link.get_attribute('href') self.assertEqual(actual_url, target_url) # He clicks the link to go to the Schedule Observations page with self.wait_for_page_load(timeout=10): link.click() self.browser.implicitly_wait(10) new_url = self.browser.current_url self.assertEqual(str(new_url), target_url) # He notices a new selection for the proposal and site code and # chooses the NEO Follow-up Network and ELP (V37) proposal_choices = Select( self.browser.find_element_by_id('id_proposal_code')) self.assertIn(self.neo_proposal.title, [option.text for option in proposal_choices.options]) # Bart doesn't see the proposal to which he doesn't have permissions self.assertNotIn(self.test_proposal.title, [option.text for option in proposal_choices.options]) proposal_choices.select_by_visible_text(self.neo_proposal.title) site_choices = Select( self.browser.find_element_by_id('id_instrument_code')) self.assertIn('Siding Spring, Aust. (FTS - E10)', [option.text for option in site_choices.options]) site_choices.select_by_visible_text('Siding Spring, Aust. (FTS - E10)') MockDateTime.change_date(2015, 4, 20) datebox = self.get_item_input_box('id_utc_date') datebox.clear() datebox.send_keys('2015-03-21') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id('verify-scheduling').click() # The page throws an error that observing window cannot end in the past error_msg = self.browser.find_element_by_class_name('errorlist').text self.assertIn("Window cannot start in the past", error_msg)
def test_schedule_page_edit_block(self): MockDateTime.change_date(2015, 4, 20) self.test_login() # Bart has heard about a new website for NEOs. He goes to the # page of the first target # (XXX semi-hardwired but the targets link should be being tested in # test_targets_validation.TargetsValidationTest start_url = reverse('calibsource', kwargs={'pk': 1}) self.browser.get(self.live_server_url + start_url) # He sees a Schedule Observations button link = self.browser.find_element_by_id('schedule-spectro-obs') target_url = "{0}{1}".format( self.live_server_url, reverse('schedule-calib-spectra', kwargs={ 'instrument_code': 'F65-FLOYDS', 'pk': 1 })) actual_url = link.get_attribute('href') self.assertEqual(actual_url, target_url) # He clicks the link to go to the Schedule Observations page with self.wait_for_page_load(timeout=10): link.click() self.browser.implicitly_wait(10) new_url = self.browser.current_url self.assertEqual(str(new_url), target_url) # He notices a new selection for the proposal and site code and # chooses the NEO Follow-up Network and ELP (V37) proposal_choices = Select( self.browser.find_element_by_id('id_proposal_code')) self.assertIn(self.neo_proposal.title, [option.text for option in proposal_choices.options]) # Bart doesn't see the proposal to which he doesn't have permissions self.assertNotIn(self.test_proposal.title, [option.text for option in proposal_choices.options]) proposal_choices.select_by_visible_text(self.neo_proposal.title) site_choices = Select( self.browser.find_element_by_id('id_instrument_code')) self.assertIn('Siding Spring, Aust. (FTS - E10)', [option.text for option in site_choices.options]) site_choices.select_by_visible_text('Siding Spring, Aust. (FTS - E10)') MockDateTime.change_date(2015, 12, 20) datebox = self.get_item_input_box('id_utc_date') datebox.clear() datebox.send_keys('2015-12-21') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id('verify-scheduling').click() # The page refreshes and a series of values for magnitude, slot # length, number and length of exposures appear magnitude = self.browser.find_element_by_id( 'id_magnitude_row').find_element_by_class_name('kv-value').text self.assertIn('7.0', magnitude) vis = self.browser.find_element_by_id( 'id_visibility_row').find_element_by_class_name('kv-value').text self.assertIn('2.8 hrs / 40°', vis) slot_length = self.browser.find_element_by_id( 'id_slot_length_row').find_element_by_class_name('kv-value').text self.assertIn('20', slot_length) num_exp = self.browser.find_element_by_id( 'id_no_of_exps_row').find_element_by_class_name('kv-value').text self.assertIn('1', num_exp) exp_length = self.browser.find_element_by_id( 'id_exp_length').get_attribute('value') self.assertIn('180.0', exp_length) snr = self.browser.find_element_by_id( 'id_snr_row').find_element_by_class_name('kv-value').text self.assertIn('2068.6', snr) # Bart wants to change the exposure time and recalculate snr slot_length_box = self.browser.find_element_by_id('id_exp_length') slot_length_box.clear() slot_length_box.send_keys('25') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() # The page refreshes and we get correct slot length and the Schedule button again exp_length = self.browser.find_element_by_id( 'id_exp_length').get_attribute('value') self.assertIn('25', exp_length) slot_length = self.browser.find_element_by_id( 'id_slot_length_row').find_element_by_class_name('kv-value').text self.assertIn('18', slot_length) snr = self.browser.find_element_by_id( 'id_snr_row').find_element_by_class_name('kv-value').text self.assertIn('770.9', snr) # Bart wants to change the max airmass to 2.0 and min moon dist to 160. self.browser.find_element_by_id("advanced-switch").click() airmass_box = self.browser.find_element_by_id('id_max_airmass') airmass_box.clear() airmass_box.send_keys('2.0') moon_box = self.browser.find_element_by_id('id_min_lunar_dist') moon_box.clear() moon_box.send_keys('160') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() # The page refreshes and we get correct hours visible and a warning on moon dist vis = self.browser.find_element_by_id( 'id_visibility_row').find_element_by_class_name('kv-value').text self.assertIn('4.6 hrs', vis) moon_warn = self.browser.find_element_by_id( 'id_moon_row').find_element_by_class_name('warning').text self.assertIn('35.8', moon_warn) submit = self.browser.find_element_by_id( 'id_submit_button').get_attribute("value") self.assertIn('Schedule this Object', submit) # Bart wants to change the max airmass to 1.1 and gets a warning self.browser.find_element_by_id("advanced-switch").click() airmass_box = self.browser.find_element_by_id('id_max_airmass') airmass_box.clear() airmass_box.send_keys('1.1') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() vis = self.browser.find_element_by_id( 'id_visibility_row').find_element_by_class_name('warning').text self.assertIn('Target Not Visible', vis) # Fix issue: self.browser.find_element_by_id("advanced-switch").click() airmass_box = self.browser.find_element_by_id('id_max_airmass') airmass_box.clear() airmass_box.send_keys('2.0') self.browser.find_element_by_id("id_edit_window").click() start_time_box = self.browser.find_element_by_id('id_start_time') start_time_box.clear() start_time_box.send_keys('2015-12-21T13:13:00') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() start_time = self.browser.find_element_by_id( 'id_start_time').get_attribute('value') self.assertEqual(start_time, '2015-12-21T13:13:00') # Bart wants to be a little &^%$ and stress test our group ID input group_id_box = self.browser.find_element_by_name("group_name") group_id_box.clear() bs_string = 'ຢູ່ໃກ້Γη小惑星‽' group_id_box.send_keys(bs_string) with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() group_id = self.browser.find_element_by_id( 'id_group_name').get_attribute('value') self.assertEqual('HD 30455_E10-20151221_spectra', group_id) group_id_box = self.browser.find_element_by_name("group_name") group_id_box.clear() bs_string = 'rcoivny3q5r@@yciht8ycv9njcrnc87vy b0y98uxm9cyh8ycvn0fh 80hfcubfuh87yc 0nhfhxmhf7g 70h' group_id_box.send_keys(bs_string) with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() group_id = self.browser.find_element_by_id( 'id_group_name').get_attribute('value') self.assertEqual(bs_string[:50], group_id)
def test_can_schedule_spec_observations(self): self.test_login() # Bart has heard about a new website for NEOs. He's concerned about calibrations! start_url = reverse('calibsource', kwargs={'pk': 1}) self.browser.get(self.live_server_url + start_url) # He sees a Schedule Observations button link = self.browser.find_element_by_id('schedule-spectro-obs') target_url = "{0}{1}".format( self.live_server_url, reverse('schedule-calib-spectra', kwargs={ 'instrument_code': 'F65-FLOYDS', 'pk': 1 })) actual_url = link.get_attribute('href') self.assertEqual(actual_url, target_url) # He clicks the link to go to the Schedule Observations page with self.wait_for_page_load(timeout=10): link.click() self.browser.implicitly_wait(10) new_url = self.browser.current_url self.assertEqual(str(new_url), target_url) # He notices a new selection for the proposal and site code and # chooses the NEO Follow-up Network and FTN (F65) proposal_choices = Select( self.browser.find_element_by_id('id_proposal_code')) self.assertIn(self.neo_proposal.title, [option.text for option in proposal_choices.options]) # Bart doesn't see the proposal to which he doesn't have permissions self.assertNotIn(self.test_proposal.title, [option.text for option in proposal_choices.options]) proposal_choices.select_by_visible_text(self.neo_proposal.title) site_choices = Select( self.browser.find_element_by_id('id_instrument_code')) self.assertIn('Maui, Hawaii (FTN - F65)', [option.text for option in site_choices.options]) site_choices.select_by_visible_text('Maui, Hawaii (FTN - F65)') MockDateTime.change_date(2015, 12, 20) datebox = self.get_item_input_box('id_utc_date') datebox.clear() datebox.send_keys('2015-12-21') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id('verify-scheduling').click() # The page refreshes and a series of values for magnitude, speed, slot # length, number and length of exposures appear magnitude = self.browser.find_element_by_id( 'id_magnitude_row').find_element_by_class_name('kv-value').text self.assertIn('7.0', magnitude) vis = self.browser.find_element_by_id( 'id_visibility_row').find_element_by_class_name('kv-value').text self.assertIn('7.6 hrs / 87°', vis) slot_length = self.browser.find_element_by_id( 'id_slot_length_row').find_element_by_class_name('kv-value').text self.assertIn('20', slot_length) num_exp = self.browser.find_element_by_id( 'id_no_of_exps_row').find_element_by_class_name('kv-value').text self.assertIn('1', num_exp) exp_length = self.browser.find_element_by_id( 'id_exp_length').get_attribute('value') self.assertIn('180.0', exp_length) snr = self.browser.find_element_by_id( 'id_snr_row').find_element_by_class_name('kv-value').text self.assertIn('2149.2', snr) # At this point, a 'Schedule this object' button appears submit = self.browser.find_element_by_id( 'id_submit_button').get_attribute("value") self.assertIn('Schedule this Object', submit)
def setUp(self): super(LighCurvePlotTest, self).setUp() settings.DATA_ROOT = self.test_dir settings.MEDIA_ROOT = self.test_dir self.lcname = '433_738215_ALCDEF.txt' lcpath = os.path.abspath(os.path.join('photometrics', 'tests')) save_to_default(os.path.join(lcpath, self.lcname), lcpath) params = { 'name': '433', 'abs_mag': 21.0, 'slope': 0.15, 'epochofel': '2015-03-19 00:00:00', 'meananom': 325.2636, 'argofperih': 85.19251, 'longascnode': 147.81325, 'orbinc': 8.34739, 'eccentricity': 0.1896865, 'meandist': 1.2176312, 'source_type': 'U', 'elements_type': 'MPC_MINOR_PLANET', 'active': True, 'origin': 'M', 'ingest': '2015-05-11 17:20:00', 'score': 90, 'discovery_date': '2015-05-10 12:00:00', 'update_time': '2015-05-18 05:00:00', 'num_obs': 17, 'arc_length': 3.123456789, 'not_seen': 0.423456789, 'updated': True, } self.body2, created = Body.objects.get_or_create(pk=2, **params) MockDateTime.change_date(2021, 12, 10) self.body2.save_physical_parameters({ 'parameter_type': 'P', 'value': 5.27, 'error': .0015, 'quality': 5, 'notes': "testy test note" }) params = { 'name': 'C/2017 K2', 'abs_mag': 7.0, 'slope': 2.0, 'epochofel': '2021-07-05 00:00:00', 'epochofperih': '2022-12-19 05:50:00', 'argofperih': 236.19001, 'longascnode': 88.244, 'orbinc': 87.55297, 'eccentricity': 1.0005709, 'perihdist': 1.7974686, 'source_type': 'C', 'elements_type': 'MPC_COMET', 'active': True, 'origin': 'O', 'ingest': '2015-05-11 17:20:00', 'score': 90, 'discovery_date': '2015-05-10 12:00:00', 'update_time': '2015-05-18 05:00:00', 'num_obs': 17, 'arc_length': 3.123456789, 'not_seen': 0.423456789, 'updated': True, 'meandist': None, 'meananom': None, } self.comet, created = Body.objects.get_or_create(pk=3, **params) self.username = '******' self.password = '******' self.email = '*****@*****.**' self.bart = User.objects.create_user(username=self.username, password=self.password, email=self.email) self.bart.first_name = 'Bart' self.bart.last_name = 'Simpson' self.bart.is_active = 1 self.bart.is_staff = 1 self.bart.is_superuser = 1 self.bart.save() update_proposal_permissions(self.bart, [{ 'code': self.neo_proposal.code }])
def test_can_view_lightcurve( self): # test opening up a ALCDEF file associated with a body save_dataproduct(self.body2, self.lcname, DataProduct.ALCDEF_TXT) lc_url = reverse('lc_plot', args=[self.body2.id]) self.browser.get(self.live_server_url + lc_url) self.assertIn('Lightcurve for object: 433', self.browser.title) canvas = self.browser.find_element_by_xpath( "/html/body[@class='page']/div[@id='page-wrapper']/div[@id='page']/div[@id='main']/div[@name='lc_plot']/div[@class='bk']/div[@class='bk'][2]/div[@class='bk'][1]/div[@class='bk']/div[@class='bk bk-canvas-events']" ) phase_tab = self.browser.find_element_by_xpath( "/html/body[@class='page']/div[@id='page-wrapper']/div[@id='page']/div[@id='main']/div[@name='lc_plot']/div[@class='bk']/div[@class='bk bk-tabs-header bk-above']/div[@class='bk bk-headers-wrapper']/div[@class='bk bk-headers']/div[@class='bk bk-tab']" ) phase_tab.click() period_box = self.browser.find_element_by_xpath( "/html/body[@class='page']/div[@id='page-wrapper']/div[@id='page']/div[@id='main']/div[@name='lc_plot']/div[@class='bk']/div[@class='bk'][2]/div[@class='bk'][2]/div[@class='bk'][2]/div[@class='bk']/div[@class='bk'][1]/div[@class='bk'][1]/div[@class='bk']/div[@class='bk bk-input-group']/div[@class='bk bk-spin-wrapper']/input[@class='bk bk-input']" ) period_text = self.browser.find_element_by_xpath( "/html/body[@class='page']/div[@id='page-wrapper']/div[@id='page']/div[@id='main']/div[@name='lc_plot']/div[@class='bk']/div[@class='bk'][2]/div[@class='bk'][2]/div[@class='bk'][2]/div[@class='bk']/div[@class='bk'][1]/div[@class='bk'][1]/div[@class='bk']/div[@class='bk bk-input-group']/label[@class='bk']" ).text self.assertIn('Period (Default: 5.27h)', period_text) # check for period table self.check_for_header_in_table('id_periods', 'Period [hours] Source Notes Date') test_lines = ['1 5.27 ±0.0015 (2-) None testy test note Dec. 10, 2021'] for test_line in test_lines: self.check_for_row_in_table('id_periods', test_line) # Check for no form try: arrow_link = self.browser.find_element_by_id("arrow") raise Exception("Should be logged in for this form") except NoSuchElementException: pass # Login self.login() self.browser.get(self.live_server_url + lc_url) self.assertIn('Lightcurve for object: 433', self.browser.title) # find form arrow_link = self.browser.find_element_by_id("arrow") arrow_link.click() # Fill out Form and submit. MockDateTime.change_date(2021, 12, 12) period_box = self.get_item_input_box("id_period") period_box.send_keys('-4.35') add_button = self.browser.find_element_by_id("add_new_period-btn") with self.wait_for_page_load(timeout=10): add_button.click() arrow_link = self.browser.find_element_by_id("arrow") arrow_link.click() error_msg = self.browser.find_element_by_class_name('errorlist').text self.assertIn("Please enter a positive number for Period", error_msg) test_lines = ['1 5.27 ±0.0015 (2-) None testy test note Dec. 10, 2021'] for test_line in test_lines: self.check_for_row_in_table('id_periods', test_line) period_box = self.get_item_input_box("id_period") period_box.clear() period_box.send_keys('4.35') preferred_box = self.browser.find_element_by_id("id_preferred") preferred_box.click() quality_choices = Select(self.browser.find_element_by_id('id_quality')) quality_choices.select_by_visible_text("Unique (3-)") add_button = self.browser.find_element_by_id("add_new_period-btn") with self.wait_for_page_load(timeout=10): add_button.click() # check for updated period table self.check_for_header_in_table('id_periods', 'Period [hours] Source Notes Date') test_lines = [ '1 4.35 (3-) NEOX Dec. 12, 2021', '2 5.27 ±0.0015 (2-) None testy test note Dec. 10, 2021' ] for test_line in test_lines: self.check_for_row_in_table('id_periods', test_line) # get current window pw = self.browser.current_window_handle data_link = self.browser.find_element_by_link_text("2019-01-12") self.assertEqual(len(self.browser.window_handles), 1) data_link.click() WebDriverWait(self.browser, timeout=10).until(EC.number_of_windows_to_be(2)) all_windows = self.browser.window_handles for window in all_windows: if window != pw: self.browser.switch_to.window(window) WebDriverWait(self.browser, timeout=10).until(EC.url_contains('txt')) self.assertIn('txt', self.browser.current_url) alcdef_text = self.browser.find_element_by_xpath("/html/body/pre").text self.assertIn('OBJECTNUMBER=433', alcdef_text) return
def test_summary_pages_exist(self): # Find the link to the Data Summary Page self.browser.get(self.live_server_url) link = self.browser.find_element_by_xpath(u'//a[text()="Data"]') lc_summary_url = self.live_server_url + reverse('lc_data_summary') self.assertIn(link.get_attribute('href'), lc_summary_url) # Go check it out and land on the LC summary with self.wait_for_page_load(timeout=10): link.click() new_url = self.browser.current_url self.assertEqual(str(new_url), lc_summary_url) self.assertIn('Data Summary Page | LCO NEOx', self.browser.title) self.check_for_header_in_table( 'id_ranked_targets', 'Target Name Period Quality Source Notes Status Status Updated') test_lines = [ '1 N999r0q 12.0 (h) Not well established (2-) NEOX testy test tested No Analysis Done' ] for test_line in test_lines: self.check_for_row_in_table('id_ranked_targets', test_line) # Not logged in, can't see status form try: arrow_link = self.browser.find_element_by_id("arrow") raise Exception("Should be logged in for this form") except NoSuchElementException: pass # ooo, there's a spec page? link = self.browser.find_element_by_link_text('(Spec)') spec_summary_url = self.live_server_url + reverse('spec_data_summary') self.assertIn(link.get_attribute('href'), spec_summary_url) # Go check it out and land on the spec summary with self.wait_for_page_load(timeout=10): link.click() new_url = self.browser.current_url self.assertEqual(str(new_url), spec_summary_url) self.check_for_header_in_table( 'id_ranked_targets', 'Date Target Name Block Obs Status Status Updated') test_lines = [ '1 2019-09-27 N999r0q 6 1 No Analysis Done', '2 2019-07-27 N999r0q 5 1 No Analysis Done', '3 2019-07-27 N999r0q 5 1 No Analysis Done' ] for test_line in test_lines: self.check_for_row_in_table('id_ranked_targets', test_line) # Login and head back to LC summary self.test_login() link = self.browser.find_element_by_xpath(u'//a[text()="Data"]') with self.wait_for_page_load(timeout=10): link.click() new_url = self.browser.current_url self.assertEqual(str(new_url), lc_summary_url) # Mock a time so things work MockDateTime.change_date(2021, 12, 10) # find dropdown button arrow_link = self.browser.find_element_by_id("arrow") arrow_link.click() # Fill out Form and submit. status_select = Select(self.browser.find_element_by_id("id_status")) status_select.select_by_visible_text("Published") update_button = self.browser.find_element_by_id("update_status-btn") with self.wait_for_page_load(timeout=10): update_button.click() test_lines = [ '1 N999r0q 12.0 (h) Not well established (2-) NEOX testy test tested Published Dec. 10, 2021' ] for test_line in test_lines: self.check_for_row_in_table('id_ranked_targets', test_line)
def test_can_schedule_observations(self): self.browser.get('%s%s' % (self.live_server_url, '/accounts/login/')) username_input = self.browser.find_element_by_id("username") username_input.send_keys(self.username) password_input = self.browser.find_element_by_id("password") password_input.send_keys(self.password) with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id('login-btn').click() # Wait until response is recieved self.wait_for_element_with_id('page') # Bart has heard about a new website for NEOs. He goes to the # page of the first target # (XXX semi-hardwired but the targets link should be being tested in # test_targets_validation.TargetsValidationTest start_url = reverse('target', kwargs={'pk': 1}) self.browser.get(self.live_server_url + start_url) # He sees a Schedule Observations button link = self.browser.find_element_by_id('schedule-obs') target_url = "{0}{1}".format( self.live_server_url, reverse('schedule-body', kwargs={'pk': 1})) actual_url = link.get_attribute('href') self.assertEqual(actual_url, target_url) # He clicks the link to go to the Schedule Observations page with self.wait_for_page_load(timeout=10): link.click() self.browser.implicitly_wait(10) new_url = self.browser.current_url self.assertEqual(str(new_url), target_url) # He notices a new selection for the proposal and site code and # chooses the NEO Follow-up Network and ELP (V37) proposal_choices = Select( self.browser.find_element_by_id('id_proposal_code')) self.assertIn(self.neo_proposal.title, [option.text for option in proposal_choices.options]) proposal_choices.select_by_visible_text(self.neo_proposal.title) site_choices = Select(self.browser.find_element_by_id('id_site_code')) self.assertIn('ELP 1.0m - V37,V39; (McDonald, Texas)', [option.text for option in site_choices.options]) site_choices.select_by_visible_text( 'ELP 1.0m - V37,V39; (McDonald, Texas)') MockDateTime.change_date(2015, 4, 20) datebox = self.get_item_input_box('id_utc_date') datebox.clear() datebox.send_keys('2015-04-21') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id('single-submit').click() # The page refreshes and a series of values for magnitude, speed, slot # length, number and length of exposures appear magnitude = self.browser.find_element_by_id( 'id_magnitude_row').find_element_by_class_name('kv-value').text self.assertIn('20.40', magnitude) speed = self.browser.find_element_by_id( 'id_speed_row').find_element_by_class_name('kv-value').text self.assertIn('2.37 "/min', speed) slot_length = self.browser.find_element_by_id( 'id_slot_length').get_attribute('value') self.assertIn('22.5', slot_length) num_exp = self.browser.find_element_by_id( 'id_no_of_exps_row').find_element_by_class_name('kv-value').text self.assertIn('9', num_exp) exp_length = self.browser.find_element_by_id( 'id_exp_length').get_attribute('value') self.assertIn('100.0', exp_length) # At this point, a 'Schedule this object' button appears submit = self.browser.find_element_by_id( 'id_submit_button').get_attribute("value") self.assertIn('Schedule this Object', submit) # there is an option to input a filter Pattern with a default value of 'w' filter_pattern = self.browser.find_element_by_id( 'id_filter_pattern').get_attribute("value") self.assertIn('w', filter_pattern) # There is a help option listing the proper input format and available filters expected_filters = 'air, ND, U, B, V, R, I, up, gp, rp, ip, zs, Y, w' filter_help = self.browser.find_element_by_id( 'id_filter_pattern_row').find_element_by_class_name( 'kv-key').get_attribute("name") self.assertEqual(expected_filters, filter_help) # There is a spot to input the number of iterations (default = number of exposures) with self.assertRaises(NoSuchElementException): pattern_iterations = self.browser.find_element_by_id( 'id_pattern_iterations_row').find_element_by_class_name( 'kv-value').text # Updating filter pattern updates the number of iterations iterations_expected = u'2.67' filter_pattern_box = self.browser.find_element_by_id( 'id_filter_pattern') filter_pattern_box.clear() filter_pattern_box.send_keys('V,I,R') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() pattern_iterations = self.browser.find_element_by_id( 'id_pattern_iterations_row').find_element_by_class_name( 'kv-value').text self.assertEqual(iterations_expected, pattern_iterations) # updating the slot length increases the number of iterations iterations_expected = u'14.0' slot_length_box = self.browser.find_element_by_id('id_slot_length') slot_length_box.clear() slot_length_box.send_keys('106') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() pattern_iterations = self.browser.find_element_by_id( 'id_pattern_iterations_row').find_element_by_class_name( 'kv-value').text self.assertEqual(iterations_expected, pattern_iterations) # cannot update filter pattern with unacceptable filters with incorrect syntax filter_pattern_box = self.browser.find_element_by_id( 'id_filter_pattern') filter_pattern_box.clear() filter_pattern_box.send_keys('42,V,v,W,w,gp fg, hj, k-t/g/h') with self.wait_for_page_load(timeout=10): self.browser.find_element_by_id("id_edit_button").click() # The page refreshes and we get an error error_msg = self.browser.find_element_by_class_name('errorlist').text self.assertIn( '42,v,W,fg,hj,k-t,g,h are not acceptable filters at this site.', error_msg)