예제 #1
0
 def test_create_user_with_existing_data(self):
     home_page = HomePage(self.driver)
     account_page = MyAccountPage(self.driver)
     home_page.go_to_my_account_page()
     account_page.register_user(config.USER_EMAIL, config.USER_PASSWORD)
     error_msg = account_page.validation_msg()
     assert_that(error_msg).is_equal_to(data.ERROR_ALREADY_REGISTERED_ACC)
 def search_black_products(self):
     my_account_page = MyAccountPage(self.driver)
     my_account_page.search("Black")
     search_page = SearchPage(self.driver)
     product_components = search_page.get_product_components_with_color(
         "black")
     product_components[1].click_product_link()
예제 #3
0
 def test_create_user_with_invalid_email(self):
     home_page = HomePage(self.driver)
     account_page = MyAccountPage(self.driver)
     home_page.go_to_my_account_page()
     account_page.register_user("[email protected]", config.USER_PASSWORD)
     error_msg = account_page.validation_msg()
     assert_that(error_msg).is_equal_to(data.ERROR_INVALID_EMAIL_REG)
예제 #4
0
    def test_user_registration(self):

        with allure.step(
                "Регистрация нового пользователя на сайте 'http://automationpractice.com'"
        ):

            mainPage = MainPage(self.driver)
            loginPage = LoginPage(self.driver)
            myAccountPage = MyAccountPage(self.driver)
            registrationPage = RegistrationPage(self.driver)

            with allure.step("Открытие главной страницы сайта"):
                mainPage.assert_the_header()
            with allure.step(
                    "Переход на страницу выбора логина или регистрации"):
                mainPage.go_to_login_page()
                loginPage.assert_the_login_page_header()
            with allure.step(
                    "Переход на страницу выбора регистрации/авторизации пользователя"
            ):
                loginPage.new_user_registration()
            with allure.step(
                    "Проверка, что переход на страницу регистрации прошел успешно"
            ):
                registrationPage.assert_the_registration_page_header()
            with allure.step(
                    "Заполнение формы регистрации и нажатие на кнопку 'Register'"
            ):
                registrationPage.fill_all_fields_in_reg_form()
            with allure.step(
                    "Проверка, что регистрация пользователя прошла успешно"):
                myAccountPage.assert_my_account_page_header()
예제 #5
0
 def test_param_create_user_validation(self, email, password, error):
     home_page = HomePage(self.driver)
     account_page = MyAccountPage(self.driver)
     home_page.go_to_my_account_page()
     account_page.register_user(email, password)
     error_msg = account_page.validation_msg()
     assert_that(error_msg).is_equal_to(error)
예제 #6
0
 def test_login_with_invalid_email(self):
     home_page = HomePage(self.driver)
     account_page = MyAccountPage(self.driver)
     home_page.go_to_my_account_page()
     account_page.log_in_user(config.USER_WRONG_EMAIL, config.USER_PASSWORD)
     email_validation_msg = account_page.validation_msg()
     assert_that(email_validation_msg).is_equal_to(
         data.ERROR_INVALID_EMAIL_LOG)
예제 #7
0
class LoginTests(object):
    login, my_account, driver = None, None, None

    def setup_suite(self):
        lcc.log_info("Inside setup")
        self.driver = webdriver.Chrome(executable_path=Global.CHROME_DRIVER)
        self.login = LoginPage(driver=self.driver)
        self.my_account = MyAccountPage(driver=self.driver)

    @lcc.test("check login failure")
    def verify_login_failure(self):
        self.login.login(email="*****@*****.**", password="******")
        check_that("Failure message is displayed",
                   self.login.is_failure_message_displayed(), is_true())

    @lcc.test("check login success")
    def verify_login_success(self):
        self.login.login(email="*****@*****.**", password="******")
        check_that("My Account text is displayed",
                   self.my_account.is_my_account_text_displayed(), is_true())

    def teardown_test(self, test_name):
        lcc.log_info("Finished running test " + test_name)
        capture_screenshot(self.driver)

    def teardown_suite(self):
        lcc.log_info("Inside teardown")
        self.driver.quit()
예제 #8
0
    def test_log_in_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.log_in("*****@*****.**", "Klamra12#311")

        assert "ERROR: Incorrect username or password." in my_account_page.get_error_msg(
        )
예제 #9
0
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account("*****@*****.**", "tester123456789$")

        msg = 'An account is already registered with your email address. Please log in.'
        assert msg in my_account_page.get_error_msg()
예제 #10
0
    def test_create_account_passed(self):
        email = str(random.randint(0, 10000)) + "*****@*****.**"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, "Klamra12#3")

        assert my_account_page.is_logout_link_displayed()
예제 #11
0
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account("*****@*****.**", "Klamra12#3")

        msg = 'An account is already registered with your email address. Please log in.'
        assert msg in my_account_page.get_error_msg()
예제 #12
0
    def test_creating_account_passed(self):
        email = str(random.randint(0, 1000)) + "*****@*****.**"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page_my_account()
        my_account_page.create_account(email, "MaciekMacie")

        assert my_account_page.is_logout_link_displayed()
예제 #13
0
    def test_creating_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page_my_account()
        my_account_page.create_account("*****@*****.**", "MaciekMacie")

        msg = "Error: An account is already registered with your email address. Please log in."
        assert msg in my_account_page.get_error_meassage()
예제 #14
0
    def test_create_account_passed(self):
        email = str(random.randint(0, 10000)) + '*****@*****.**'
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, 'To jest nowe haslo')

        assert my_account_page.is_logout_link_displayed()
