コード例 #1
0
    def setUp(self):
        self.driver_1 = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                               desired_capabilities=DesiredCapabilities.CHROME)
        self.driver_1.implicitly_wait(10)

        auth_page = AuthPage(self.driver_1)
        auth_page.open()

        profile_page = auth_page.sign_in(self.LOGIN_1, self.PASSWORD_1)

        desc = {
            'description': 'group about shit',
            'title': 'pulp fiction',
            'subcategory': GroupSubcategory.CINEMA_TV,
            'age_restriction': AgeRestriction.NO_RESTRICTION
        }

        group_page = profile_page.to_groups_page().create_public_page(desc)

        setting_page = group_page.to_settings_page()

        setting_page.open()

        self.group_page = group_page
        self.setting_page = setting_page
コード例 #2
0
def login_and_write(driver, login, password):
    auth_page = AuthPage(driver)
    auth_page.open()
    auth_form = auth_page.form
    auth_form.set_login(login)
    auth_form.set_password(password)
    auth_form.submit()
コード例 #3
0
    def test_image_upload(self):
        auth_page = AuthPage(self.driver)
        auth_page.authorize()

        userinfo_page = UserInfoPage(self.driver)
        userinfo_page.input_test_image()

        userinfo_page.click_submit_button()
        userinfo_page.wait_for_ok_after_submit()
コード例 #4
0
    def test_open_help(self):
        auth_page = AuthPage(self.driver)
        auth_page.authorize()

        userinfo_page = UserInfoPage(self.driver)

        userinfo_page.click_on_help()
        userinfo_page.switch_to_window(1)
        userinfo_page.wait_for_help()
コード例 #5
0
ファイル: auth.py プロジェクト: H-b-IO-T-O-H/homework-4
def auth_as_employer_has_comp(test):
    auth_page = AuthPage(test.driver)
    auth_page.open()

    auth_form = auth_page.auth_form
    auth_form.set_email(test.EMAIL_EMPL_COMP)
    auth_form.set_password(test.PASSWORD_EMPL_COMP)
    auth_form.submit()
    auth_form.wait_for_mainpage()
コード例 #6
0
ファイル: auth.py プロジェクト: H-b-IO-T-O-H/homework-4
def setup_auth_failed(test, data=None):
    if data is None:
        data = {'EMAIL': test.EMAIL_APPL, 'PASSWORD': test.PASSWORD_APPL}
    auth_page = AuthPage(test.driver)
    auth_page.open()

    auth_form = auth_page.auth_form
    auth_form.set_email(data['EMAIL'])
    auth_form.set_password(data['PASSWORD'])
    auth_form.submit()
コード例 #7
0
ファイル: auth.py プロジェクト: H-b-IO-T-O-H/homework-4
def setup_auth(test, data=None) -> bool:
    if data is None:
        data = {'EMAIL': test.EMAIL_APPL, 'PASSWORD': test.PASSWORD_APPL}
    auth_page = AuthPage(test.driver)
    auth_page.open()

    auth_form = auth_page.auth_form
    auth_form.set_email(data['EMAIL'])
    auth_form.set_password(data['PASSWORD'])
    auth_form.submit()
    return auth_form.wait_for_mainpage()
コード例 #8
0
def test_auth_page(selenium):
   page = AuthPage(selenium)
   page.enter_email("*****@*****.**")
   page.enter_pass("pass")
   page.btn_click()

   #знак != или == будет зависеть от того, верные или неверные данные мы вводим
    assert page.get_relative_link() != '/all_pets', "login error"
コード例 #9
0
    def setUp(self) -> None:
        default_setup(self)

        self.auth_page = AuthPage(self.driver)
        self.reg_page = RegistrationPage(self.driver)

        self.incorrect_password = '******'
        self.invalid_password = '******'
        self.incorrect_email = 'margot.ru'
        self.invalid_email = '*****@*****.**'
        self.correct_email = self.EMAIL_APPL
        self.correct_password = self.PASSWORD_APPL
