Skip to content

Commit

Permalink
Check click author link lands on right page
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinT committed Mar 28, 2012
1 parent a18c638 commit 2a6fa38
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pages/desktop/home.py
Expand Up @@ -3,7 +3,6 @@
# 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 selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

Expand All @@ -14,8 +13,10 @@
class Home(Base):

_page_title = "Add-ons for Firefox"
_first_addon_locator = (By.CSS_SELECTOR, "div.summary > a > h3")
_first_addon_locator = (By.CSS_SELECTOR, ".summary > a > h3")
_other_applications_link_locator = (By.ID, "other-apps")
_addons_locator = (By.CSS_SELECTOR, '.addon.hovercard')
_authors_link_locator = (By.CSS_SELECTOR, '.byline > a')

#Most Popular List
_most_popular_item_locator = (By.CSS_SELECTOR, "ol.toplist li")
Expand Down Expand Up @@ -46,6 +47,24 @@ def __init__(self, testsetup, open_url=True):
if open_url:
self.selenium.get(self.base_url)

def hover_over_first_addon_and_click_author_link(self):
addon_item = self.selenium.find_element(*self._addons_locator)
author_item = self.selenium.find_element(*self._authors_link_locator)
ActionChains(self.selenium).\
move_to_element(addon_item).\
move_to_element(author_item).click().\
perform()
from pages.desktop.user import User
return User(self.testsetup)

def first_addon_author(self):
addons = self.selenium.find_element(*self._addons_locator)
item = self.selenium.find_element(*self._authors_link_locator)
ActionChains(self.selenium).\
move_to_element(addons).\
perform()
return item.text

def hover_over_addons_home_title(self):
home_item = self.selenium.find_element(*self._amo_logo_link_locator)
ActionChains(self.selenium).\
Expand Down
14 changes: 14 additions & 0 deletions tests/desktop/test_homepage.py
Expand Up @@ -236,3 +236,17 @@ def test_top_three_items_in_each_site_navigation_menu_are_featured(self, mozwebq
# first 3 are featured, the others are not
[Assert.true(item.is_featured) for item in actual_menu.items[:3]]
[Assert.false(item.is_featured) for item in actual_menu.items[3:]]

@pytest.mark.nondestructive
def test_addons_author_link(self, mozwebqa):
"""
https://litmus.mozilla.org/show_test.cgi?searchType=by_id&id=25815
"""

home_page = Home(mozwebqa)

first_author = home_page.first_addon_author()
user_page = home_page.hover_over_first_addon_and_click_author_link()

Assert.equal(user_page.username, first_author)
Assert.contains('user', user_page.get_url_current_page())

0 comments on commit 2a6fa38

Please sign in to comment.