示例#1
0
 def test_list_creation(self):
     name = ''.join(random.choice(
         string.ascii_lowercase + string.digits) for x in range(15))
     h = HomePage(self.driver)
     h.open_default_url()
     assert(h.create_list(name))
     self.driver.find_element_by_link_text('Find gifts now').click()
     assert(self.driver.current_url.endswith('/shops'))
示例#2
0
 def login(self, credentials):
     self.current_page.log_in(credentials)
     homepage = HomePage()
     try:
         assert homepage.is_logged_in()
         log.info('Logged in as %s' % credentials)
     except AssertionError as e:
         log.error('Error while logging as %s' % credentials)
         raise e
     self.current_page = homepage
示例#3
0
    def delete_movie(self):
        """
        Executed on MoviePage
        :return: HomePage
        """

        self.current_page.delete()
        self.current_page = HomePage()
示例#4
0
 def add_movie(self, movie):
     self.current_page.add()
     add_page = AddMoviePage()
     log.info('Adding movie %s' % movie['title'])
     add_page.add_movie(movie)
     movie_page = MoviePage()
     movie_page.check_title(movie['title'])
     movie_page.navigate_home()
     self.current_page = HomePage()
示例#5
0
 def logout(self):
     self.current_page.log_out()
     self.current_page = LoginPage()
     try:
         assert self.current_page.is_logged_out()
         log.info('Logged out')
     except (AssertionError, NoSuchElementException) as e:
         log.error('Error while logging out!')
         raise e
def test_create(base_url, selenium):
    page = HomePage(base_url, selenium).open()
    page.user_sign_in('xxxxx', 'xxxxx')
    page.create_survey_via_top_link()
    assert 'SurveyMonkey : New Survey' == selenium.title
    page.sign_out()
    assert "SurveyMonkey: Free online survey software & questionnaire tool." \
        == selenium.title
示例#7
0
 def navigate_to_movie(self, title):
     self.current_page.navigate_to_movie(title)
     self.current_page = MoviePage()
示例#8
0
 def __init__(self):
     self.current_page = LoginPage()
示例#9
0
class Application(object):

    def __init__(self):
        self.current_page = LoginPage()

    def login(self, credentials):
        self.current_page.log_in(credentials)
        homepage = HomePage()
        try:
            assert homepage.is_logged_in()
            log.info('Logged in as %s' % credentials)
        except AssertionError as e:
            log.error('Error while logging as %s' % credentials)
            raise e
        self.current_page = homepage

    def logout(self):
        self.current_page.log_out()
        self.current_page = LoginPage()
        try:
            assert self.current_page.is_logged_out()
            log.info('Logged out')
        except (AssertionError, NoSuchElementException) as e:
            log.error('Error while logging out!')
            raise e

    def check_movie_in_list(self, title):
        try:
            assert self.current_page.check_movie_in_list(title)
            log.info('Movie %s is in movies list' % title)
        except AssertionError as e:
            log.error('Movie %s is NOT in movies list' % title)
            raise e

    def add_movie(self, movie):
        self.current_page.add()
        add_page = AddMoviePage()
        log.info('Adding movie %s' % movie['title'])
        add_page.add_movie(movie)
        movie_page = MoviePage()
        movie_page.check_title(movie['title'])
        movie_page.navigate_home()
        self.current_page = HomePage()

    def navigate_to_movie(self, title):
        self.current_page.navigate_to_movie(title)
        self.current_page = MoviePage()

    def delete_movie(self):
        """
        Executed on MoviePage
        :return: HomePage
        """

        self.current_page.delete()
        self.current_page = HomePage()

    def check_movie_is_not_on_page(self, title):
        """
        Executed on HomePage
        :param title: Movie title (string)
        :return: void
        """

        try:
            assert not self.current_page.check_movie_in_list(title)
            log.info('Movie %s is NOT movies list' % title)
        except AssertionError as e:
            log.error('Movie %s is in movies list' % title)
            raise e

    def refresh(self):
        """
        Refreshes current page
        :return: void
        """
        self.current_page.refresh()
示例#10
0
 def test_slide_nav(self):
     h = HomePage(self.driver)
     h.open_default_url()
     assert(h.is_slide_visible('slide 1'))
     h.go_to_next_slide()
     assert(h.is_slide_visible('slide 2'))
     h.go_to_next_slide()
     assert(h.is_slide_visible('slide 3'))
     h.go_to_prev_slide()
     assert(h.is_slide_visible('slide 2'))
     h.go_to_prev_slide()
     assert(h.is_slide_visible('slide 1'))
示例#11
0
 def test_images_present(self):
     h = HomePage(self.driver)
     h.open_default_url()
     assert(h.is_element_available(h.locators['specials btn']))
     assert(h.is_element_available(h.locators['list textbox']))
     assert(h.is_element_available(h.locators['list btn']))