class RegisterCoursesCSVDataTest(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def object_setup(self, module_set_up_level_to_test_a_class):
        self.reg_for_courses = RegisterForCourses(self.driver)
        self.test_status = testStatus(self.driver)
        self.nav = NavigationBar(self.driver)

    def set_up(self):

        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    # * asterisk below is to unpack list
    @data(*get_csv_data('/home/anna/PycharmProjects/letscodit/test_data.csv'))
    @unpack
    def test_enroll_with_invalid_card(self, course_name, cc_number, cc_exp,
                                      cc_cvc):

        self.reg_for_courses.enter_course_to_search(course_name)
        self.reg_for_courses.select_course_to_enroll(course_name)
        time.sleep(1)
        self.reg_for_courses.enroll_course(card_number=cc_number,
                                           exp_date=cc_exp,
                                           cvc=cc_cvc)
        time.sleep(1)
        result = self.reg_for_courses.verify_card_invalid_error()
        self.test_status.mark_final(
            'test_enroll_with_invalid_card',
            self.reg_for_courses.verify_card_invalid_error.__name__, result)

        self.nav.navigate_to_main_logo()
Ejemplo n.º 2
0
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def class_set_up(self, one_time_set_up):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = CheckStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def set_up(self):
        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        r"C:\Users\blabl\PycharmProjects\FrameworkPractice\testdata.csv"))
    @unpack
    def test_invalid_enrollment(self, course_name, cc_num, cc_exp, cc_cvv):
        self.courses.enter_course_name(course_name)
        time.sleep(3)
        self.courses.select_course_to_enroll(course_name)
        time.sleep(3)
        self.courses.enroll_course(num=cc_num, exp=cc_exp, cvv=cc_cvv)
        result = self.courses.verify_enroll_failed()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment verification FAILED")
        self.courses.web_scroll()
        self.driver.find_element_by_link_text("ALL COURSES").click()
        time.sleep(5)
class RegisterCoursesTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def class_setup(self):
        self.courses = RegisterCoursesPage(self.driver)
        self.nav = NavigationPage(self.driver)
        self.ts = Status(self.driver)

    def setUp(self):
        self.nav.click_header_logo()
        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        "C:\\Users\\Ctramm\\PycharmProjects\\ExampleAutomationFramework\\testdata.csv"
    ))
    @unpack
    def test_invalid_enrollment(self, course_name, cc_num, cc_exp, cc_cvv,
                                zip_code):
        self.courses.enter_course_name(course_name)
        self.courses.select_course_to_enroll(course_name)
        self.courses.enroll_course(cc_num, cc_exp, cc_cvv, zip_code)
        result = self.courses.verify_enroll_button_is_disabled()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment Failed Verification")
        self.courses.take_screenshot("test_invalid_enrollment")
class TestRegisterCourseCSV(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def object_setup(self, one_time_setUp):
        self.register_courses_page = RegisterCoursesPage(self.driver)
        self.test_status = ErrorStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigate_to_home()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        "C:\\Users\\Zarko\\Documents\\python_projects\\python_projects\\lets_code_it_Framework\\test_data.csv"
    ))
    @unpack
    def test_register_courses_error(self, course_name, cc_num, cc_exp, cc_cvv,
                                    postal):
        self.register_courses_page.test(course=course_name,
                                        cc_num=cc_num,
                                        exp_date=cc_exp,
                                        cvv=cc_cvv,
                                        postal=postal)
        time.sleep(1)

        result_1 = self.register_courses_page.verify_card_invalid()
        self.test_status.mark(result_1, "Verify invalid credit card Failed")

        result_2 = self.register_courses_page.verify_enrol_btn_disabled()
        self.test_status.mark_final("Verify state", result_2,
                                    "Verify enroll button disabled Failed")
        time.sleep(1)
