示例#1
0
    def test_createaccount_url(self):
        """ Tests that the /createaccount url leads to Create Account tab
        """
        d = self.driver
        d.get(self.login_url_https + "createAccount")
        sleep(2)
        cap = CreateAccountPage(d)

        assert cap.submit_button().text == 'Create Account'
示例#2
0
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.driver.maximize_window()
     self.home_page = HomePage(self.driver)
     self.create_account_page = CreateAccountPage(self.driver)
     self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
     self.admin_page = AdminPage(self.driver)
     self.customer_list_page = CustomerListPage(self.driver)
     self.countries_page = CountriesPage(self.driver)
     self.geo_zones_page = GeoZonesPage(self.driver)
     self.catalog_page = CatalogPage(self.driver)
示例#3
0
    def test_create_account(self, test_whitespaces):
        """ Tests that the user can create an account and log in with it
        """
        d = self.driver
        cap = CreateAccountPage(d)
        self.stop_all()
        self.set_etsy_testcase('listings_09')
        run_sql('AUTH', 'auth_01', retry=2)
        self.restart_all()

        # go to create account page
        d.get(self.login_url_https + "createAccount")
        sleep(1)

        # create account
        send_keys(cap.firstname(), 'Test')
        send_keys(cap.lastname(), 'User')
        email_text = '*****@*****.**'
        if test_whitespaces == Whitespaces.yes:
            # the case when whitespaces are around email in input field
            email_text = '   ' + email_text + ' '
        send_keys(cap.email(), email_text)
        send_keys(cap.password(), 'secret123')
        send_keys(cap.password2(), 'secret123')
        click(cap.submit_button())

        # check DB
        db_data = run_sql('AUTH', 'select_test_user', True)
        assert db_data == [['Test', 'User']]

        # log in using the new account
        d.delete_all_cookies()
        lp = LoginPage(d)
        lp.login(user='******',
                 password='******',
                 page=self.login_url_http)
        mp = MainPage(d)
        assert mp.is_displayed(), 'Login failed, main page is not displayed'
    def setUp(self):
        global email2
        # create new Chrome session
        self.driver = webdriver.Chrome(
            "C:/Users/cristian.prepelita/projects/drivers/chromedriver.exe")
        url = 'http://automationpractice.com/index.php'

        # navigate to the application cart
        self.driver.get(url)

        # add product to cart
        product = self.driver.find_element_by_xpath(
            '//*[@id="homefeatured"]/li[1]/div/div[2]/div[2]/a[1]')
        product.click()

        self.driver.implicitly_wait(7)
        # go to cart
        checkout = self.driver.find_element_by_css_selector(
            "a[title='Proceed to checkout']")
        checkout.click()

        # initiate summary page
        self.summary_page = SummaryPage(driver=self.driver)
        # proceed to the next step
        self.summary_page.btn_proceed_to_checkout.click()

        # initiate sign page
        self.sign_page = SignPage(driver=self.driver)

        # generate valid email
        name = random.choice(string.ascii_letters)
        address = random.choice(string.ascii_letters)
        domain = random.choice(string.ascii_letters)
        email = name + '@' + address + '.' + domain
        # insert the email and submit the button
        self.sign_page.input_email_create.input_text(email2)
        self.sign_page.btn_submit_create.click()

        #initiate create_account_page (form page)
        self.create_account_page = CreateAccountPage(driver=self.driver)
示例#5
0
import time
from pages.sign_in_page import SignInPage
from pages.create_account_page import CreateAccountPage

driver = webdriver.Chrome("D:/Tools/chromedriver.exe")
driver.implicitly_wait(10)
driver.get("https://accounts.google.com")

email_list = ['@q.q', '[email protected]', 'q@q', '[email protected]']
user_dictionary = {'fn': 'Vadim', 'ln': 'Berdutin', 'password': '******'}

sign_in_page = SignInPage(driver)
sign_in_page.create_account_click()
time.sleep(1)
sign_in_page.for_myself_click()
create_account_page = CreateAccountPage(driver)
create_account_page.enter_first_name(user_dictionary['fn'])
create_account_page.enter_last_name(user_dictionary['ln'])
create_account_page.enter_user_name(email_list[0])
create_account_page.enter_password(user_dictionary['password'])
create_account_page.enter_confirm_password(user_dictionary['password'])
create_account_page.click_next()
time.sleep(1)
assert create_account_page.validation_error in driver.page_source


def validate_username_field(user_name):
    create_account_page.enter_user_name(user_name)
    create_account_page.click_next()
    time.sleep(1)
    assert create_account_page.validation_error in driver.page_source
