Merge remote-tracking branch 'mozilla/master' into MPL2

This commit is contained in:
bebef1987 2012-02-28 18:37:06 +02:00
Родитель cf06038938 38ae68cb14
Коммит 8bd93917db
13 изменённых файлов: 232 добавлений и 254 удалений

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

@ -1,5 +1,5 @@
#!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@ -9,10 +9,8 @@ from page import Page
class CaseConductorBasePage(Page):
_user_name_locator = "css=.meta>ul>li"
_logout_locator = "css=.meta>ul>li>a"
_user_name_locator = 'css=#accountnav .account-welcome .fn'
_logout_locator = 'css=#accountnav .account-links .signout'
@property
def is_user_logged_in(self):

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

@ -12,8 +12,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
@ -38,32 +38,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)

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

@ -1,43 +0,0 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from base_page import CaseConductorBasePage
from datetime import datetime
class CaseConductorCreateCyclePage(CaseConductorBasePage):
_page_title = 'Mozilla Case Conductor'
_name_locator = 'id=id_name'
_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)"
def go_to_create_cycle_page(self):
self.selenium.open('/manage/testcycle/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'):
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']}
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.click(self._submit_locator, wait_flag=True)
return cycle

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

@ -10,26 +10,34 @@ from datetime import datetime
class CaseConductorCreateProductPage(CaseConductorBasePage):
_page_title = "Mozilla Case Conductor"
_page_title = 'Mozilla Case Conductor'
_name_locator = "id=id_name"
_profile_locator = "id=id_profile"
_description_locator = "id=id_description"
_submit_locator = "css=div.form-actions>button"
_product_locator = u'css=#manageproducts article.item .title:contains(%(product_name)s)'
_name_locator = 'id=id_name'
_version_locator = 'id=id_version'
_profile_locator = 'id=id_profile'
_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/')
self.is_the_current_page
def create_product(self, name="Test Product", desc="This is a test product", profile="Browser Testing Environments"):
def create_product(self, name='Test Product', version='Test Version', desc='This is a test product', profile='Browser Testing Environments'):
dt_string = datetime.utcnow().isoformat()
product = {}
product['name'] = name + ' ' + dt_string
product['desc'] = desc + ' created on ' + dt_string
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['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']['name'])
self.type(self._description_locator, product['desc'])
self.select(self._profile_locator, profile)
self.click(self._submit_locator, wait_flag=True)

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

@ -0,0 +1,36 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from base_page import CaseConductorBasePage
from datetime import datetime
class CaseConductorCreateVersionPage(CaseConductorBasePage):
_page_title = 'Mozilla Case Conductor'
_version_name_locator = 'id=id_version'
_product_select_locator = 'id=id_product'
_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_version_page(self):
self.selenium.open('/manage/productversion/add/')
self.is_the_current_page
def create_version(self, name='Test Version', product_name='Test Product'):
dt_string = datetime.utcnow().isoformat()
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._version_name_locator, version['name'])
self.select(self._product_select_locator, product_name)
self.click(self._submit_locator, wait_flag=True)
return version

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

@ -12,7 +12,7 @@
#
# Example:
# admin:
# email: email@site.com
# username: username
# password: password
# name: Test User
#
@ -21,19 +21,19 @@
#
# Example:
# admin:
# email: email@site.com
# username: username
# password: password
# name: Test User
# username: testuser
# email: email@site.com
# some_user_data: data
#
# The contents of this file are accessible via the pytest-mozwebqa plugin:
#
# Example:
# credentials = mozwebqa.credentials['default']
# credentials['email']
# credentials['username']
default:
email: <value>
username: <value>
password: <value>
name: <value>

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