Ejemplo n.º 5
0
class TestLogin(unittest.TestCase):
    # Zapewniają one stały punkt odniesienia, tak aby wykonać testy
    # i niezawodnie produkować spójne i powtarzalne wyniki.
    # Fixture może skonfigurować usługi, stan początkowy
    # lub inne środowiska operacyjne.

    @pytest.fixture(autouse=True)
    def classSetUp(self, oneTimeSetUp):
        self.lp = LoginPage(self.driver)
        self.lp.accept_cookies_click_login()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        "C:/Users/wrzes/Desktop/testowanie_z_hindusem/testingframework1/testdata.csv"
    ))
    @unpack
    def test_validlogin(self, email, password):

        self.lp.login(email, password)
        logging_result = self.lp.verify_successful_logging_in()
        assert logging_result == True

    @pytest.mark.run(order=2)
    def test_valid_account(self):
        logging_error1 = self.lp.verify_account_error()
        assert logging_error1 == False

    @pytest.mark.run(order=3)
    def test_valid_email(self):
        logging_error2 = self.lp.verify_email_error()
        assert logging_error2 == False

    @pytest.mark.run(order=4)
    def test_valid_password(self):
        logging_error3 = self.lp.verify_password_error()
        assert logging_error3 == False or logging_error3 is None

    @pytest.mark.run(order=5)
    def test_valid_landingpage(self):
        time.sleep(5)
        current_address = self.lp.get_web_address()
        wanted_address = "https://www.zalando.pl/myaccount/"
        assert wanted_address in current_address

    @pytest.mark.run(order=6)
    def test_valid_title(self):
        title_check = self.lp.verify_title()
        assert title_check == True
class RegisterCoursesCsvDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def class_setup(self, module_set_up_level_to_test_a_class):
        self.register_courses = RegisterCoursesPage(self.driver)
        self.test_status = TCaseStatus(self.driver)
        self.navigation = NavigationPage(self.driver)

    def setUp(self):
        #this is setup: since all tests for register courses should start on that page
        self.navigation.navigate_to_letskodeit_icon()

    @pytest.mark.run(order=1)
    @data(*get_csv_data(
        "/Users/annaromanovskaia/PycharmProjects/orangehrm-automation/test_data_courses.csv"
    ))
    @unpack
    def test_redirected_to_course_detail_page_and_invalid_enrollment(
            self, course_name, cc_number, cc_exp_date, cc_cvc, cc_postal_code):
        self.register_courses.search_for_course(course_name)
        # start from there
        self.register_courses.select_course_to_enroll(course_name)
        #self.register_courses.select_mac_linux_course()
        #result = self.register_courses.verify_redirected_to_course_details_page()
        #self.test_status.mark(result, "Redirected to course details page Verification")
        time.sleep(2)

        #def test_verify_enroll_button_final_disabled_with_invalid_card(self):
        self.register_courses.enroll_in_course_from_course_details_page()
        result2 = self.register_courses.verify_redirected_to_checkout_page()
        self.test_status.mark(result2,
                              "Redirected to Checkout Page Verification")
        self.register_courses.enter_another_card_details_postal_code(
            cc_number=cc_number,
            exp_date=cc_exp_date,
            cvc=cc_cvc,
            postal_code=cc_postal_code)
        result3 = self.register_courses.verify_buy_now_button_disabled()
        print("Result3: {}".format(result3))
        time.sleep(1)

        self.test_status.mark_final(
            "Test Case Name: test_verify_enroll_button_final_disabled_with_invalid_card",
            result3, "Enroll Button Final Disabled Verification")
        time.sleep(2)