예제 #15
0
    def test_create_account_passed(self):
        email = "test{}@mail.com".format(random.randint(0, 10000))
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, "haslotest12")

        assert "Hello {}".format(
            email.split("@")[0]) in my_account_page.get_login_msg_text()
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account("*****@*****.**",
                                       "testeroprogramowaniapython")

        msg = "An account is already registered with your email address. Please log in."
        assert msg in my_account_page.get_error_msg()
예제 #17
0
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account('*****@*****.**',
                                       'To jest nowe haslo')

        msg = 'Error: An account is already registered with your email address. Please log in.'
        assert msg in my_account_page.get_error_msg()
예제 #18
0
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_my_account_page()
        my_account_page.create_account('*****@*****.**',
                                       "Fibaro12345678")

        assert my_account_page.reg_msg_err in my_account_page.get_error_msg(
        ), "Email address is already registered in service!"
    def test_create_account_passed(self):
        email = str(random.randint(
            0, 1000)) + "*****@*****.**"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, "testeroprogramowaniapython")

        assert my_account_page.is_logout_link_displayed()
예제 #20
0
    def test_create_account_passed(self):
        email = f"dom.gorski{random.randint(10, 10000)}@gmail.com"
        password = "******"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_my_account_page()
        my_account_page.create_account(email, password)

        assert my_account_page.is_logout_link_displayed()
예제 #21
0
    def test_create_account_passed(self):

        email = str(random.randint(0,10000)) + "*****@*****.**"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, "tester123456789$")

        assert my_account_page.is_logout_link_displayed()
예제 #22
0
    def test_log_in_fail(self):
        username = "******"
        password = "******"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_my_account_page()
        my_account_page.log_in(username, password)

        assert my_account_page.login_msg_err in my_account_page.get_error_msg(
        ), "Nie udana próba nieudanego logowania!"
예제 #23
0
    def test_log_in_passed(self, ):
        username = "******"
        password = "******"
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_my_account_page()
        my_account_page.log_in(username, password)

        assert my_account_page.is_logout_link_displayed(
        ), "Nie udana próba logowania!"
예제 #24
0
    def test_log_in_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.log_in("*****@*****.**", "invalidpassword")
        generic = Generic(self.driver)

        assert "ERROR: Incorrect username or password." in generic.get_error_msg_text()
예제 #25
0
    def test_reset_password_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.reset_password("*****@*****.**")
        generic = Generic(self.driver)

        assert "Invalid username or email." in generic.get_error_msg_text()
예제 #26
0
    def test_reset_password_passed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.reset_password("*****@*****.**")
        generic = Generic(self.driver)

        assert "Password reset email has been sent." in generic.get_msg_text()
예제 #27
0
    def test_update_billing_address_failed(self):
        email = "test{}@mail.com".format(random.randint(0, 10000))
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account(email, "haslotest12")
        billing_address_page = BillingAddressPage(self.driver)
        billing_address_page.open_edit_billing_address()
        billing_address_page.set_personal_data("", "")
        billing_address_page.set_address("", "", "")
        billing_address_page.set_phone_number("")
        billing_address_page.set_email_address("")
        billing_address_page.save_address()
        generic = Generic(self.driver)

        assert "First name is a required field." in generic.get_error_msg_text(
        )
        assert "Last name is a required field." in generic.get_error_msg_text()
        assert "Street address is a required field." in generic.get_error_msg_text(
        )
        assert "Postcode / ZIP is a required field." in generic.get_error_msg_text(
        )
        assert "Town / City is a required field." in generic.get_error_msg_text(
        )
        assert "Phone is a required field." in generic.get_error_msg_text()
        assert "Email address is a required field." in generic.get_error_msg_text(
        )
예제 #28
0
    def test_create_account_failed(self):
        my_account_page = MyAccountPage(self.driver)
        my_account_page.open_page()
        my_account_page.create_account("*****@*****.**", "haslotest12")
        generic = Generic(self.driver)

        assert "An account is already registered with your email address. Please log in." in generic.get_error_msg_text(
        )
예제 #29
0
    def test_user_authorization(self):

        with allure.step(
                "Авторизация зарегистрированным пользователем на сайте 'http://automationpractice.com'"
        ):
            data_test = Data()

            mainPage = MainPage(self.driver)
            loginPage = LoginPage(self.driver)
            myAccountPage = MyAccountPage(self.driver)

            with allure.step("Открытие главной страницы сайта"):
                mainPage.assert_the_header()
            with allure.step(
                    "Переход на страницу выбора логина или регистрации"):
                mainPage.go_to_login_page()
                loginPage.assert_the_login_page_header()
            with allure.step("Переход на страницу личного аккаунта"):
                loginPage.login_as_user(data_test.exising_user_email,
                                        data_test.exising_user_password)
            with allure.step(
                    "Проверка, что авторизация пользователя прошла успешно"):
                myAccountPage.assert_my_account_page_header()
예제 #30
0
 def test_create_user(self):
     home_page = HomePage(self.driver)
     account_page = MyAccountPage(self.driver)
     generator = Generator()
     # generate_email = f"email{datetime.now().microsecond}@test.com"
     # generate_password = f"password{datetime.now().microsecond}"
     generate_email = generator.generate_email(5, 4, 3)
     generate_password = generator.generate_password(5, 5, 2, 1)
     home_page.go_to_my_account_page()
     account_page.register_user(generate_email, generate_password)
     account_page.is_logout_link_displayed()