コード例 #10
0
    def test_correct_input(self):
        auth_page = AuthPage(self.driver)
        auth_page.authorize()

        userinfo_page = UserInfoPage(self.driver)

        userinfo_page.input_firstname(randomString())
        userinfo_page.input_lastname(randomString())
        userinfo_page.input_nickname(randomString())

        userinfo_page.click_submit_button()
        userinfo_page.wait_for_ok_after_submit()
コード例 #11
0
ファイル: auth.py プロジェクト: H-b-IO-T-O-H/homework-4
def auth_as_employer_no_comp(test):
    data = {
        'EMAIL': '*****@*****.**',
        'PASSWORD': '******'
    }
    auth_page = AuthPage(test.driver)
    auth_page.open()

    auth_form = auth_page.auth_form
    auth_form.set_email(data['EMAIL'])
    auth_form.set_password(data['PASSWORD'])
    auth_form.submit()
    auth_form.wait_for_mainpage()
コード例 #12
0
    def test_logout(self):
        auth_page = AuthPage(self.driver)
        auth_page.authorize()

        userinfo_page = UserInfoPage(self.driver)
        userinfo_page.open_settings_in_new_window()
        userinfo_page.wait_for_ok_after_submit()

        userinfo_page.click_logout_button()
        userinfo_page.wait_for_logout()

        userinfo_page.switch_to_window(0)
        userinfo_page.resresh_page()
        userinfo_page.match_to_login_URI()
コード例 #13
0
ファイル: test_auth_alfa2.py プロジェクト: AngrbodaIX/alfa2
def test_positive_reg(web_browser):
    page = AuthPage(web_browser)
    page.input_first_name_xpath = config.positive_first_name
    page.input_last_name_xpath = config.positive_last_name
    page.input_email_xpath = config.positive_email
    page.input_phone_xpath = config.positive_phone
    page.input_password_xpath = config.positive_password
    page.input_password_confirmation_xpath = config.positive_password_confirmation
    page.checkbox_xpath.click()
    page.button_registration_xpath.click()
    assert page.get_relative_link() == config.url_reg, 'ERROR positive_reg'
コード例 #14
0
    def setUp(self) -> None:
        default_setup(self)

        self.incorrect_name = 'name123'
        self.incorrect_surname = 'surname123'
        self.incorrect_email = 'margot.ru'
        self.correct_name = 'margotName'
        self.correct_surname = 'margotSurname'
        self.correct_email = '*****@*****.**'
        self.correct_password = self.PASSWORD_APPL

        self.auth_page = AuthPage(self.driver)
        self.reg_page = RegistrationPage(self.driver)
        self.profile_page = ProfilePage(self.driver)
        self.main_page = MainPage(self.driver)
コード例 #15
0
    def test_date_lists(self):
        auth_page = AuthPage(self.driver)
        auth_page.authorize()

        userinfo_page = UserInfoPage(self.driver)

        userinfo_page.click_on_day_input()
        userinfo_page.click_on_day_child_input()
        userinfo_page.click_on_month_input()
        userinfo_page.click_on_month_child_input()
        userinfo_page.click_on_year_input()
        userinfo_page.click_on_year_child_input()

        userinfo_page.click_submit_button()
        userinfo_page.wait_for_ok_after_submit()
コード例 #16
0
ファイル: auth.py プロジェクト: H-b-IO-T-O-H/homework-4
def auth_as_applicant(test):
    data = {
        'EMAIL': test.EMAIL_APPL,
        'PASSWORD': test.PASSWORD_APPL,
        'NAME': 'margot',
        'SURNAME': 'margot',
        'PHONE': '12345678910'
    }
    auth_page = AuthPage(test.driver)
    auth_page.open()

    auth_form = auth_page.auth_form
    auth_form.set_email(data['EMAIL'])
    auth_form.set_password(data['PASSWORD'])
    auth_form.submit()
    auth_form.wait_for_mainpage()
    return data