示例#6
0
    def setUp(self):
        # create new Chrome session
        self.driver = webdriver.Chrome(
            "C:/Users/cristian.prepelita/projects/drivers/chromedriver.exe")
        url = 'http://automationpractice.com/index.php'
        # navigate to the application cart
        self.driver.get(url)

        # add product to cart
        product = self.driver.find_element_by_xpath(
            '//*[@id="homefeatured"]/li[1]/div/div[2]/div[2]/a[1]')
        product.click()

        self.driver.implicitly_wait(7)
        # go to cart
        checkout = self.driver.find_element_by_css_selector(
            "a[title='Proceed to checkout']")
        checkout.click()

        # initiate summary page
        self.summary_page = SummaryPage(driver=self.driver)
        # proceed to the next step
        self.summary_page.btn_proceed_to_checkout.click()

        # initiate sign page
        self.sign_page = SignPage(driver=self.driver)

        # generate valid email
        name = random.choice(string.ascii_letters)
        address = random.choice(string.ascii_letters)
        domain = random.choice(string.ascii_letters)
        email = name + '@' + address + '.' + domain
        # insert the email and submit the button
        self.sign_page.input_email_create.input_text(email)
        self.sign_page.btn_submit_create.click()

        # initiate create_account_page (form page)
        self.create_account_page = CreateAccountPage(driver=self.driver)

        # YOUR PERSONAL INFORMATION
        self.create_account_page.get_client_title_mr.click()
        self.create_account_page.get_client_first_name.input_text('John')
        self.create_account_page.get_client_lastName.input_text('John')
        # email row pre-filled
        self.create_account_page.get_client_passwd.input_text('123467')
        # date of bird

        # YOUR ADDRESS
        # self.create_account_page.get_firstName_field.input_text('John')
        # self.create_account_page.get_last_name_field.input_text('John')
        self.create_account_page.get_company_field.input_text('Company')
        self.create_account_page.get_address_field.input_text('Address')
        self.create_account_page.get_city_field.input_text('City')
        # state
        self.create_account_page.dropdown_state_field.option('Alabama')
        self.create_account_page.get_postalcode_field.input_text('10000')
        # country
        self.create_account_page.get_homephone_field.input_text('070000122')
        self.create_account_page.get_mobilephone_field.input_text('0700000000')
        self.create_account_page.get_address_alias_field.input_text('Address')

        self.create_account_page.btn_register.click()

        self.address_page = AddressPage(driver=self.driver)
        self.address_page.btn_submit.click()

        self.shipping_page = ShippingPage(driver=self.driver)
示例#7
0
from behave import step
from time import sleep
from hamcrest import assert_that, equal_to
from faker import Faker

from pages.create_account_page import CreateAccountPage

faker = Faker()
create_account = CreateAccountPage()


@given(u'the tap in the menu SeuBarriga Híbrido')
def step_impl(context):
    create_account.menu_hidrido_tap()

@step('redirect to option SeuBarriga Híbrido')
def step_impl(context):
    create_account.wait_menu_create_account()

@step(u'tap in Novo usuário?')
def step_impl(context):
    create_account.new_user_tap()

@step(u'fill field name with value {value}')
def step_impl(context, value):
    context.get_name = faker.last_name()
    create_account.field_name_send_keys(context.get_name)

@step(u'fill field email with value {value}')
def step_impl(context, value):
    context.get_email = faker.email()
示例#8
0
from selenium import webdriver
from pages.sign_in_page import SignInPage
from pages.create_account_page import CreateAccountPage


driver = webdriver.Chrome('C:/Users/y.skubak/Desktop/python_course/chromedriver.exe')
driver.implicitly_wait(3)
driver.get("https://accounts.google.com")

sign_in_page = SignInPage(driver)
sign_in_page.create_account()

user_dictionary = {'fn': 'Yurii', 'ln': 'Skubak', 'password': '******'}
email_list = {'@a.a', '[email protected]', 'a@[email protected]', 'a@a'}
validation_error = "Дозволені лише літери (a–z), числа (0–9) та крапки (.)."

create_account_page = CreateAccountPage(driver)
create_account_page.enter_firstname(user_dictionary['fn'])
create_account_page.enter_lastname(user_dictionary['ln'])
create_account_page.enter_password(user_dictionary['password'])
create_account_page.confirm_password(user_dictionary['password'])

for email in email_list:
    create_account_page.validate_username_field(driver, email)

driver.quit()
示例#9
0
from behave import step

from pages.create_account_page import CreateAccountPage
from pages.base_page import BasePage
from helpers.helpers import faker

create_account_page = CreateAccountPage()


@step(u'fill all information')
def step_impl(context):
    context.email = faker.email()

    for keys in context.table:
        create_account_page.input_email_send_keys(context.email)
        create_account_page.input_password_send_keys(keys["password"])
        create_account_page.input_confirm_password_send_keys(
            keys["confirm_password"])

    BasePage().allure_take_screenshot("Personal_information_first")


@step(u'tap in button NEXT')
def step_impl(context):
    create_account_page.button_next_tap()


@step(u'fill the personal information fields')
def step_impl(context):
    context.name = faker.name()
    context.nickname = f"{faker.suffix_male()}_{faker.safe_color_name()}"