@ -9,21 +9,18 @@ from base_page import CaseConductorBasePage
class CaseConductorLoginPage(CaseConductorBasePage):
_page_title = "Mozilla Case Conductor"
_page_title = 'Mozilla Case Conductor'
_signin_locator = "css=nav.meta>ul>li>a:nth(0)"
_register_locator = "css=nav.meta>ul>li>a:nth(1)"
_account_locator = "css=nav.meta>ul"
_username_locator = 'id=id_username'
_password_locator = 'id=id_password'
_submit_locator = 'css=#loginform .form-actions > button'
_register_locator = 'css=#loginform .form-actions > a'
_email_locator = "id=id_email"
_password_locator = "id=id_password"
_submit_locator = "css=div.form-actions>button"
def login(self, user="default"):
def login(self, user='default'):
if type(user) is str:
user = self.testsetup.credentials[user]
self.type(self._email_locator, user['email'])
self.type(self._username_locator, user['username'])
self.type(self._password_locator, user['password'])
self.click(self._submit_locator, True)
from home_page import CaseConductorHomePage
@ -35,8 +32,4 @@ class CaseConductorLoginPage(CaseConductorBasePage):
@property
def is_signin_visible(self):
return self.is_element_visible(self._signin_locator)
@property
def account_text(self):
return self.get_text(self._account_locator)
return self.is_element_visible(self._submit_locator)

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

@ -1,72 +0,0 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
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()

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

@ -9,51 +9,50 @@ from base_page import CaseConductorBasePage
class CaseConductorManageProductsPage(CaseConductorBasePage):
_page_title = "Mozilla Case Conductor"
_delete_product_locator = u"css=#manageproducts article.item .title:contains(%(product_name)s) ~ .controls button[title='delete']"
_input_locator = 'id=text-filter'
_update_list_locator = 'css=#filter .visual .content .form-actions button'
_filter_suggestion_locator = u'css=#filter .textual .suggest a:contains(%(filter_name)s)'
_filter_locator = u'css=#filter .visual .filter-group input[value="%(filter_name)s"]'
_page_title = 'Mozilla Case Conductor'
_delete_product_locator = u'css=#manageproducts .listitem .controls .action-delete[title="delete %(product_name)s"]'
_filter_input_locator = 'id=text-filter'
_filter_suggestion_locator = u'css=#filter .textual .suggest .suggestion[data-type="name"][data-name="%(filter_name)s"]'
_filter_locator = u'css=#filterform .filter-group input[data-name="name"][value="%(filter_name)s"]'
def go_to_manage_products_page(self):
self.selenium.open('/manage/products/')
self.is_the_current_page
def delete_product(self, name="Test Product"):
_delete_locator = self._delete_product_locator % {"product_name": name}
def delete_product(self, name='Test Product'):
_delete_locator = self._delete_product_locator % {'product_name': name}
self.click(_delete_locator)
self.wait_for_ajax()
def filter_products_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._input_locator, _name_without_last_character)
self.key_pressed(self._input_locator, _name_last_character)
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_visible(self._update_list_locator)
self.click(self._update_list_locator, wait_flag=True)
self.wait_for_element_present(_filter_locator)
self.wait_for_ajax()
def filter_products_by_name_without_mouse(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._input_locator, _name_without_last_character)
self.key_pressed(self._input_locator, _name_last_character)
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.key_pressed(self._input_locator, '\\13')
self.wait_for_element_visible(self._update_list_locator)
self.key_pressed(self._input_locator, '\\13')
self.selenium.wait_for_page_to_load(self.timeout)
self.key_pressed(self._filter_input_locator, '13')
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_element_visible(self._update_list_locator)
self.click(self._update_list_locator, wait_flag=True)
self.wait_for_ajax()

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

@ -0,0 +1,63 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
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

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

@ -17,16 +17,13 @@ class TestHomepage(BaseTest):
user = home_pg.testsetup.credentials['default']
home_pg.go_to_homepage_page()
# TODO: uncomment when the id's are added
#Assert.false(home_pg.is_user_logged_in)
Assert.true(home_pg.is_user_logged_in)
welcome_text = u'Welcome %s [Sign Out]' % user['name']
Assert.equal(home_pg.users_name_text, welcome_text)
users_name_text = user['name']
Assert.equal(home_pg.users_name_text, users_name_text)
login_page = home_pg.logout()
#Assert.false(home_pg.is_user_logged_in)
Assert.false(home_pg.is_user_logged_in)
Assert.true(login_page.is_register_visible)
Assert.true(login_page.is_signin_visible)

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

@ -1,60 +0,0 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
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,60 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
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)