コード例 #17
0
    def setUp(self):
        self.driver_1 = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                               desired_capabilities=DesiredCapabilities.CHROME)
        self.driver_1.implicitly_wait(10)

        self.driver_2 = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                               desired_capabilities=DesiredCapabilities.CHROME)
        self.driver_2.implicitly_wait(10)
        auth_page = AuthPage(self.driver_1)
        auth_page.open()

        profile_page = auth_page.sign_in(self.LOGIN_1, self.PASSWORD_1)

        desc = {
            'description': 'group about shit',
            'title': 'pulp fiction',
            'subcategory': GroupPageCreateForm.CINEMA_TV,
            'age_restriction': 0
        }

        desc2 = {
            'description': 'group about python',
            'title': 'django',
            'subcategory': GroupPageCreateForm.CHILDREN,
            'age_restriction': 0
        }

        group_page = profile_page.to_groups_page().create_public_page(desc)
        profile_page.open()
        profile_page.to_groups_page().create_public_page(desc2)
        group_page.open()

        auth_page_user2 = AuthPage(self.driver_2)
        auth_page_user2.open()

        profile_user_2 = auth_page_user2.sign_in(self.LOGIN_2, self.PASSWORD_2)
        group_page_user2 = GroupPage(self.driver_2,
                                     path=group_page.path).open()
        group_page_user2.join()

        setting_page = group_page.to_settings_page()

        self.group_page = group_page
        self.setting_page = setting_page
        self.profile_user_2 = profile_user_2
コード例 #18
0
    def test_valid_acc_creation(self, driver):
        data = provider.test_data_provider("register", "valid_acc_creation")
        homepage = HomePage(driver)
        authpage = AuthPage(driver)
        createaccpage = CreateAccPage(driver)
        profilepage = ProfilePage(driver)

        assert_true(homepage.is_page_loaded)
        homepage.sign_in_button.click()

        assert_true(authpage.is_page_loaded)
        authpage.register(data)

        assert_true(createaccpage.is_page_loaded)
        createaccpage.fill_up_form(data)

        assert_true(profilepage.is_page_loaded())
        time.sleep(3)
コード例 #19
0
    def test_login_missing_email_and_password(self, driver):
        data = dp.test_data_provider("login", "login_no_email_and_password")
        page = HomePage(driver)
        assert_true(page.is_page_loaded)
        actions.click(page.sign_in_button)

        page = AuthPage(driver)
        assert_true(page.is_page_loaded)
        page.login(data)
        assert_true(page.is_error_alert_displayed)
        assert_equal(page.error_message, "There is 1 error\nAn email address required.")
コード例 #20
0
    def test_login_wrong_credentials(self, driver):
        data = dp.test_data_provider("login", "login_wrong_credentials")
        page = HomePage(driver)
        assert_true(page.is_page_loaded)
        actions.click(page.sign_in_button)

        page = AuthPage(driver)
        assert_true(page.is_page_loaded)
        page.login(data)
        assert_true(page.is_error_alert_displayed)
        assert_equal(page.error_message, "There is 1 error\nAuthentication failed.")
コード例 #21
0
    def test_login_correct_credentials(self, driver):
        data = dp.test_data_provider("login", "login_correct_credentials")
        page = HomePage(driver)
        assert_true(page.is_page_loaded)
        actions.click(page.sign_in_button)

        page = AuthPage(driver)
        assert_true(page.is_page_loaded)
        page.login(data)
        page = ProfilePage(driver)
        assert_true(page.is_page_loaded)
コード例 #22
0
def test_positive_sing_in(web_browser):
    """Проверяем вход зарегистрированного пользователя с корректными данными"""
    page = AuthPage(web_browser)
    page.input_email_sing_in = config.positive_email
    page.input_password_sing_in = config.positive_password
    page.button_sing_in.click()
    time.sleep(1)
    page.wait_page_loaded()
    path = page.get_relative_link()
    assert path == config.path_base
