Merge pull request #27 from jgerigmeyer/manage-versions-tests-pass-in-0.8

Manage versions tests pass in 0.8
This commit is contained in:
camd 2012-02-27 16:13:44 -08:00
Родитель d4802b3df2 cd3b40ffba
Коммит 38ae68cb14
7 изменённых файлов: 227 добавлений и 239 удалений

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

@ -44,8 +44,8 @@ from create_suite_page import CaseConductorCreateSuitePage
from manage_suites_page import CaseConductorManageSuitesPage
from create_run_page import CaseConductorCreateRunPage
from manage_runs_page import CaseConductorManageRunsPage
from create_cycle_page import CaseConductorCreateCyclePage
from manage_cycles_page import CaseConductorManageCyclesPage
from create_version_page import CaseConductorCreateVersionPage
from manage_versions_page import CaseConductorManageVersionsPage
from create_product_page import CaseConductorCreateProductPage
from manage_products_page import CaseConductorManageProductsPage
@ -70,32 +70,31 @@ class BaseTest(object):
manage_products_pg.filter_products_by_name(name=product['name'])
manage_products_pg.delete_product(name=product['name'])
def create_cycle(self, mozwebqa, activate=False, product=None):
create_cycle_pg = CaseConductorCreateCyclePage(mozwebqa)
def create_version(self, mozwebqa, product=None):
create_version_pg = CaseConductorCreateVersionPage(mozwebqa)
if product is None:
product = self.create_product(mozwebqa)
version = product['version']
manage_versions_pg = CaseConductorManageVersionsPage(mozwebqa)
manage_versions_pg.go_to_manage_versions_page()
else:
create_version_pg.go_to_create_version_page()
version = create_version_pg.create_version(product_name=product['name'])
create_cycle_pg.go_to_create_cycle_page()
cycle = create_cycle_pg.create_cycle(product=product['name'])
cycle['product'] = product
version['product'] = product
if activate:
manage_cycles_pg = CaseConductorManageCyclesPage(mozwebqa)
manage_cycles_pg.filter_cycles_by_name(name=cycle['name'])
manage_cycles_pg.activate_cycle(name=cycle['name'])
return version
return cycle
def delete_version(self, mozwebqa, version, delete_product=False):
manage_versions_pg = CaseConductorManageVersionsPage(mozwebqa)
def delete_cycle(self, mozwebqa, cycle, delete_product=False):
manage_cycles_pg = CaseConductorManageCyclesPage(mozwebqa)
manage_cycles_pg.go_to_manage_cycles_page()
manage_cycles_pg.filter_cycles_by_name(name=cycle['name'])
manage_cycles_pg.delete_cycle(name=cycle['name'])
manage_versions_pg.go_to_manage_versions_page()
manage_versions_pg.filter_versions_by_name(name=version['name'])
manage_versions_pg.delete_version(name=version['name'], product_name=version['product']['name'])
if delete_product:
self.delete_product(mozwebqa, cycle['product'])
self.delete_product(mozwebqa, version['product'])
def create_run(self, mozwebqa, activate=False, cycle=None, suite_name=None):
create_run_pg = CaseConductorCreateRunPage(mozwebqa)

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

@ -50,6 +50,8 @@ class CaseConductorCreateProductPage(CaseConductorBasePage):
_description_locator = 'id=id_description'
_submit_locator = 'css=#product-add-form .form-actions > button'
_product_locator = u'css=#manageproducts .listitem .title:contains(%(product_name)s)'
_version_manage_locator = u'css=#manageproductversions .listitem .title[title="%(product_name)s %(version_name)s"]'
_version_homepage_locator = u'css=.runsdrill .runsfinder .productversions .colcontent .title[title="%(version_name)s"][data-product="%(product_name)s"])'
def go_to_create_product_page(self):
self.selenium.open('/manage/product/add/')
@ -60,11 +62,14 @@ class CaseConductorCreateProductPage(CaseConductorBasePage):
product = {}
product['name'] = u'%(name)s %(dt_string)s' % {'name': name, 'dt_string': dt_string}
product['desc'] = u'%(desc)s created on %(dt_string)s' % {'desc': desc, 'dt_string': dt_string}
product['version'] = u'%(version)s %(dt_string)s' % {'version': version, 'dt_string': dt_string}
product['locator'] = self._product_locator % {'product_name': product['name']}
product['version'] = {}
product['version']['name'] = u'%(version)s %(dt_string)s' % {'version': version, 'dt_string': dt_string}
product['version']['manage_locator'] = self._version_manage_locator % {'product_name': product['name'], 'version_name': product['version']['name']}
product['version']['homepage_locator'] = self._version_homepage_locator % {'product_name': product['name'], 'version_name': product['version']['name']}
self.type(self._name_locator, product['name'])
self.type(self._version_locator, product['version'])
self.type(self._version_locator, product['version']['name'])
self.type(self._description_locator, product['desc'])
self.select(self._profile_locator, profile)
self.click(self._submit_locator, wait_flag=True)

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

