Пример #1
0
    def assert_text_not_exists(self, text: str, describe, sleep=0, timeout=10):
        """
        Asserts that the text exists on the current page

        Args:
            sleep(int): sleep time
            text(str): text
            describe(str): Assertion description information
            timeout(int): Maximum waiting time
        """
        time.sleep(sleep)
        logging.info("预期结果: " + describe + " 文案不存在")
        for i in range(timeout):
            text_exists = self.driver(text=text).exists
            if text_exists is True:
                insert_assert(describe, False)
                logging.warn("实际结果: " + describe + " 文案存在")
                break
            else:
                time.sleep(1)
                continue
        else:
            insert_assert(describe, True)
            logging.info("实际结果: " + describe + " 文案不存在")
        self.screenshots(describe="断言")
Пример #2
0
    def assert_element_not_exists(self,
                                  element,
                                  describe,
                                  sleep=0,
                                  timeout=10):
        """
        Asserts that the text exists on the current page

        Args:
            sleep(int): sleep time
            element: element
            describe(str): Assertion description information
            timeout(int): Maximum waiting time
        """
        time.sleep(sleep)
        logging.info("预期结果: " + describe + " 元素不存在")
        for i in range(timeout):
            element_exists = element.exists()
            if element_exists is True:
                insert_assert(describe, False)
                logging.warn("实际结果: " + describe + " 元素存在")
                break
            else:
                time.sleep(1)
                continue
        else:
            insert_assert(describe, True)
            logging.info("实际结果: " + describe + " 元素不存在")
        self.screenshots(describe="断言")
Пример #3
0
    def assert_element_not_exists(self, element, describe, sleep=0, timeout=10):
        """
        Asserts that the element not exists on the current page

        Args:
            sleep(int): sleep time
            element(object): element object
            describe(str): Assertion description information
        """
        time.sleep(sleep)

        element_exists = element.exists(timeout)
        self.screenshots(describe="断言")
        logging.info("预期结果: " + describe + " 元素不存在")
        if element_exists is True:
            insert_assert(describe, False)
            logging.warning("实际结果: " + describe + " 元素存在")
        else:
            insert_assert(describe, True)
            logging.info("实际结果: " + describe + " 元素不存在")