Skip to content

Commit

Permalink
Merge remote-tracking branch 'bebef1987/test_hover' into webdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinT committed Apr 24, 2012
2 parents db144af + 06bccc2 commit 8b5f3a7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pages/desktop/technology_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from pages.desktop.base import Base
from pages.page import Page
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from selenium.common.exceptions import NoSuchElementException


class TechnologyPage(Base):
Expand Down Expand Up @@ -37,6 +40,8 @@ def go_to_page(self):
_video_preload_section = (By.CSS_SELECTOR, '#html5 > article:nth-of-type(5) > h1')
_history_state_section = (By.CSS_SELECTOR, '#html5 > article:nth-of-type(6) > h1')

_bulb_article_locator = (By.CSS_SELECTOR, '#wall article > article')

@property
def is_developer_tools_link_visible(self):
return self.is_element_visible(*self._developer_tools_link)
Expand All @@ -60,3 +65,30 @@ def is_svg_link_visible(self):
@property
def is_security_link_visible(self):
return self.is_element_visible(*self._security_link)

@property
def bulbs(self):
return [self.Bulb(self.testsetup, bulb) for bulb in self.selenium.find_elements(*self._bulb_article_locator)]

class Bulb(Page):

_learn_more_locator = (By.CSS_SELECTOR, 'a.learn')

def __init__(self, testsetup, element):
Page.__init__(self, testsetup)
self._root = element

def hover(self):
ActionChains(self._root).move_to_element(self._root).perform()

@property
def is_learn_more_present(self):
try:
self._root.find_element(*self._learn_more_locator)
return True
except NoSuchElementException:
return False

@property
def is_learn_more_displayed(self):
return self._root.find_element(*self._learn_more_locator).is_displayed()
12 changes: 12 additions & 0 deletions tests/test_technology.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ def test_billboard_links_are_visible(self, mozwebqa):
Assert.true(technology_page.is_apis_link_visible)
Assert.true(technology_page.is_svg_link_visible)
Assert.true(technology_page.is_security_link_visible)

@pytest.mark.nondestructive
@pytest.mark.xfail(reason="Selenium issue 3492")
def test_that_learn_more_is_shown_on_mouse_over(self, mozwebqa):
technology_page = TechnologyPage(mozwebqa)
technology_page.go_to_page()

for bulb in technology_page.bulbs:
if bulb.is_learn_more_present:
Assert.false(bulb.is_learn_more_displayed)
bulb.hover()
Assert.true(bulb.is_learn_more_displayed)

0 comments on commit 8b5f3a7

Please sign in to comment.