@ -40,36 +40,29 @@ from base_page import CaseConductorBasePage
from datetime import datetime
class CaseConductorCreateCyclePage(CaseConductorBasePage):
class CaseConductorCreateVersionPage(CaseConductorBasePage):
_page_title = 'Mozilla Case Conductor'
_name_locator = 'id=id_name'
_version_name_locator = 'id=id_version'
_product_select_locator = 'id=id_product'
_description_locator = 'id=id_description'
_start_date_locator = 'id=id_start_date'
_end_date_locator = 'id=id_end_date'
_submit_locator = 'css=#cycle-form .form-actions > button'
_cycle_manage_locator = u'css=#managecycles .managelist article.item .title[title="%(cycle_name)s"]'
_cycle_homepage_locator = u"css=.selectruns .finder .carousel .cycles .colcontent .title:contains(%(cycle_name)s)"
_submit_locator = 'css=#productversion-add-form .form-actions > button'
_version_manage_locator = u'css=#manageproductversions .listitem .title[title="%(product_name)s %(version_name)s"]'
_version_homepage_locator = u'css=.runsdrill .runsfinder .productversions .colcontent .title[title="%(version_name)s"][data-product="%(product_name)s"])'
def go_to_create_cycle_page(self):
self.selenium.open('/manage/testcycle/add/')
def go_to_create_version_page(self):
self.selenium.open('/manage/productversion/add/')
self.is_the_current_page
def create_cycle(self, name='Test Cycle', product='Test Product', desc='This is a test cycle', start_date='2011-01-01', end_date='2012-12-31'):
def create_version(self, name='Test Version', product_name='Test Product'):
dt_string = datetime.utcnow().isoformat()
cycle = {}
cycle['name'] = u'%(name)s %(dt_string)s' % {'name': name, 'dt_string': dt_string}
cycle['desc'] = u'%(desc)s created on %(dt_string)s' % {'desc': desc, 'dt_string': dt_string}
cycle['manage_locator'] = self._cycle_manage_locator % {'cycle_name': cycle['name']}
cycle['homepage_locator'] = self._cycle_homepage_locator % {'cycle_name': cycle['name']}
version = {}
version['name'] = u'%(name)s %(dt_string)s' % {'name': name, 'dt_string': dt_string}
version['manage_locator'] = self._version_manage_locator % {'product_name': product_name, 'version_name': version['name']}
version['homepage_locator'] = self._version_homepage_locator % {'product_name': product_name, 'version_name': version['name']}
self.type(self._name_locator, cycle['name'])
self.select(self._product_select_locator, product)
self.type(self._description_locator, cycle['desc'])
self.type(self._start_date_locator, start_date)
self.type(self._end_date_locator, end_date)
self.type(self._version_name_locator, version['name'])
self.select(self._product_select_locator, product_name)
self.click(self._submit_locator, wait_flag=True)
return cycle
return version

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