示例#10
0
class Application:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.home_page = HomePage(self.driver)
        self.create_account_page = CreateAccountPage(self.driver)
        self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
        self.admin_page = AdminPage(self.driver)
        self.customer_list_page = CustomerListPage(self.driver)
        self.countries_page = CountriesPage(self.driver)
        self.geo_zones_page = GeoZonesPage(self.driver)
        self.catalog_page = CatalogPage(self.driver)

    def quit(self):
        self.driver.quit()

    def admin_login(self, admin):
        if self.admin_panel_login_page.open().is_on_this_page():
            self.admin_panel_login_page.username_input.send_keys(
                admin.username)
            self.admin_panel_login_page.password_input.send_keys(
                admin.password)
            self.admin_panel_login_page.submit_login()
        return

    def logout(self):
        self.home_page.logout()

    def login_new_user(self, customer):
        self.home_page.email_input.send_keys(customer.email)
        self.home_page.password_input.send_keys(customer.password)
        self.home_page.login_button.click()

    def all_main_menu_items(self):
        items = self.admin_page.number_of_menu_items()
        for i in range(0, items):
            menu_items = self.admin_page.menu_items()
            menu_items[i].click()
            sub_items = self.admin_page.number_of_menu_sub_items()
            if sub_items == 0:
                continue
            for j in range(0, sub_items):
                menu_sub_items = self.admin_page.menu_sub_items()
                menu_sub_items[j].click()

    def sorting_countries(self):
        self.countries_page.open()
        number_countries = self.countries_page.number_of_countries()
        countries = self.countries_page.sorting_countries(number_countries)
        self.countries_page.countries_with_zones(countries)

    def sorting_geo_zones(self):
        self.geo_zones_page.open()
        number_geo_zones = self.geo_zones_page.number_of_geo_zones()
        geo_zones = self.geo_zones_page.sorting_geo_zones(number_geo_zones)
        self.geo_zones_page.geo_zones_with_zones(geo_zones)

    def register_new_customer(self, customer):
        self.create_account_page.open()
        self.create_account_page.firstname_input.send_keys(customer.firstname)
        self.create_account_page.lastname_input.send_keys(customer.lastname)
        self.create_account_page.address1_input.send_keys(customer.address)
        self.create_account_page.postcode_input.send_keys(customer.postcode)
        self.create_account_page.city_input.send_keys(customer.city)
        self.create_account_page.select_country(customer.country)
        self.create_account_page.select_zone(customer.zone)
        self.create_account_page.email_input.send_keys(customer.email)
        self.create_account_page.phone_input.send_keys(customer.phone)
        self.create_account_page.password_input.send_keys(customer.password)
        self.create_account_page.confirmed_password_input.send_keys(
            customer.password)
        self.create_account_page.create_account_button.click()

    def add_new_product(self, new_product):
        self.catalog_page.open_add_new_product()
        self.catalog_page.status_enabled.click()
        self.catalog_page.product_name_input.send_keys(
            new_product.product_name)
        self.catalog_page.code_product_input.send_keys(
            new_product.code_product)
        self.catalog_page.product_group_selection()
        self.catalog_page.quantity_input.send_keys(new_product.quantity)
        self.catalog_page.sold_out_status_selection()
        self.catalog_page.image_input.send_keys(new_product.image)
        self.catalog_page.date_valid_from_input.send_keys(
            new_product.date_valid_from)
        self.catalog_page.date_valid_to_input.send_keys(
            new_product.date_valid_to)
        self.catalog_page.open_information()
        self.catalog_page.select_manufacturer_id()
        self.catalog_page.keywords_input.send_keys(new_product.keywords)
        self.catalog_page.short_description_input.send_keys(
            new_product.short_description)
        self.catalog_page.trumbowyg_editor_input.send_keys(
            new_product.trumbowyg_editor)
        self.catalog_page.head_title_input.send_keys(new_product.head_title)
        self.catalog_page.meta_description_input.send_keys(
            new_product.meta_description)
        self.catalog_page.open_prices()
        self.catalog_page.purchase_price_input.send_keys(
            new_product.purchase_price)
        self.catalog_page.currency_selection()
        self.catalog_page.price_usd_input.send_keys(new_product.prices_usd)
        self.catalog_page.price_eur_input.send_keys(new_product.prices_eur)
        self.catalog_page.save_new_product()

    def get_customer_ids(self, customer):
        if self.admin_panel_login_page.open().is_on_this_page():
            self.admin_panel_login_page.username_input.send_keys(
                customer.username1)
            self.admin_panel_login_page.password_input.send_keys(
                customer.password1)
            self.admin_panel_login_page.submit_login()
        return self.customer_list_page.open().get_customer_ids()

    def product_in_the_cart(self):
        self.home_page.open()
        self.home_page.product_selection()

    def clear_to_cart(self):
        self.home_page.open_cart()
        self.home_page.product_removal()

    def opening_new_windows(self):
        self.countries_page.open()
        self.countries_page.opening_the_country_creation_page()
        self.countries_page.opening_new_windows()