Switch to native asserts
This commit is contained in:
Родитель
3b63798c22
Коммит
7bfa3bc4d5
|
@ -4,7 +4,6 @@
|
|||
|
||||
import json
|
||||
|
||||
from unittestzero import Assert
|
||||
import requests
|
||||
|
||||
|
||||
|
@ -79,13 +78,13 @@ class MoztrapAPI:
|
|||
product['id'], response_text = self._do_post(uri, post_data, True)
|
||||
product['version']['uri'] = response_text['productversions'][0]['resource_uri']
|
||||
|
||||
Assert.greater(product['id'], 0, 'No product was created.')
|
||||
assert product['id'] > 0, 'No product was created.'
|
||||
|
||||
def delete_product(self, product):
|
||||
|
||||
uri = "api/v1/product"
|
||||
self.params['permanent'] = True
|
||||
Assert.true(self._do_delete(uri, product['id']), 'Deletion of product %s failed' % product['name'])
|
||||
assert self._do_delete(uri, product['id']), 'Deletion of product %s failed' % product['name']
|
||||
|
||||
def create_category(self, category):
|
||||
|
||||
|
@ -95,13 +94,13 @@ class MoztrapAPI:
|
|||
}
|
||||
category['id'] = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(category['id'], 0, 'No category was created.')
|
||||
assert category['id'] > 0, 'No category was created.'
|
||||
|
||||
def delete_category(self, category):
|
||||
|
||||
uri = "api/v1/category"
|
||||
self.params['permanent'] = True
|
||||
Assert.true(self._do_delete(uri, category['id']), 'Deletion of product %s failed' % category['name'])
|
||||
assert self._do_delete(uri, category['id']), 'Deletion of product %s failed' % category['name']
|
||||
|
||||
def create_element(self, element):
|
||||
|
||||
|
@ -116,7 +115,7 @@ class MoztrapAPI:
|
|||
}
|
||||
element['id'] = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(element['id'], 0, 'No element was created.')
|
||||
assert element['id'] > 0, 'No element was created.'
|
||||
|
||||
def delete_element(self, element):
|
||||
|
||||
|
@ -130,18 +129,18 @@ class MoztrapAPI:
|
|||
# Next delete the Element
|
||||
uri = "api/v1/element"
|
||||
self.params['permanent'] = True
|
||||
Assert.true(self._do_delete(uri, element['id']), 'Deletion of element %s failed' % element['name'])
|
||||
assert self._do_delete(uri, element['id']), 'Deletion of element %s failed' % element['name']
|
||||
|
||||
# Finally delete the embedded Category
|
||||
uri = "api/v1/category"
|
||||
category = element['category']
|
||||
Assert.true(self._do_delete(uri, category['id']), 'Deletion of category %s failed' % category['name'])
|
||||
assert self._do_delete(uri, category['id']), 'Deletion of category %s failed' % category['name']
|
||||
|
||||
def delete_environment(self, environment):
|
||||
|
||||
uri = "api/v1/environment"
|
||||
self.params['permanent'] = True
|
||||
Assert.true(self._do_delete(uri, environment['id']), 'Deletion of environment %s failed' % environment['id'])
|
||||
assert self._do_delete(uri, environment['id']), 'Deletion of environment %s failed' % environment['id']
|
||||
|
||||
def create_suite(self, suite, product, case_list=[]):
|
||||
|
||||
|
@ -152,7 +151,7 @@ class MoztrapAPI:
|
|||
}
|
||||
suite['id'] = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(suite['id'], 0, 'No suite was created.')
|
||||
assert suite['id'] > 0, 'No suite was created.'
|
||||
|
||||
# add cases to suite
|
||||
for i, case in enumerate(case_list):
|
||||
|
@ -168,7 +167,7 @@ class MoztrapAPI:
|
|||
}
|
||||
id = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(id, 0, 'No suite_case was created.')
|
||||
assert id > 0, 'No suite_case was created.'
|
||||
|
||||
def create_case(self, case, product):
|
||||
|
||||
|
@ -180,7 +179,7 @@ class MoztrapAPI:
|
|||
}
|
||||
case['id'] = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(case['id'], 0, 'No case was created.')
|
||||
assert case['id'] > 0, 'No case was created.'
|
||||
|
||||
# Next create the caseversion
|
||||
uri = "api/v1/caseversion/"
|
||||
|
@ -193,7 +192,7 @@ class MoztrapAPI:
|
|||
case['version']['id'], response_text = self._do_post(uri, post_data, True)
|
||||
case['version']['uri'] = response_text['resource_uri']
|
||||
|
||||
Assert.greater(case['version']['id'], 0, 'No caseversion was created.')
|
||||
assert case['version']['id'] > 0, 'No caseversion was created.'
|
||||
|
||||
# Next create the casestep
|
||||
uri = "api/v1/casestep/"
|
||||
|
@ -204,4 +203,4 @@ class MoztrapAPI:
|
|||
}
|
||||
id = self._do_post(uri, post_data)
|
||||
|
||||
Assert.greater(id, 0, 'No casestep was created.')
|
||||
assert id > 0, 'No casestep was created.'
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
# 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 unittestzero import Assert
|
||||
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException, ElementNotVisibleException
|
||||
from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException
|
||||
|
||||
|
||||
class Page(object):
|
||||
|
@ -25,7 +23,7 @@ class Page(object):
|
|||
def is_the_current_page(self):
|
||||
if self._page_title:
|
||||
page_title = self.page_title
|
||||
Assert.contains(self._page_title, page_title)
|
||||
assert self._page_title in page_title
|
||||
|
||||
@property
|
||||
def url_current_page(self):
|
||||
|
@ -70,8 +68,6 @@ class Page(object):
|
|||
try:
|
||||
WebDriverWait(self.selenium, self.timeout).until(
|
||||
lambda s: self._selenium_root.find_element(*locator).is_displayed())
|
||||
except TimeoutException:
|
||||
Assert.fail(TimeoutException)
|
||||
finally:
|
||||
self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
|
||||
|
||||
|
@ -80,8 +76,6 @@ class Page(object):
|
|||
try:
|
||||
WebDriverWait(self.selenium, self.timeout).until(
|
||||
lambda s: self._selenium_root.find_element(*locator))
|
||||
except TimeoutException:
|
||||
Assert.fail(TimeoutException)
|
||||
finally:
|
||||
self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
|
||||
|
||||
|
@ -90,8 +84,6 @@ class Page(object):
|
|||
try:
|
||||
WebDriverWait(self.selenium, self.timeout).until(
|
||||
lambda s: len(self._selenium_root.find_elements(*locator)) < 1)
|
||||
except TimeoutException:
|
||||
Assert.fail(TimeoutException)
|
||||
finally:
|
||||
self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
|
||||
|
||||
|
@ -100,8 +92,6 @@ class Page(object):
|
|||
try:
|
||||
WebDriverWait(self.selenium, self.timeout).until(
|
||||
lambda s: s.execute_script('return $.active == 0'))
|
||||
except TimeoutException:
|
||||
Assert.fail('wait for AJAX timed out after %s seconds' % self.timeout)
|
||||
finally:
|
||||
self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ pytest==2.7.3
|
|||
pytest-mozwebqa
|
||||
pytest-variables
|
||||
requests==2.8.1
|
||||
UnittestZero
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.home_page import MozTrapHomePage
|
||||
from pages.base_test import BaseTest
|
||||
|
||||
|
@ -20,16 +18,16 @@ class TestHomepage(BaseTest):
|
|||
home_pg = MozTrapHomePage(mozwebqa)
|
||||
|
||||
home_pg.get_relative_path('/')
|
||||
Assert.false(home_pg.header.is_user_logged_in)
|
||||
assert not home_pg.header.is_user_logged_in
|
||||
|
||||
login_pg.go_to_login_page()
|
||||
login_pg.login(existing_user['email'], existing_user['password'])
|
||||
Assert.true(home_pg.header.is_user_logged_in)
|
||||
Assert.equal(home_pg.header.username_text, existing_user['name'])
|
||||
assert home_pg.header.is_user_logged_in
|
||||
assert existing_user['name'] == home_pg.header.username_text
|
||||
|
||||
home_pg.header.click_logout()
|
||||
home_pg.get_relative_path('/')
|
||||
Assert.false(home_pg.header.is_user_logged_in)
|
||||
assert not home_pg.header.is_user_logged_in
|
||||
|
||||
@pytest.mark.moztrap(3387)
|
||||
def test_that_user_can_select_product(self, mozwebqa, login, product):
|
||||
|
@ -37,11 +35,11 @@ class TestHomepage(BaseTest):
|
|||
|
||||
home_pg.go_to_home_page()
|
||||
|
||||
Assert.false(home_pg.is_product_version_visible(product))
|
||||
assert not home_pg.is_product_version_visible(product)
|
||||
|
||||
home_pg.select_item(product['name'])
|
||||
|
||||
Assert.true(home_pg.is_product_version_visible(product))
|
||||
assert home_pg.is_product_version_visible(product)
|
||||
|
||||
@pytest.mark.moztrap(3388)
|
||||
def test_that_user_can_select_version(self, mozwebqa, login, product):
|
||||
|
@ -52,11 +50,11 @@ class TestHomepage(BaseTest):
|
|||
home_pg.go_to_home_page()
|
||||
home_pg.select_item(run['version']['product']['name'])
|
||||
|
||||
Assert.false(home_pg.is_element_visible(*run['homepage_locator']))
|
||||
assert not home_pg.is_element_visible(*run['homepage_locator'])
|
||||
|
||||
home_pg.select_item(run['version']['name'])
|
||||
|
||||
Assert.true(home_pg.is_element_visible(*run['homepage_locator']))
|
||||
assert home_pg.is_element_visible(*run['homepage_locator'])
|
||||
|
||||
@pytest.mark.moztrap(3414)
|
||||
def test_that_user_can_select_run(self, mozwebqa, login, product):
|
||||
|
@ -68,8 +66,8 @@ class TestHomepage(BaseTest):
|
|||
home_pg.select_item(run['version']['product']['name'])
|
||||
home_pg.select_item(run['version']['name'])
|
||||
|
||||
Assert.false(home_pg.is_element_visible(*run['run_tests_locator']))
|
||||
assert not home_pg.is_element_visible(*run['run_tests_locator'])
|
||||
|
||||
home_pg.select_item(run['name'])
|
||||
|
||||
Assert.true(home_pg.is_element_visible(*run['run_tests_locator']))
|
||||
assert home_pg.is_element_visible(*run['run_tests_locator'])
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from mocks.mock_case import MockCase
|
||||
from mocks.mock_tag import MockTag
|
||||
|
@ -21,11 +20,11 @@ class TestManageCasesPage(BaseTest):
|
|||
|
||||
manage_cases_pg.filter_form.filter_by(lookup='name', value=case['name'])
|
||||
|
||||
Assert.true(manage_cases_pg.is_element_present(*case['locator']))
|
||||
assert manage_cases_pg.is_element_present(*case['locator'])
|
||||
|
||||
manage_cases_pg.delete_case(name=case['name'])
|
||||
|
||||
Assert.false(manage_cases_pg.is_element_present(*case['locator']))
|
||||
assert not manage_cases_pg.is_element_present(*case['locator'])
|
||||
|
||||
def test_that_deleting_single_version_of_case_does_not_delete_all_versions(self, api, mozwebqa, login, product):
|
||||
# prerequisites
|
||||
|
@ -51,9 +50,9 @@ class TestManageCasesPage(BaseTest):
|
|||
test_cases = manage_cases_pg.test_cases
|
||||
|
||||
# check that there is only one test case left and ensure its version equals to second version
|
||||
Assert.equal(len(test_cases), 1, u'there should be only one case')
|
||||
Assert.equal(test_cases[0].name, test_case['name'], u'that\'s wrong test case')
|
||||
Assert.equal(test_cases[0].product_version, product_versions[0], u'that\'s wrong product version')
|
||||
assert 1 == len(test_cases)
|
||||
assert test_case['name'] == test_cases[0].name
|
||||
assert product_versions[0] == test_cases[0].product_version
|
||||
|
||||
def test_that_manage_cases_list_shows_all_case_versions_individually(self, api, mozwebqa, login, product):
|
||||
# prerequisites
|
||||
|
@ -69,13 +68,10 @@ class TestManageCasesPage(BaseTest):
|
|||
filtered_cases = manage_cases_pg.test_cases
|
||||
|
||||
for case in filtered_cases:
|
||||
Assert.equal(case.name, test_case['name'], u'that\'s wrong case we\'ve got here')
|
||||
assert test_case['name'] == case.name
|
||||
|
||||
# check that both product versions are displayed
|
||||
Assert.equal(
|
||||
sorted(product_versions),
|
||||
sorted([case.product_version for case in filtered_cases]),
|
||||
u'expected product versions of test cases don\'t match actual ones')
|
||||
assert sorted(product_versions) == sorted([case.product_version for case in filtered_cases])
|
||||
|
||||
def test_that_creates_tag_during_test_case_creation(self, mozwebqa, login, product):
|
||||
mock_tag = MockTag()
|
||||
|
@ -86,6 +82,5 @@ class TestManageCasesPage(BaseTest):
|
|||
manage_cases_pg.filter_form.filter_by(lookup='name', value=test_case['name'])
|
||||
filtered_cases = manage_cases_pg.test_cases
|
||||
|
||||
Assert.equal(len(filtered_cases), 1, u'there should be only one case')
|
||||
Assert.equal(filtered_cases[0].tag_name, mock_tag['name'].lower(),
|
||||
'actual tag name does not match expected value')
|
||||
assert 1 == len(filtered_cases)
|
||||
assert mock_tag['name'].lower() == filtered_cases[0].tag_name
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_products_page import MozTrapManageProductsPage
|
||||
|
@ -19,11 +18,11 @@ class TestManageProductsPage(BaseTest):
|
|||
|
||||
manage_products_pg.filter_form.filter_by(lookup='name', value=product['name'])
|
||||
|
||||
Assert.true(manage_products_pg.is_element_present(*product['locator']))
|
||||
assert manage_products_pg.is_element_present(*product['locator'])
|
||||
|
||||
manage_products_pg.delete_product(name=product['name'])
|
||||
|
||||
Assert.false(manage_products_pg.is_element_present(*product['locator']))
|
||||
assert not manage_products_pg.is_element_present(*product['locator'])
|
||||
|
||||
@pytest.mark.moztrap(151)
|
||||
def test_that_user_can_filter_product_by_name(self, mozwebqa, login, product):
|
||||
|
@ -32,12 +31,12 @@ class TestManageProductsPage(BaseTest):
|
|||
|
||||
filter_item = manage_products_pg.filter_form.filter_by(lookup='name', value='Another Product')
|
||||
|
||||
Assert.false(manage_products_pg.is_product_present(product))
|
||||
assert not manage_products_pg.is_product_present(product)
|
||||
|
||||
filter_item.remove_filter()
|
||||
manage_products_pg.filter_form.filter_by(lookup='name', value=product['name'])
|
||||
|
||||
Assert.true(manage_products_pg.is_product_present(product))
|
||||
assert manage_products_pg.is_product_present(product)
|
||||
|
||||
@pytest.mark.moztrap(3415)
|
||||
def test_that_user_can_filter_product_by_name_without_mouse(self, mozwebqa, login, product):
|
||||
|
@ -46,9 +45,9 @@ class TestManageProductsPage(BaseTest):
|
|||
|
||||
filter_item = manage_products_pg.filter_form.filter_without_mouse_by(lookup='name', value='Another Product')
|
||||
|
||||
Assert.false(manage_products_pg.is_product_present(product))
|
||||
assert not manage_products_pg.is_product_present(product)
|
||||
|
||||
filter_item.remove_filter()
|
||||
manage_products_pg.filter_form.filter_without_mouse_by(lookup='name', value=product['name'])
|
||||
|
||||
Assert.true(manage_products_pg.is_product_present(product))
|
||||
assert manage_products_pg.is_product_present(product)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_profiles_page import MozTrapManageProfilesPage
|
||||
|
@ -21,11 +20,11 @@ class TestManageProfilesPage(BaseTest):
|
|||
|
||||
manage_profiles_pg.filter_form.filter_by(lookup='name', value=profile['name'])
|
||||
|
||||
Assert.true(manage_profiles_pg.is_element_present(*profile['locator']))
|
||||
assert manage_profiles_pg.is_element_present(*profile['locator'])
|
||||
|
||||
manage_profiles_pg.delete_profile(name=profile['name'])
|
||||
|
||||
Assert.false(manage_profiles_pg.is_element_present(*profile['locator']))
|
||||
assert not manage_profiles_pg.is_element_present(*profile['locator'])
|
||||
|
||||
create_profile_pg.go_to_create_profile_page()
|
||||
create_profile_pg.delete_environment_category(category_name=profile['category'])
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_runs_page import MozTrapManageRunsPage
|
||||
|
@ -19,11 +18,11 @@ class TestManageRunsPage(BaseTest):
|
|||
|
||||
manage_runs_pg.filter_form.filter_by(lookup='name', value=run['name'])
|
||||
|
||||
Assert.true(manage_runs_pg.is_element_present(*run['manage_locator']))
|
||||
assert manage_runs_pg.is_element_present(*run['manage_locator'])
|
||||
|
||||
manage_runs_pg.delete_run(name=run['name'])
|
||||
|
||||
Assert.false(manage_runs_pg.is_element_present(*run['manage_locator']))
|
||||
assert not manage_runs_pg.is_element_present(*run['manage_locator'])
|
||||
|
||||
@pytest.mark.moztrap(3302)
|
||||
def test_for_edit_active_run_that_includes_suites_to_be_sure_they_are_listed(self, api, mozwebqa, login, product):
|
||||
|
@ -45,19 +44,13 @@ class TestManageRunsPage(BaseTest):
|
|||
edit_run_pg = manage_runs_pg.go_to_edit_run_page(test_run['name'])
|
||||
|
||||
# assert that multiselect widget is not present thus suites list is readonly
|
||||
Assert.false(
|
||||
edit_run_pg.is_multiselect_widget_present,
|
||||
u'multiselect widget should not be present')
|
||||
assert not edit_run_pg.is_multiselect_widget_present
|
||||
# assert that order of suites is correct
|
||||
Assert.equal(
|
||||
suite_order, edit_run_pg.readonly_included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
assert suite_order == edit_run_pg.readonly_included_suites
|
||||
|
||||
edit_run_pg.save_run()
|
||||
test_run = manage_runs_pg.test_runs[0]
|
||||
test_run.show_details()
|
||||
|
||||
# assert that order of suites is still correct
|
||||
Assert.equal(
|
||||
suite_order, test_run.included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
assert suite_order == test_run.included_suites
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import random
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_suites_page import MozTrapManageSuitesPage
|
||||
|
@ -21,11 +20,11 @@ class TestManageSuitesPage(BaseTest):
|
|||
|
||||
manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name'])
|
||||
|
||||
Assert.true(manage_suites_pg.is_element_present(*suite['locator']))
|
||||
assert manage_suites_pg.is_element_present(*suite['locator'])
|
||||
|
||||
manage_suites_pg.delete_suite(name=suite['name'])
|
||||
|
||||
Assert.false(manage_suites_pg.is_element_present(*suite['locator']))
|
||||
assert not manage_suites_pg.is_element_present(*suite['locator'])
|
||||
|
||||
def test_that_user_can_create_suite_and_add_some_cases_to_it(self, api, mozwebqa, login, product):
|
||||
manage_suites_pg = MozTrapManageSuitesPage(mozwebqa)
|
||||
|
@ -35,12 +34,12 @@ class TestManageSuitesPage(BaseTest):
|
|||
|
||||
manage_suites_pg.go_to_manage_suites_page()
|
||||
manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name'])
|
||||
Assert.true(manage_suites_pg.is_suite_present(suite))
|
||||
assert manage_suites_pg.is_suite_present(suite)
|
||||
|
||||
manage_test_cases_pg = manage_suites_pg.view_cases(name=suite['name'])
|
||||
|
||||
for case in cases:
|
||||
Assert.true(manage_test_cases_pg.is_case_present(case))
|
||||
assert manage_test_cases_pg.is_case_present(case)
|
||||
|
||||
@pytest.mark.moztrap(2743)
|
||||
def test_editing_of_existing_suite_that_has_no_included_cases(self, api, mozwebqa, login, product):
|
||||
|
@ -57,21 +56,14 @@ class TestManageSuitesPage(BaseTest):
|
|||
edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name'])
|
||||
|
||||
# product field should not be read-only.
|
||||
Assert.false(
|
||||
edit_suite_pg.is_product_field_readonly,
|
||||
u'product version field should be editable')
|
||||
assert not edit_suite_pg.is_product_field_readonly
|
||||
|
||||
edit_suite_pg.include_cases_to_suite(case_list)
|
||||
|
||||
edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name'])
|
||||
|
||||
Assert.true(
|
||||
edit_suite_pg.is_product_field_readonly,
|
||||
u'product version field should be read-only')
|
||||
|
||||
Assert.equal(
|
||||
[item.name for item in edit_suite_pg.included_cases], case_list,
|
||||
u'items are listed in wrong order')
|
||||
assert edit_suite_pg.is_product_field_readonly
|
||||
assert case_list == [item.name for item in edit_suite_pg.included_cases]
|
||||
|
||||
@pytest.mark.moztrap(2742)
|
||||
def test_editing_of_existing_suite_that_includes_cases(self, api, mozwebqa, login, product):
|
||||
|
@ -86,19 +78,17 @@ class TestManageSuitesPage(BaseTest):
|
|||
manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name'])
|
||||
edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name'])
|
||||
|
||||
Assert.true(
|
||||
edit_suite_pg.is_product_field_readonly,
|
||||
u'product version field should be read only')
|
||||
assert edit_suite_pg.is_product_field_readonly
|
||||
|
||||
# check list of available cases
|
||||
actual_available_cases = [item.name for item in edit_suite_pg.available_cases]
|
||||
expected_available_cases = [item['name'] for item in not_included_cases]
|
||||
Assert.equal(actual_available_cases, expected_available_cases)
|
||||
assert expected_available_cases == actual_available_cases
|
||||
|
||||
# check list of included cases
|
||||
actual_included_cases = [item.name for item in edit_suite_pg.included_cases]
|
||||
expected_included_cases = [item['name'] for item in included_cases]
|
||||
Assert.equal(actual_included_cases, expected_included_cases)
|
||||
assert expected_included_cases == actual_included_cases
|
||||
|
||||
# get all cases names and make random order via random.shuffle
|
||||
all_cases = expected_available_cases + expected_included_cases
|
||||
|
@ -112,6 +102,4 @@ class TestManageSuitesPage(BaseTest):
|
|||
edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name'])
|
||||
|
||||
# and ensure that included cases are listed in right order
|
||||
Assert.equal(
|
||||
[item.name for item in edit_suite_pg.included_cases], all_cases,
|
||||
u'items are listed in wrong order')
|
||||
assert all_cases == [item.name for item in edit_suite_pg.included_cases]
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# 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 unittestzero import Assert
|
||||
|
||||
from mocks.mock_tag import MockTag
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_tags_page import MozTrapManageTagsPage
|
||||
|
@ -17,8 +15,7 @@ class TestManageTagsPage(BaseTest):
|
|||
manage_tags_pg.go_to_manage_tags_page()
|
||||
|
||||
create_tag_pg = manage_tags_pg.click_create_tag_button()
|
||||
Assert.false(create_tag_pg.is_multiselect_widget_visible,
|
||||
'multiselect widget should be hidden until product is not selected')
|
||||
assert not create_tag_pg.is_multiselect_widget_visible
|
||||
|
||||
tag = MockTag()
|
||||
create_tag_pg.create_tag(tag)
|
||||
|
@ -26,8 +23,7 @@ class TestManageTagsPage(BaseTest):
|
|||
manage_tags_pg.filter_form.filter_by(lookup='name', value=tag['name'])
|
||||
displayed_tags = manage_tags_pg.tags()
|
||||
|
||||
Assert.true(tag['name'] in [t.name for t in displayed_tags],
|
||||
'tag with "%s" name is not displayed on the page' % tag['name'])
|
||||
assert tag['name'] in [t.name for t in displayed_tags]
|
||||
|
||||
def test_creating_a_tag_with_a_product_value_and_no_cases(self, mozwebqa, login, product):
|
||||
manage_tags_pg = MozTrapManageTagsPage(mozwebqa)
|
||||
|
@ -37,15 +33,13 @@ class TestManageTagsPage(BaseTest):
|
|||
tag = MockTag(product=product['name'])
|
||||
create_tag_pg.create_tag(tag, save_tag=False)
|
||||
|
||||
Assert.true(create_tag_pg.is_multiselect_widget_visible,
|
||||
'multiselect widget should be visible after product was selected')
|
||||
assert create_tag_pg.is_multiselect_widget_visible
|
||||
|
||||
create_tag_pg.save_tag()
|
||||
manage_tags_pg.filter_form.filter_by(lookup='name', value=tag['name'])
|
||||
displayed_tags = manage_tags_pg.tags()
|
||||
|
||||
Assert.true(tag['name'] in [t.name for t in displayed_tags],
|
||||
'tag with "%s" name is not displayed on the page' % tag['name'])
|
||||
assert tag['name'] in [t.name for t in displayed_tags]
|
||||
|
||||
def test_creating_a_tag_with_a_product_value_and_cases(self, api, mozwebqa, login, product):
|
||||
# create some cases for product
|
||||
|
@ -60,8 +54,7 @@ class TestManageTagsPage(BaseTest):
|
|||
expected_case_names = [case.name for case in cases]
|
||||
actual_case_names = [case.name for case in create_tag_pg.available_caseversions]
|
||||
|
||||
Assert.equal(sorted(expected_case_names), sorted(actual_case_names),
|
||||
'list of expected caseversions differs from actually displayed')
|
||||
assert sorted(expected_case_names) == sorted(actual_case_names)
|
||||
|
||||
create_tag_pg.include_caseversions_to_tag(expected_case_names)
|
||||
|
||||
|
@ -71,5 +64,4 @@ class TestManageTagsPage(BaseTest):
|
|||
|
||||
displayed_case_names = [case.name for case in manage_cases_page.test_cases]
|
||||
|
||||
Assert.equal(sorted(expected_case_names), sorted(displayed_case_names),
|
||||
'list of test cases attached to a tag differs from expected')
|
||||
assert sorted(expected_case_names) == sorted(displayed_case_names)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_versions_page import MozTrapManageVersionsPage
|
||||
|
||||
|
@ -20,11 +18,11 @@ class TestManageVersionsPage(BaseTest):
|
|||
|
||||
manage_versions_pg.filter_form.filter_by(lookup='version', value=version['name'])
|
||||
|
||||
Assert.true(manage_versions_pg.is_element_present(*version['manage_locator']))
|
||||
assert 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']))
|
||||
assert not manage_versions_pg.is_element_present(*version['manage_locator'])
|
||||
|
||||
@pytest.mark.moztrap(3391)
|
||||
def test_that_user_can_filter_version_by_name(self, mozwebqa, login, product):
|
||||
|
@ -34,12 +32,12 @@ class TestManageVersionsPage(BaseTest):
|
|||
|
||||
filter_item = manage_versions_pg.filter_form.filter_by(lookup='version', value='Another Version')
|
||||
|
||||
Assert.false(manage_versions_pg.is_element_present(*version['manage_locator']))
|
||||
assert not manage_versions_pg.is_element_present(*version['manage_locator'])
|
||||
|
||||
filter_item.remove_filter()
|
||||
manage_versions_pg.filter_form.filter_by(lookup='version', value=version['name'])
|
||||
|
||||
Assert.true(manage_versions_pg.is_element_present(*version['manage_locator']))
|
||||
assert manage_versions_pg.is_element_present(*version['manage_locator'])
|
||||
|
||||
@pytest.mark.moztrap(3392)
|
||||
def test_that_user_can_clone_version(self, mozwebqa, login, product):
|
||||
|
@ -51,8 +49,8 @@ class TestManageVersionsPage(BaseTest):
|
|||
|
||||
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']))
|
||||
assert 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']))
|
||||
assert not manage_versions_pg.is_element_present(*cloned_version['manage_locator'])
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.manage_runs_page import MozTrapManageRunsPage
|
||||
|
@ -32,10 +31,7 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
create_run_pg = manage_runs_pg.click_create_run_button()
|
||||
|
||||
Assert.equal(
|
||||
create_run_pg.product_version_value,
|
||||
product_version_name,
|
||||
u'default product version is incorrect')
|
||||
assert product_version_name == create_run_pg.product_version_value
|
||||
|
||||
@pytest.mark.moztrap(5930)
|
||||
def test_that_pinning_name_field_filter_only_works_for_current_page(self, api, mozwebqa, login, product):
|
||||
|
@ -52,10 +48,10 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
# filter cases by name and assert that only cases with mozilla in their name are found
|
||||
cases_filter = manage_cases_pg.filter_form.filter_by(lookup='name', value=good_case_name)
|
||||
Assert.equal(cases_filter.content_text, good_case_name)
|
||||
assert good_case_name == cases_filter.content_text
|
||||
self.check_pinned_filter(cases_filter, is_pinned=False)
|
||||
for case in manage_cases_pg.test_cases:
|
||||
Assert.contains(good_case_name, case.name.lower())
|
||||
assert good_case_name in case.name.lower()
|
||||
|
||||
# pin filter and assert that it turns orange
|
||||
cases_filter.pin_filter()
|
||||
|
@ -65,14 +61,14 @@ class TestPinningFilters(BaseTest):
|
|||
manage_suites_pg.go_to_manage_suites_page()
|
||||
|
||||
# check that there is no filters applied
|
||||
Assert.equal(manage_suites_pg.filter_form.filter_items, [])
|
||||
assert [] == manage_suites_pg.filter_form.filter_items
|
||||
|
||||
# filter suites by name and assert that only suites with moztrap in their name are found
|
||||
suites_filter = manage_suites_pg.filter_form.filter_by(lookup='name', value=good_suite_name)
|
||||
Assert.equal(suites_filter.content_text, good_suite_name.lower())
|
||||
assert good_suite_name.lower() == suites_filter.content_text
|
||||
self.check_pinned_filter(suites_filter, is_pinned=False)
|
||||
for suite in manage_suites_pg.test_suites:
|
||||
Assert.contains(good_suite_name, suite.name)
|
||||
assert good_suite_name in suite.name
|
||||
|
||||
# pin filter and assert that it turns orange
|
||||
suites_filter.pin_filter()
|
||||
|
@ -81,25 +77,25 @@ class TestPinningFilters(BaseTest):
|
|||
# and check everything again on manage cases page
|
||||
manage_cases_pg.go_to_manage_cases_page()
|
||||
applied_filter = manage_cases_pg.filter_form.filter_items
|
||||
Assert.equal(len(applied_filter), 1)
|
||||
Assert.equal(applied_filter[0].content_text, good_case_name)
|
||||
assert 1 == len(applied_filter)
|
||||
assert good_case_name == applied_filter[0].content_text
|
||||
for case in manage_cases_pg.test_cases:
|
||||
Assert.contains(good_case_name, case.name.lower())
|
||||
assert good_case_name in case.name.lower()
|
||||
|
||||
# and check everything one more time on manage suites page
|
||||
manage_suites_pg.go_to_manage_suites_page()
|
||||
applied_filter = manage_suites_pg.filter_form.filter_items
|
||||
Assert.equal(len(applied_filter), 1)
|
||||
Assert.equal(applied_filter[0].content_text, good_suite_name.lower())
|
||||
assert 1 == len(applied_filter)
|
||||
assert good_suite_name.lower() == applied_filter[0].content_text
|
||||
for suite in manage_suites_pg.test_suites:
|
||||
Assert.contains(good_suite_name, suite.name)
|
||||
assert good_suite_name in suite.name
|
||||
|
||||
# and go to manage runs page and see no filters there
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
|
||||
# check that there is no filters applied
|
||||
Assert.equal(manage_runs_pg.filter_form.filter_items, [])
|
||||
assert [] == manage_runs_pg.filter_form.filter_items
|
||||
|
||||
@pytest.mark.moztrap(5933)
|
||||
def test_that_pinning_filters_on_product_sets_defaults_in_new_suite(self, mozwebqa, login, product):
|
||||
|
@ -116,10 +112,7 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
create_suite_pg = manage_suites_pg.click_create_suite_button()
|
||||
|
||||
Assert.equal(
|
||||
create_suite_pg.product_name_value,
|
||||
product['name'],
|
||||
u'default product is incorrect')
|
||||
assert product['name'] == create_suite_pg.product_name_value
|
||||
|
||||
@pytest.mark.moztrap(5932)
|
||||
@pytest.mark.xfail(reason='Bug 1008850 - Suggestion box is cut off when the filter is too long')
|
||||
|
@ -142,17 +135,17 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
# go to create case page
|
||||
create_case_pg = manage_cases_pg.click_create_case_button()
|
||||
Assert.equal(create_case_pg.product_value, product['name'])
|
||||
Assert.equal(create_case_pg.product_version_value, version['name'])
|
||||
Assert.equal(create_case_pg.suite_value, suite['name'])
|
||||
assert product['name'] == create_case_pg.product_value
|
||||
assert version['name'] == create_case_pg.product_version_value
|
||||
assert suite['name'] == create_case_pg.suite_value
|
||||
|
||||
create_case_pg.go_back()
|
||||
|
||||
# go to create bulk cases page
|
||||
create_bulk_cases_pg = manage_cases_pg.click_create_bulk_cases_button()
|
||||
Assert.equal(create_bulk_cases_pg.product_value, product['name'])
|
||||
Assert.equal(create_bulk_cases_pg.product_version_value, version['name'])
|
||||
Assert.equal(create_bulk_cases_pg.suite_value, suite['name'])
|
||||
assert product['name'] == create_bulk_cases_pg.product_value
|
||||
assert version['name'] == create_bulk_cases_pg.product_version_value
|
||||
assert suite['name'] == create_bulk_cases_pg.suite_value
|
||||
|
||||
@pytest.mark.moztrap(5936)
|
||||
def test_that_pinning_filter_on_product_sets_defaults_in_new_product_version(self, mozwebqa, login, product):
|
||||
|
@ -169,10 +162,7 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
create_version_pg = manage_versions_pg.click_create_version_button()
|
||||
|
||||
Assert.equal(
|
||||
create_version_pg.product_name_value,
|
||||
product['name'],
|
||||
u'default product is incorrect')
|
||||
assert product['name'] == create_version_pg.product_name_value
|
||||
|
||||
@pytest.mark.moztrap(5931)
|
||||
def test_that_pinning_filter_persists_for_session(self, api, mozwebqa, existing_user, login, product, element):
|
||||
|
@ -190,9 +180,8 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
# see only cases for specified product
|
||||
displayed_cases = manage_cases_pg.test_cases
|
||||
Assert.equal(len(displayed_cases), 1, 'there should be only one case displayed')
|
||||
Assert.equal(case.name.lower(), displayed_cases[0].name.lower(),
|
||||
'displayed case name differs from expected value')
|
||||
assert 1 == len(displayed_cases)
|
||||
assert case.name.lower() == displayed_cases[0].name.lower()
|
||||
|
||||
# pin product filter
|
||||
filter_item.pin_filter()
|
||||
|
@ -204,9 +193,8 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
# see only suites for specified product
|
||||
displayed_suites = manage_suites_pg.test_suites
|
||||
Assert.equal(len(displayed_suites), 1, 'there should be only one suite displayed')
|
||||
Assert.equal(suite.name.lower(), displayed_suites[0].name.lower(),
|
||||
'displayed suite name differs from expected value')
|
||||
assert 1 == len(displayed_suites)
|
||||
assert suite.name.lower() == displayed_suites[0].name.lower()
|
||||
|
||||
# go to results page
|
||||
view_results_pg = MozTrapViewRunResultsPage(mozwebqa)
|
||||
|
@ -217,11 +205,9 @@ class TestPinningFilters(BaseTest):
|
|||
# let's define a function and call it each time we need this check
|
||||
|
||||
def check_test_run_results(results):
|
||||
Assert.equal(len(results), 1, 'there should be only one test run result')
|
||||
Assert.equal(run['name'].lower(), results[0].name.lower(),
|
||||
'displayed run name differs from expected value')
|
||||
Assert.equal(product_version_name, results[0].product_version,
|
||||
'displayed test run productversion differs from expected value')
|
||||
assert 1 == len(results)
|
||||
assert run['name'].lower() == results[0].name.lower()
|
||||
assert product_version_name == results[0].product_version
|
||||
|
||||
check_test_run_results(view_results_pg.test_run_results)
|
||||
|
||||
|
@ -236,20 +222,14 @@ class TestPinningFilters(BaseTest):
|
|||
|
||||
# check that filter is still pinned
|
||||
filters = view_results_pg.filter_form.filter_items
|
||||
Assert.equal(len(filters), 1)
|
||||
assert 1 == len(filters)
|
||||
self.check_pinned_filter(filters[0], is_pinned=True)
|
||||
|
||||
def check_pinned_filter(self, filter_item, is_pinned):
|
||||
pinned_filter_color = u'#DFB081'
|
||||
if is_pinned:
|
||||
# check that filter is orange after it's been pinned
|
||||
Assert.equal(
|
||||
filter_item.get_filter_color(),
|
||||
pinned_filter_color,
|
||||
u'pinned filter\'s color is not orange')
|
||||
assert pinned_filter_color == filter_item.get_filter_color()
|
||||
else:
|
||||
# check that filter is not orange before it's pinned
|
||||
Assert.not_equal(
|
||||
filter_item.get_filter_color(),
|
||||
pinned_filter_color,
|
||||
u'filter is orange before it was pinned')
|
||||
assert not pinned_filter_color == filter_item.get_filter_color()
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
from unittestzero import Assert
|
||||
|
||||
from pages.base_test import BaseTest
|
||||
from pages.home_page import MozTrapHomePage
|
||||
|
@ -19,12 +18,12 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_passed)
|
||||
assert not result.is_test_passed
|
||||
|
||||
result.pass_test()
|
||||
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_passed)
|
||||
assert result.is_test_passed
|
||||
|
||||
@pytest.mark.moztrap(206)
|
||||
def test_that_user_can_fail_test(self, api, mozwebqa, login, product, element):
|
||||
|
@ -32,12 +31,12 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_failed)
|
||||
assert not result.is_test_failed
|
||||
|
||||
result.fail_test()
|
||||
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_failed)
|
||||
assert result.is_test_failed
|
||||
|
||||
@pytest.mark.moztrap(207)
|
||||
def test_that_user_can_mark_test_invalid(self, api, mozwebqa, login, product, element):
|
||||
|
@ -45,12 +44,12 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_invalid)
|
||||
assert not result.is_test_invalid
|
||||
|
||||
result.invalidate_test()
|
||||
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_invalid)
|
||||
assert result.is_test_invalid
|
||||
|
||||
@pytest.mark.moztrap(2744)
|
||||
def test_that_test_run_saves_right_order_of_test_cases(self, api, mozwebqa, login, product, element):
|
||||
|
@ -84,7 +83,7 @@ class TestRunTestsPage(BaseTest):
|
|||
expected_order = [(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)]
|
||||
# assert that right order saved
|
||||
Assert.equal(actual_order, expected_order)
|
||||
assert expected_order == actual_order
|
||||
# edit run to reorder suites
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
|
@ -107,28 +106,28 @@ class TestRunTestsPage(BaseTest):
|
|||
expected_order = [(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)]
|
||||
# assert that right order saved
|
||||
Assert.equal(actual_order, expected_order)
|
||||
assert expected_order == actual_order
|
||||
|
||||
def test_that_user_can_mark_test_as_blocked(self, api, mozwebqa, login, product, element):
|
||||
case = self.create_and_run_test(api, mozwebqa, product, element)[0]
|
||||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa)
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(test_result.is_blocked)
|
||||
assert not test_result.is_blocked
|
||||
|
||||
test_result.mark_blocked()
|
||||
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(test_result.is_blocked)
|
||||
assert test_result.is_blocked
|
||||
|
||||
def test_that_user_can_skip_test(self, api, mozwebqa, login, product, element):
|
||||
case = self.create_and_run_test(api, mozwebqa, product, element)[0]
|
||||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa)
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(test_result.is_skipped)
|
||||
assert not test_result.is_skipped
|
||||
|
||||
test_result.skip_test()
|
||||
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(test_result.is_skipped)
|
||||
assert test_result.is_skipped
|
||||
|
|
Загрузка…
Ссылка в новой задаче