コード例 #1
0
    def test_search_ten_results_pagination(self):
        '''
            Make sure that pagination displays valid text
        '''
        utils.wait_for_element_to_be_present("Paginator text")
        # validate page 1 of 1 is displayed
        # NOTE: since I don't have documentation about the search component not sure how many results per page are supposed to be displayed
        # ideally the number must not be hardcoded as "1 of 1" as in this tests example.
        try:
            self.assertTrue(''.join([
                x for x in utils.find_element("Paginator text").
                find_element_by_tag_name('input').get_attribute('value')
                if x.isdigit()
            ]) == '1')
        except:
            raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
                ''.join([
                    x for x in utils.find_element("Paginator text").
                    find_element_by_tag_name('input').get_attribute('value')
                    if x.isdigit()
                ]), "1"))

        try:
            self.assertTrue(''.join([
                x for x in utils.find_element("Paginator text").text
                if x.isdigit()
            ]) == '1')
        except:
            raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
                ''.join([
                    x for x in utils.find_element("Paginator text").text
                    if x.isdigit()
                ]), "1"))
コード例 #2
0
 def test_search_one_result_pagination(self):
     '''
         Make sure that pagination displays valid text
     '''
     utils.wait_for_element_to_be_present("Paginator text")
     # validate page 1 of 1 is displayed
     try:
         self.assertTrue(''.join([
             x for x in utils.find_element("Paginator text").
             find_element_by_tag_name('input').get_attribute('value')
             if x.isdigit()
         ]) == '1')
     except:
         raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
             ''.join([
                 x for x in utils.find_element("Paginator text").
                 find_element_by_tag_name('input').get_attribute('value')
                 if x.isdigit()
             ]), "1"))
     try:
         self.assertTrue(''.join([
             x for x in utils.find_element("Paginator text").text
             if x.isdigit()
         ]) == '1')
     except:
         raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
             ''.join([
                 x for x in utils.find_element("Paginator text").text
                 if x.isdigit()
             ]), "1"))
コード例 #3
0
    def I_erase_the_object(step, idtype, i):
        """ Erases the given object's content:

            >>> And I erase id"userName"

        """
        utils.find_element(idtype, i).clear()
コード例 #4
0
    def i_fill_in_object_with_content(step, idtype, i, text):
        """ Finds and fills up the object with the given text:

            >>> And I fill in id"userName" with "*****@*****.**"

        """
        utils.find_element(idtype, i).send_keys(text)
コード例 #5
0
    def the_object_is_present(step, idtype, i):
        """ Verifies the object is present:

            >>> And the id"userName" object is present

        """
        utils.find_element(idtype, i)
コード例 #6
0
    def object_contains_object(step, type_id_c, id_c, type_id_f, id_f):
        """ finds the father element and then checks the element contains a
            second (child) element:

            >>> cn"forgot-password" contains lt"Forgot Password?"

        """
        element = utils.find_element(type_id_f, id_f)
        utils.find_element(type_id_c, id_c, element).click()
コード例 #7
0
    def and_i_click_the_button_with_xpath(step, idtype, i):
        """ Finds and clicks the button/object:

            >>> And I click id"clickableObject"
            or
            >>> And I click the id"goButton"

        """
        utils.find_element(idtype, i).click()
        utils.wait_seconds(0.5)
コード例 #8
0
 def test_search_one_result_counterDiv(self):
     '''
         Make sure that there just 1 result row
     '''
     self.driver.get(builtins.BASE_URL)
     utils.wait_for_page_to_load()
     utils.i_fill_in_the_object_with_text("Search Input", "DYNACULT")
     utils.i_click_the_object("Search button")
     utils.wait_for_page_to_load()
     utils.current_page_is("Search Results page")
     utils.wait_for_element_to_be_present("Counter div")
     try:
         self.assertEqual("1",
                          utils.find_element("Counter div").text.strip())
     except:
         raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
             utils.find_element("Counter div").text.strip(), "1"))
コード例 #9
0
    def object_contains_object(step, idtype, id, text):
        """ Checks the given element contains the given text:

            >>> cn"forgot-password" contains the text "Forgot Password?"

        """
        element = utils.find_element(idtype, id)
        if text not in element.text:
            raise ValueError("{} not in {}".format(text, element.text))
コード例 #10
0
 def test_search_ten_results_counterDiv(self):
     '''
         Make sure that there are more than 10 results
     '''
     utils.i_clear_the_object("Search Input")
     utils.i_fill_in_the_object_with_text("Search Input", "Cytometer")
     utils.i_click_the_object("Search button")
     utils.wait_for_page_to_load()
     utils.current_page_is("Search Results page")
     utils.wait_for_element_to_be_present("Counter div")
     try:
         # NOTE: This test is not connected to the API, so we are just validating that the results number is
         # greater than 10, Ideally the results qty must be compared against the endpoint
         self.assertGreater(
             int(utils.find_element("Counter div").text.strip()), 10)
     except:
         raise ValueError("Actual result: \"{}\" | Expected: \"{}\"".format(
             utils.find_element("Counter div").text.strip(),
             "more than 10"))
コード例 #11
0
    def object_has_class(step, idtype, id, class_name):
        """ Checks the given element has the given class:

            >>> And id"header" has class "wow fadeInDown active"

        """
        element = utils.find_element(idtype, id)
        classes = element.get_attribute("class")
        if classes != class_name:
            raise ValueError(
                'The "{0}" element does not have class "{1}"; the {0} element has class "{2}"'
                .format(id, class_name, classes))
コード例 #12
0
    def the_object_is_not_present(step, idtype, i):
        """ Verifies the object is not present:

            >>> And the id"userName" object is not present

        """
        try:
            element = utils.find_element(idtype, i)
        except NoSuchElementException:
            # The element is indeed not present
            pass
        else:
            raise ValueError("Element is present when it should not be %s" %
                             str(element))