@ -1,104 +0,0 @@
#!/usr/bin/env python
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Case Conductor
#
# The Initial Developer of the Original Code is
# Mozilla Corp.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Jonny Gerig Meyer <jonny@oddbird.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
from base_page import CaseConductorBasePage
class CaseConductorManageCyclesPage(CaseConductorBasePage):
_page_title = 'Mozilla Case Conductor'
_input_locator = 'id=text-filter'
_update_list_locator = 'css=#filter .visual .content .form-actions button'
_cycle_manage_locator = u'css=#managecycles .managelist article.item .title[title="%(cycle_name)s"]'
_cycle_homepage_locator = u"css=.selectruns .finder .carousel .cycles .colcontent .title:contains(%(cycle_name)s)"
_cloned_cycle_locator = u'css=#managecycles .managelist article.item .title[title^="Cloned on"][title$="%(cycle_name)s"]'
_delete_cycle_locator = u'css=#managecycles .managelist article.item .title[title="%(cycle_name)s"] ~ .controls button[title="delete"]'
_clone_cycle_locator = u'css=#managecycles .managelist article.item .title[title="%(cycle_name)s"] ~ .controls button[title="clone"]'
_cycle_status_locator = u'xpath=//section[@id="managecycles"]//article[contains(@class,"item")]//h3[@title="%(cycle_name)s"]/../p[@class="status"]/button'
_filter_suggestion_locator = u'css=#filter .textual .suggest a:contains(%(filter_name)s)'
_filter_locator = u'css=#filter .visual .filter-group.keyword input[value="%(filter_name)s"]'
def go_to_manage_cycles_page(self):
self.selenium.open('/manage/testcycles/')
self.is_the_current_page
def delete_cycle(self, name='Test Cycle'):
_delete_locator = self._delete_cycle_locator % {'cycle_name': name}
self.click(_delete_locator)
self.wait_for_ajax()
def filter_cycles_by_name(self, name):
_filter_suggestion_locator = self._filter_suggestion_locator % {'filter_name': name}
_name_without_last_character = name[:-1]
_name_last_character = name[-1]
self.type(self._input_locator, _name_without_last_character)
self.key_pressed(self._input_locator, _name_last_character)
self.wait_for_element_present(_filter_suggestion_locator)
self.click(_filter_suggestion_locator)
self.wait_for_element_visible(self._update_list_locator)
self.click(self._update_list_locator, wait_flag=True)
def remove_name_filter(self, name):
_filter_locator = self._filter_locator % {'filter_name': name.lower()}
self.click(_filter_locator)
self.wait_for_element_visible(self._update_list_locator)
self.click(self._update_list_locator, wait_flag=True)
def clone_cycle(self, name='Test Cycle'):
_clone_cycle_locator = self._clone_cycle_locator % {'cycle_name': name}
_cloned_cycle_locator = self._cloned_cycle_locator % {'cycle_name': name}
cloned_cycle = {}
self.click(_clone_cycle_locator)
self.wait_for_element_visible(_cloned_cycle_locator)
cloned_cycle['name'] = self.get_text(_cloned_cycle_locator)
cloned_cycle['manage_locator'] = self._cycle_manage_locator % {'cycle_name': cloned_cycle['name']}
cloned_cycle['homepage_locator'] = self._cycle_homepage_locator % {'cycle_name': cloned_cycle['name']}
return cloned_cycle
def activate_cycle(self, name='Test Cycle'):
_cycle_status_locator = self._cycle_status_locator % {'cycle_name': name}
self.click(_cycle_status_locator)
self.wait_for_ajax()

95
manage_versions_page.py Normal file
Просмотреть файл

@ -0,0 +1,95 @@
#!/usr/bin/env python
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Case Conductor
#
# The Initial Developer of the Original Code is
# Mozilla Corp.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Jonny Gerig Meyer <jonny@oddbird.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
from base_page import CaseConductorBasePage
class CaseConductorManageVersionsPage(CaseConductorBasePage):
_page_title = 'Mozilla Case Conductor'
_version_manage_locator = u'css=#manageproductversions .listitem .title[title="%(product_name)s %(version_name)s"]'
_version_homepage_locator = u'css=.runsdrill .runsfinder .productversions .colcontent .title[title="%(version_name)s"][data-product="%(product_name)s"])'
_delete_version_locator = u'css=#manageproductversions .listitem .action-delete[title="delete %(product_name)s %(version_name)s"]'
_clone_version_locator = u'css=#manageproductversions .listitem .action-clone[title="clone %(product_name)s %(version_name)s"]'
_filter_input_locator = 'id=text-filter'
_filter_suggestion_locator = u'css=#filter .textual .suggest .suggestion[data-type="version"][data-name="%(filter_name)s"]'
_filter_locator = u'css=#filterform .filter-group input[data-name="version"][value="%(filter_name)s"]'
def go_to_manage_versions_page(self):
self.selenium.open('/manage/productversions/')
self.is_the_current_page
def delete_version(self, name='Test Version', product_name='Test Product'):
_delete_locator = self._delete_version_locator % {'product_name': product_name, 'version_name': name}
self.click(_delete_locator)
self.wait_for_ajax()
def filter_versions_by_name(self, name):
_filter_locator = self._filter_locator % {'filter_name': name.lower()}
_filter_suggestion_locator = self._filter_suggestion_locator % {'filter_name': name}
_name_without_last_character = name[:-1]
_name_last_character = name[-1]
self.type(self._filter_input_locator, _name_without_last_character)
self.key_pressed(self._filter_input_locator, _name_last_character)
self.wait_for_element_present(_filter_suggestion_locator)
self.click(_filter_suggestion_locator)
self.wait_for_element_present(_filter_locator)
self.wait_for_ajax()
def remove_name_filter(self, name):
_filter_locator = self._filter_locator % {'filter_name': name.lower()}
self.click(_filter_locator)
self.wait_for_ajax()
def clone_version(self, name='Test Version', product_name='Test Product'):
_clone_version_locator = self._clone_version_locator % {'product_name': product_name, 'version_name': name}
cloned_version = {}
self.click(_clone_version_locator)
self.wait_for_ajax()
cloned_version['product_name'] = product_name
cloned_version['name'] = name + '.next'
cloned_version['manage_locator'] = self._version_manage_locator % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']}
cloned_version['homepage_locator'] = self._version_homepage_locator % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']}
return cloned_version

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

