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
|
|
|
|
2012-03-27 05:44:21 +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
|
2012-03-27 05:44:21 +04:00
|
|
|
@pytest.mark.nondestructive
|
2015-11-04 15:54:24 +03:00
|
|
|
def test_login_logout(self, base_url, selenium, vouched_user):
|
2017-11-16 02:49:52 +03:00
|
|
|
home_page = Home(selenium, base_url).open()
|
2016-12-22 15:04:15 +03:00
|
|
|
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()
|
2016-12-22 15:04:15 +03:00
|
|
|
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
|
2013-09-13 16:05:46 +04:00
|
|
|
@pytest.mark.nondestructive
|
2015-11-04 15:54:24 +03:00
|
|
|
def test_logout_verify_bid(self, base_url, selenium, vouched_user):
|
2017-11-16 02:49:52 +03:00
|
|
|
home_page = Home(selenium, base_url).open()
|
2016-12-22 15:04:15 +03:00
|
|
|
home_page.login(vouched_user['email'])
|
2016-02-18 14:12:31 +03:00
|
|
|
assert home_page.header.is_logout_menu_item_present
|
2017-11-16 02:49:52 +03:00
|
|
|
selenium.get(base_url + '/logout')
|
2013-09-13 16:05:46 +04:00
|
|
|
|
|
|
|
home_page.wait_for_user_login()
|
2016-12-22 15:04:15 +03:00
|
|
|
assert home_page.is_sign_in_button_present
|
2013-09-13 16:05:46 +04:00
|
|
|
|
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)
|