class RegisterCoursesCSVDataTest(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def object_setup(self, one_time_set_up):
        self.cp = RegisterCoursesPage(self.driver)
        self.ts = TestStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigate_to_all_courses()

    @pytest.mark.run(order=1)
    @data(*get_csv_data("test_data.csv"))
    @unpack
    def test_invalid_enrollment(self, course_name, cc_num, cc_exp, cc_cvv):
        self.cp.enter_course_name(course_name)
        self.cp.select_course_to_enroll(course_name)
        self.cp.enroll_course(cc_num, cc_exp, cc_cvv)
        result = self.cp.verify_enroll_failed()
        self.ts.mark_final("test_invalid_enrollment", result,
                           "Enrollment fail verification")
class TestRegisterCoursesCSVData(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.cp = CheckPoint(self.driver)
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.go_to_main()

    @pytest.mark.run(order=1)
    @data(*get_csv_data("testdata.csv"))
    @unpack
    def test_invalidEnrollment(self, course_name, cc_num, cc_exp, cc_cvv,
                               country, zip):
        self.courses.search_course(course_name)
        self.courses.select_course_to_enroll(course_name)
        self.courses.enroll_course(cc_num, cc_exp, cc_cvv, country, zip)
        result = self.courses.verify_enroll_failed()
        self.cp.mark_final("test_invalidEnrollment", result,
                           "Enrollment failed verification")
Ejemplo n.º 9
0
class TestAllCourses(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectsetup(self):
        self.rc = RegisterCourses(self.driver)
        self.ts = TstStatus(self.driver)

    @pytest.mark.run(order=2)
    @data(*get_csv_data(
        "C:\\Users\\Desktop\\PycharmProjects\\letskodeit\\testdata.csv"))
    @unpack
    def test_every_course(self, fullcoursename):
        self.rc.all_courses_check(fullcoursename)
        self.rc.allcourseslink()
        #result = self.rc.isenabled(locatortype="id", value="confirm-purchase")
        #self.ts.markfinal(testname="test_confirm_button", result=result, resultmessage="Element is not clickable")

    @pytest.mark.run(order=1)
    def test_sign_up(self):
        self.rc.login_register()
        self.rc.clcallcourses()
        time.sleep(2)
class RegisterCoursesCSVDataTests(unittest.TestCase):
    test_data = os.path.join("..", "register_course_data.csv")

    @pytest.fixture(autouse=True)
    def object_setup(self, one_time_setup):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = ResultStatus(self.driver)
        self.nav = NavigationPage(self.driver)

    # Method name must be specified in camel case in order to work
    def setUp(self):
        self.nav.navigate_to_website_logo()
        time.sleep(3)
        self.nav.navigate_to_all_courses()
        time.sleep(2)

    # Enrolment failure - credit card number incorrect
    @pytest.mark.run(order=1)
    @data(*get_csv_data(test_data))
    @unpack
    def test_enrol_failed(self, course_name, cc_num, cc_exp, cc_cvc,
                          cc_country, country_type):
        """
        Test failure for incorrect card number when enter payment details for 
        enrolling on a course and the credit card fails validation.  Is only
        applicable to paid-for courses.
        """
        self.courses.enter_course_name(course_name)
        self.courses.select_course_to_enroll(course_name)
        self.courses.enroll_course(num=cc_num,
                                   exp=cc_exp,
                                   cvc=cc_cvc,
                                   country=cc_country,
                                   data_type=country_type)
        result1, result2 = self.courses.verify_card_check_failed(
            "The card number is incorrect.")
        self.ts.mark(result1, "Card validation failure message is present")
        self.ts.mark_final("test_enroll_failed", result2,
                           "Card validation failure message displayed")
Ejemplo n.º 11
0
class LoginTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.login_page = LoginPage(self.driver)
        self.ts = TestStatus(self.driver)

    @pytest.mark.run(order=2)
    @data(*get_csv_data('C:\\Users\\admin\\Desktop\\lam\\autotest\\letskodeit\\testdata.csv'))
    @unpack
    def test_valid_login(self, email, password):
        self.login_page.login(email, password)

        result1 = self.login_page.verify_login_title()
        self.ts.mark(result1, 'Title is incorrect')

        result2 = self.login_page.verify_login_successful()
        self.ts.mark_final('test_validLogin', result2, 'Login was not successful')

    @pytest.mark.run(order=1)
    def test_invalid_login(self):
        self.login_page.login()
        result = self.login_page.verify_login_fail()
        assert result == True