@ -1,92 +0,0 @@
#!/usr/bin/env python
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Case Conductor
#
# The Initial Developer of the Original Code is
# Mozilla Corp.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Jonny Gerig Meyer <jonny@oddbird.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
from manage_cycles_page import CaseConductorManageCyclesPage
from base_test import BaseTest
from unittestzero import Assert
class TestManageCyclesPage(BaseTest):
def test_that_user_can_create_and_delete_cycle(self, mozwebqa_logged_in):
manage_cycles_pg = CaseConductorManageCyclesPage(mozwebqa_logged_in)
cycle = self.create_cycle(mozwebqa_logged_in)
manage_cycles_pg.filter_cycles_by_name(name=cycle['name'])
Assert.true(manage_cycles_pg.is_element_present(cycle['manage_locator']))
manage_cycles_pg.delete_cycle(name=cycle['name'])
Assert.false(manage_cycles_pg.is_element_present(cycle['manage_locator']))
self.delete_product(mozwebqa_logged_in, cycle['product'])
def test_that_user_can_filter_cycle_by_name(self, mozwebqa_logged_in):
manage_cycles_pg = CaseConductorManageCyclesPage(mozwebqa_logged_in)
cycle = self.create_cycle(mozwebqa_logged_in)
manage_cycles_pg.filter_cycles_by_name(name='Another Cycle')
Assert.false(manage_cycles_pg.is_element_present(cycle['manage_locator']))
manage_cycles_pg.remove_name_filter(name='Another Cycle')
manage_cycles_pg.filter_cycles_by_name(name=cycle['name'])
Assert.true(manage_cycles_pg.is_element_present(cycle['manage_locator']))
self.delete_cycle(mozwebqa_logged_in, cycle, delete_product=True)
def test_that_user_can_clone_cycle(self, mozwebqa_logged_in):
manage_cycles_pg = CaseConductorManageCyclesPage(mozwebqa_logged_in)
cycle = self.create_cycle(mozwebqa_logged_in)
manage_cycles_pg.filter_cycles_by_name(name=cycle['name'])
cloned_cycle = manage_cycles_pg.clone_cycle(name=cycle['name'])
Assert.true(manage_cycles_pg.is_element_present(cloned_cycle['manage_locator']))
manage_cycles_pg.delete_cycle(name=cloned_cycle['name'])
Assert.false(manage_cycles_pg.is_element_present(cloned_cycle['manage_locator']))
self.delete_cycle(mozwebqa_logged_in, cycle, delete_product=True)

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

@ -0,0 +1,92 @@
#!/usr/bin/env python
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Case Conductor
#
# The Initial Developer of the Original Code is
# Mozilla Corp.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Jonny Gerig Meyer <jonny@oddbird.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
from manage_versions_page import CaseConductorManageVersionsPage
from base_test import BaseTest
from unittestzero import Assert
class TestManageVersionsPage(BaseTest):
def test_that_user_can_create_and_delete_version(self, mozwebqa_logged_in):
manage_versions_pg = CaseConductorManageVersionsPage(mozwebqa_logged_in)
version = self.create_version(mozwebqa_logged_in)
manage_versions_pg.filter_versions_by_name(name=version['name'])
Assert.true(manage_versions_pg.is_element_present(version['manage_locator']))
manage_versions_pg.delete_version(name=version['name'], product_name=version['product']['name'])
Assert.false(manage_versions_pg.is_element_present(version['manage_locator']))
self.delete_product(mozwebqa_logged_in, version['product'])
def test_that_user_can_filter_version_by_name(self, mozwebqa_logged_in):
manage_versions_pg = CaseConductorManageVersionsPage(mozwebqa_logged_in)
version = self.create_version(mozwebqa_logged_in)
manage_versions_pg.filter_versions_by_name(name='Another Version')
Assert.false(manage_versions_pg.is_element_present(version['manage_locator']))
manage_versions_pg.remove_name_filter(name='Another Version')
manage_versions_pg.filter_versions_by_name(name=version['name'])
Assert.true(manage_versions_pg.is_element_present(version['manage_locator']))
self.delete_version(mozwebqa_logged_in, version, delete_product=True)
def test_that_user_can_clone_version(self, mozwebqa_logged_in):
manage_versions_pg = CaseConductorManageVersionsPage(mozwebqa_logged_in)
version = self.create_version(mozwebqa_logged_in)
manage_versions_pg.filter_versions_by_name(name=version['name'])
cloned_version = manage_versions_pg.clone_version(name=version['name'], product_name=version['product']['name'])
Assert.true(manage_versions_pg.is_element_present(cloned_version['manage_locator']))
manage_versions_pg.delete_version(name=cloned_version['name'], product_name=cloned_version['product_name'])
Assert.false(manage_versions_pg.is_element_present(cloned_version['manage_locator']))
self.delete_version(mozwebqa_logged_in, version, delete_product=True)