コード例 #1
0
def test_selecting_a_partner_logo_scrolls_to_the_partner_summary(
        web_base_url, selenium):
    """Clicking a partner logo scrolls the page to the partner summary."""
    # GIVEN: a user viewing the partners page
    home = WebHome(selenium, web_base_url).open()
    partners = home.web_nav.technology.view_partners()
    logo = partners.companies[Utility.random(end=len(partners.companies) - 1)]
    summary = partners.summary_by_name(logo.name)

    # WHEN: they click on a partner logo
    logo.view()

    # THEN: the page scrolls until the partner summary is displayed
    # AND:  the summary contains a partner description
    # AND:  supported subjects or books
    # AND:  a "Return to top" link
    assert (Utility.in_viewport(selenium,
                                element=summary.header,
                                ignore_bottom=True))
    assert (summary.description)
    if summary.name != TechProviders.OPEN_TEXTBOOK_NETWORK:
        # the partner supports one or more OpenStax titles/subjects
        assert (summary.availability)
    assert (summary.return_to_top_link)

    # WHEN: they click on the "Return to top" link
    summary.return_to_top()

    # THEN: the partner filter list is displayed
    assert (Utility.in_viewport(selenium, element=logo.logo))
コード例 #2
0
ファイル: press.py プロジェクト: openstax/os-automation
 def is_displayed(self):
     """Return True if the portrait is loaded and in the frame."""
     Utility.scroll_to(self.driver, element=self.portrait, shift=-20)
     card = self.find_element(*self._card_locator)
     return (Utility.is_image_visible(self.driver, image=self.portrait)
             and Utility.in_viewport(
                 self.driver, element=card, display_marks=True))
コード例 #3
0
def test_learn_more_scrolls_to_how_it_works(web_base_url, selenium):
    """The Learn More button scrolls down to the 'How it works' section."""
    # GIVEN: a user viewing the Tutor marketing page
    home = WebHome(selenium, web_base_url).open()
    tutor_marketing = home.web_nav.technology.view_tutor()

    # WHEN: they click on the "Learn More" button
    tutor_marketing.introduction.learn_more()

    # THEN: the screen scrolls down to the "How it works" section
    assert(Utility.in_viewport(
        selenium, element=tutor_marketing.how_it_works.subheading,
        display_marks=True)), \
        'Subheading not in the browser window'
コード例 #4
0
def test_the_sidebar_links_to_each_page_section(web_base_url, selenium):
    """Test the side nav bar links to each id'ed section."""
    # GIVEN: a user viewing the Tutor marketing page
    home = WebHome(selenium, web_base_url).open()
    tutor_marketing = home.web_nav.technology.view_tutor()

    # WHEN: they scroll down
    tutor_marketing.introduction.learn_more()

    for index, dot in enumerate(tutor_marketing.sidebar.nav):
        # AND: click on the nav dot
        tutor_marketing.sidebar.select(dot)

        # THEN: the page scrolls to the corresponding section
        # AND:  the dot is selected
        assert(Utility.in_viewport(
            driver=selenium,
            element=tutor_marketing.sections[index].section,
            display_marks=True)), \
            '"{0}" not in the browser window'.format(
                tutor_marketing.sections[index].heading)
コード例 #5
0
 def is_visible(self):
     """Return True if the person's card is in the viewport."""
     return Utility.in_viewport(self.driver,
                                element=self.root,
                                ignore_bottom=True,
                                display_marks=True)