add series_run option to create_run

This commit is contained in:
Florin Strugariu 2012-12-04 16:45:07 +02:00
Родитель 960d8ca7df
Коммит 04b8ebf4b5
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -27,23 +27,36 @@ class MozTrapCreateRunPage(MozTrapBasePage):
_run_manage_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem .title[title="%(run_name)s"]')
_run_homepage_locator = (By.CSS_SELECTOR, '.runsdrill .runsfinder .runs .colcontent .title[title="%(run_name)s"]')
_run_tests_button_locator = (By.CSS_SELECTOR, 'div.form-actions > button')
_series_run_locator = (By.ID, 'id_is_series')
def go_to_create_run_page(self):
self.selenium.get(self.base_url + '/manage/run/add/')
self.is_the_current_page
def create_run(self, name='Test Run', product_version='Test Product Test Version', desc='This is a test run', start_date='2011-01-01', end_date='2012-12-31', suite_list=None):
def create_run(self, name='Test Run', product_version='Test Product Test Version', desc='This is a test run', start_date='2011-01-01', end_date='2012-12-31', suite_list=None, series_run=False):
dt_string = datetime.utcnow().isoformat()
run = {}
run['name'] = u'%(name)s %(dt_string)s' % {'name': name, 'dt_string': dt_string}
run['desc'] = u'%(desc)s created on %(dt_string)s' % {'desc': desc, 'dt_string': dt_string}
run['series'] = series_run
run['manage_locator'] = (self._run_manage_locator[0], self._run_manage_locator[1] % {'run_name': run['name']})
run['homepage_locator'] = (self._run_homepage_locator[0], self._run_homepage_locator[1] % {'run_name': run['name']})
run['run_tests_locator'] = self._run_tests_button_locator
name_field = self.selenium.find_element(*self._name_locator)
name_field.send_keys(run['name'])
series_element = self.selenium.find_element(*self._series_run_locator)
if series_element.is_selected():
if not series_run:
series_element.click()
else:
if series_run:
series_element.click()
product_version_select = Select(self.selenium.find_element(*self._product_version_select_locator))
product_version_select.select_by_visible_text(product_version)