mozillians-tests/tests/test_account.py

47 строки
1.6 KiB
Python
Исходник Обычный вид История

2012-02-20 18:58:49 +04:00
# 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/.
2011-10-04 03:22:53 +04:00
import pytest
2012-09-24 19:12:40 +04:00
from pages.home_page import Home
2013-02-07 23:46:52 +04:00
from pages.link_crawler import LinkCrawler
2011-10-04 03:22:53 +04:00
2013-02-08 02:23:33 +04:00
2011-10-04 03:22:53 +04:00
class TestAccount:
2014-03-24 18:03:09 +04:00
@pytest.mark.credentials
@pytest.mark.nondestructive
2015-11-04 15:54:24 +03:00
def test_login_logout(self, base_url, selenium, vouched_user):
home_page = Home(selenium, base_url).open()
home_page.login(vouched_user['email'])
2016-02-18 14:12:31 +03:00
assert home_page.header.is_logout_menu_item_present
2012-09-24 19:12:40 +04:00
home_page.header.click_logout_menu_item()
assert home_page.is_sign_in_button_present
2013-02-07 23:46:52 +04:00
2014-03-24 18:03:09 +04:00
@pytest.mark.credentials
@pytest.mark.nondestructive
2015-11-04 15:54:24 +03:00
def test_logout_verify_bid(self, base_url, selenium, vouched_user):
home_page = Home(selenium, base_url).open()
home_page.login(vouched_user['email'])
2016-02-18 14:12:31 +03:00
assert home_page.header.is_logout_menu_item_present
selenium.get(base_url + '/logout')
home_page.wait_for_user_login()
assert home_page.is_sign_in_button_present
2013-02-07 23:46:52 +04:00
@pytest.mark.nondestructive
2015-11-04 15:54:24 +03:00
def test_that_links_in_footer_return_200_code(self, base_url):
crawler = LinkCrawler(base_url)
2013-02-08 02:23:33 +04:00
urls = crawler.collect_links('/', name='footer')
2013-02-07 23:46:52 +04:00
bad_urls = []
2016-02-18 14:12:31 +03:00
assert len(urls) > 0
2013-02-07 23:46:52 +04:00
for url in urls:
check_result = crawler.verify_status_code_is_ok(url)
if check_result is not True:
bad_urls.append(check_result)
2016-02-18 14:12:31 +03:00
assert 0 == len(bad_urls), u'%s bad links found. ' % len(bad_urls) + ', '.join(bad_urls)