2016-06-27 11:30:28 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from pages.desktop.home import Home
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.nondestructive
|
2017-02-07 22:21:09 +03:00
|
|
|
def test_there_are_ten_most_popular_extensions(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2016-06-27 11:30:28 +03:00
|
|
|
"""Ten most popular add-ons are listed"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2016-06-27 11:30:28 +03:00
|
|
|
assert len(page.most_popular.extensions) == 10
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.nondestructive
|
2017-02-07 22:21:09 +03:00
|
|
|
def test_most_popular_extensions_are_sorted_by_users(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2016-06-27 11:30:28 +03:00
|
|
|
"""Most popular add-ons are sorted by popularity"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2017-04-27 21:41:23 +03:00
|
|
|
extensions_page = page.most_popular.extensions
|
|
|
|
sorted_by_users = sorted(extensions_page,
|
|
|
|
key=lambda e: e.users, reverse=True)
|
|
|
|
assert sorted_by_users == extensions_page
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.smoke
|
|
|
|
@pytest.mark.nondestructive
|
|
|
|
def test_that_clicking_on_addon_name_loads_details_page(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2017-04-27 21:41:23 +03:00
|
|
|
"""Details page addon name matches clicked addon"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
|
|
|
name = page.most_popular.extensions[0].name
|
|
|
|
extension_page = page.most_popular.extensions[0].click()
|
2017-04-27 21:41:23 +03:00
|
|
|
assert name in extension_page.description_header.name
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.smoke
|
|
|
|
@pytest.mark.nondestructive
|
|
|
|
def test_that_featured_themes_exist_on_the_home(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2017-04-27 21:41:23 +03:00
|
|
|
"""Featured themes are displayed"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2017-04-27 21:41:23 +03:00
|
|
|
assert len(page.featured_themes.themes) == 6
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.nondestructive
|
|
|
|
def test_that_clicking_see_all_themes_link_works(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2017-04-27 21:41:23 +03:00
|
|
|
"""Amount of featured themes matches on both pages"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2017-04-27 21:41:23 +03:00
|
|
|
themes = page.featured_themes.themes
|
|
|
|
theme_page = page.featured_themes.see_all()
|
|
|
|
assert len(themes) == len(theme_page.featured.themes)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.nondestructive
|
|
|
|
def test_that_featured_extensions_exist_on_the_home(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2017-04-27 21:41:23 +03:00
|
|
|
"""Featured extensions exist on home page"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2017-04-27 21:41:23 +03:00
|
|
|
assert len(page.featured_extensions.extensions) >= 1
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.nondestructive
|
|
|
|
def test_that_clicking_see_all_collections_link_works(
|
2017-10-05 14:14:08 +03:00
|
|
|
base_url, selenium):
|
2017-04-27 21:41:23 +03:00
|
|
|
"""Amount of featured themes matches on both pages"""
|
2017-10-05 14:14:08 +03:00
|
|
|
page = Home(selenium, base_url).open()
|
2017-04-27 21:41:23 +03:00
|
|
|
collections = page.featured_collections.collections
|
|
|
|
collections_page = page.featured_collections.see_all()
|
|
|
|
assert len(collections) == len(collections_page.collections)
|