コード例 #23
0
ファイル: test_auth_alfa2.py プロジェクト: AngrbodaIX/alfa2
def test_warning_password_small(web_browser):
    page = AuthPage(web_browser)
    page.input_password_xpath = config.negative_password_small
    page.input_password_confirmation_xpath = config.negative_password_small

    page.input_first_name_xpath = config.positive_first_name
    page.input_last_name_xpath = config.positive_last_name
    page.input_email_xpath = config.positive_email
    page.input_phone_xpath = config.positive_phone
    page.checkbox_xpath.click()
    page.button_registration_xpath.click()

    assert page.warning_whoops_xpath.is_visible(
    ) and page.warning_password_small_xpath.is_visible(
    ), 'Not found warning_password_small'
コード例 #24
0
def tmall_auth_page(driver):
    page = AuthPage(driver)
    page.login.click()
    page.email = email
    page.password = password
    page.auth_btn.click()
    page.wait_page_loaded()
    return page
コード例 #25
0
    def setUpClass(cls):
        cls.browser: str = os.getenv('BROWSER', 'CHROME')
        cls.driver = webdriver.Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities,
                                         cls.browser).copy())
        login: str = os.environ.get('LOGIN')
        password: str = os.environ.get('PASSWORD')

        cls.group: GroupPage = AuthPage(cls.driver).open() \
            .sign_in(login, password) \
            .to_groups_page() \
            .create_public_page(cls.TEST_GROUP)
        cls.photo_page: PhotoPage = cls.group.to_photo_page()
コード例 #26
0
def test_auth_page(selenium):
    page = AuthPage(selenium)
    time.sleep(3)  # задержка 3 сек для учебных целей
    page.enter_email('*****@*****.**')
    page.enter_pass('123456')
    page.btn.click()

    # знак != или == будет зависеть от того, верные или неверные данные мы вводим
    assert page.get_relative_link() != '/all_pets', 'login error'

    time.sleep(4)  # задержка 3 сек для учебных целей


# python -m pytest -v --driver Chrome --driver-path C:/driver/cromedriver.exe
コード例 #27
0
ファイル: test_auth.py プロジェクト: Mikko812/FinalRemake
def test_tmall_auth_page(selenium):
    page = AuthPage(selenium)
    page.login.click()
    login_page = page.get_current_url()

    msg = 'Не удалось перейти на страницу входа в ЛК.'
    assert 'login.aliexpress.com' in login_page, msg

    page.email = email
    page.password = password
    page.auth_btn.click()
    page.wait_page_loaded()
    acc_name = page.lk_in.get_attribute('innerText')

    assert acc_name == email.split('@')[0]
コード例 #28
0
    def test(self):
        auth_page = AuthPage(self.driver)
        auth_page.open()
        auth_page.authorize()

        userinfo_page = UserinfoPage(self.driver)
        userinfo_page.open()
        userinfo_form = userinfo_page.form
        userinfo_form.set_town(self.TOWN_PREFIX)
        userinfo_form.wait_for_last_suggest(self.SUGGEST_LIST[-1])
        self.assertEqual(self.SUGGEST_LIST,
                         userinfo_form.get_suggests_for_town())
コード例 #29
0
def test_negativ_email_sing_in(web_browser):
    """Проверяем вход зарегистрированного пользователя по неверному email"""
    page = AuthPage(web_browser)
    email = config.negativ_email
    password = config.positive_password
    page.input_email_sing_in = email
    page.input_password_sing_in = password
    page.button_sing_in.click()
    time.sleep(1)
    page.wait_page_loaded()

    path = page.get_relative_link()
    assert path == config.path_url_reg

    error_element = page.warning_whoops_negativ_email
    assert error_element.is_visible()
コード例 #30
0
    def test(self):
        auth_page = AuthPage(self.driver)
        auth_page.open()
        auth_page.authorize()

        userinfo_page = UserinfoPage(self.driver)
        userinfo_page.open()
        userinfo_form = userinfo_page.form
        userinfo_form.set_town(self.WRONG_TOWN_NAME)
        userinfo_form.wait_for_suggests_invisible()
        userinfo_form.save()
        self.assertEqual(self.TOP_MESSAGE, userinfo_form.get_top_message())
        self.assertEqual(self.TOWN_ERROR, userinfo_form.get_town_message())