Exemple #1
0
def test_a():
    with allure.step(" Screenshot added !!"):

        base = abc()
        base.OpenBrowser("Chrome")
        base.Navigate("URL")
        expect(False, "kaka pagal hai")
        expect(False, "puri pagal hai")
        expect(False, "abhishek pagal hai")
        expect(False, "bedi pagal hai")
        expect(False, "riya pagal hai")
        expect(False, "chicken pagal hai")
        assert_expectations()

        if (not base.isElementPresent("email_xpath")):
            base.ReportFail("Element is not present")

        if (not base.verifyText("signin_xpath", "signinText")):
            base.ReportFail("Not verified")

        base.Type("email_xpath", "email_id")
        time.sleep(5)
        base.Click("click_xpath")
        time.sleep(5)
        base.verifyText("signin_xpath", "signinText")
        base.ReportFail("T4itle doesn't match")
 def testSomething(self):
     delayed_assert.expect(1 == 1) # will succeed
     delayed_assert.expect(1 == 2) # will fail but won't stop execution
     delayed_assert.expect(3 == 2, "Value don't match") # will fail but won't stop execution
     delayed_assert.expect(3 == 3) # will succeed
     # will stop execution and show the stack trace of 2nd assertion
     delayed_assert.assert_expectations()
Exemple #3
0
 def validate_given_vacancies(self, expected_vacations):
     """
     Validates if there are given vacations
     :param expected_vacations: expected vacations
     :return: True/False
     """
     for vacation in expected_vacations:
         logging.info(
             f"Verify is vacancy '{vacation.upper()}' present into search results"
         )
         result = self.vacancies.check_is_vacancy_present(vacation)
         delayed_assert.expect(
             len(result) > 0, f"Vacancy {vacation} is not found")
     delayed_assert.assert_expectations()
Exemple #4
0
    def verify_dirty_files(self, results):
        """Verifies dirty file. The following checks are carried out:
        1) Validate there are at least 3 records for the file(ADDED+DIRTY+REMOVED)
        2) Validate that the first action for file is ADDED
        3) Validate that the second action for file is DIRTY
        4) Validate that the file is removed
        5) Validate that the file does not have error action
        """
        file_name = results[0][2]
        logging.info(f"List of validation for 'Dirty' files:")

        message_1 = f"Validate there are at least 3 records for the file"
        with allure.step(message_1):
            logging.info(message_1)
            delayed_assert.expect(len(results) >= 3, f"There not less 3 records for the file {file_name}")

        message_2 = f"Validate the first action for file is ADDED"
        with allure.step(message_2):
            logging.info(message_2)
            delayed_assert.expect(results[0][1] == 'ADDED', f"First action is not ADDED for file {file_name}")

        message_3 = f"Validate the second action for file is DIRTY"
        with allure.step(message_3):
            logging.info(message_3)
            delayed_assert.expect(results[1][1] == 'DIRTY', f"Second action is not DIRTY for file {file_name}")

        message_4 = f"Validate the file is removed"
        with allure.step(message_4):
            logging.info(message_4)
            find_removed_action = self._find_record_with_action(results, 'REMOVED')
            delayed_assert.expect(find_removed_action is True, f"Dirty file {file_name} should be removed")

        message_5 = f"Validate the file does not have error action\n"
        with allure.step(message_5):
            logging.info(message_5)
            find_error_action = self._find_record_with_action(results, 'ERROR')
            delayed_assert.expect(find_error_action is False, f"Dirty file {file_name} should not have ERROR action")

        delayed_assert.assert_expectations()
Exemple #5
0
    def verify_clean_files(self, results):
        """Verifies clean file. The following checks are carried out:
        1) Validate there are at least 2 records for the file (ADDED+CLEAN)
        2) Validate that the first action for file is ADDED
        3) Validate that the second action for file is CLEAN
        4) Validate that the file is not removed
        5) Validate that the file does not have error action
        """
        file_name = results[0][2]
        logging.info(f"List of validation for 'Clean' files:")

        message_1 = f"Validate there are at least 2 records for the file"
        with allure.step(message_1):
            logging.info(message_1)
            delayed_assert.expect(len(results) >= 2, f"There is not less than 2 records for Clean the file {file_name}")

        message_2 = f"Validate the first action for file is ADDED"
        with allure.step(message_2):
            logging.info(message_2)
            delayed_assert.expect(results[0][1] == 'ADDED', f"First action is not ADDED for the file {file_name}")

        message_3 = f"Validate the second action for file is CLEAN"
        with allure.step(message_3):
            logging.info(message_3)
            delayed_assert.expect(results[1][1] == 'CLEAN', f"Second action is not CLEAN for the file {file_name}")

        message_4 = f"Validate the file is not removed"
        with allure.step(message_4):
            logging.info(message_4)
            find_removed_action = self._find_record_with_action(results, 'REMOVED')
            delayed_assert.expect(find_removed_action is False, f"Clean file {file_name} should not be removed")

        message_5 = f"Validate the file does not have error action\n"
        with allure.step(message_5):
            logging.info(message_5)
            find_error_action = self._find_record_with_action(results, 'ERROR')
            delayed_assert.expect(find_error_action is False, f"Clean file {file_name} should not have ERROR action")

        delayed_assert.assert_expectations()
def should_continue(table):
    for num in table:
        failassert(num)
        Messages.write_message(f"continuing inside the step{num}")
    assert_expectations()
Exemple #7
0
def quit_test():
    try:
        assert_expectations()

    except Exception as capturedError:
        logger.error(capturedError)
Exemple #8
0
 def test(self):
     try:
         delayed_assert.expect(1 == 2)  # will fail but won't stop execution
         delayed_assert.assert_expectations()
     except AssertionError as e:
         pass