Ejemplo n.º 1
0
def test_delete_addressbook_in_mh():
    browser = SeElements(webdriver.Firefox())
    #with se as browser:
    # open url
    browser.navigate('https://bulk.boomware.com/login')
    # login
    browser.find('email').write('*****@*****.**')
    browser.find('password').write('123456Test')
    browser.find('button').click()
    # enter token
    browser.find('code').write('978896')
    browser.find('button').click()
    pass
Ejemplo n.º 2
0
class Login(BasePage):
    se = None

    def __init__(self, driver):
        super().__init__(driver)
        self.se = SeElements(driver)
        self.se.navigate(get_correct_url(os.environ["ENV"], 'teacher/login'))

    def load(self):
        self.se.find_with_wait(NEXT_BUTTON)

    def isLoaded(self):
        try:
            assert self.se.find_with_wait(NEXT_BUTTON).is_displayed()
        except wrapping_exceptions():
            raise Error("Page is not loaded properly")

    def get_next_button(self):
        return self.se.find_with_wait(NEXT_BUTTON)

    def get_email_field(self):
        return self.se.find_with_wait(EMAIL_FIELD)

    def type_email(self):
        self.get_email_field().write(EMAIL)

    def get_password_field(self):
        return self.se.find_with_wait(PASSWORD_FIELD)

    def get_welcome_text(self):
        return self.se.find_with_wait(WELCOME_TEXT)

    def type_password(self):
        self.get_password_field().write(PASSWORD)

    def get_login_button(self):
        return self.se.find_with_wait(LOGIN_BUTTON)

    def click_next_button(self):
        self.get_next_button().click()

    def click_login_button(self):
        self.get_login_button().click()

    def make_login(self):
        self.type_email()
        self.click_next_button()
        self.type_password()
        self.click_login_button()
        self.get_welcome_text()
Ejemplo n.º 3
0
class ClassMenu(BasePage):
    def __init__(self, driver):
        super().__init__(driver)
        self.se = SeElements(driver)
        self.se.navigate(get_correct_url(os.environ["ENV"], 'teacher/classes'))

    def load(self):
        self.se.find_with_wait(CLASS_PAGE_TITLE)

    def isLoaded(self):
        try:
            assert self.se.find_with_wait(CLASS_PAGE_TITLE).is_displayed()
        except wrapping_exceptions():
            raise Error("Page is not loaded properly")

    def get_create_class_button(self):
        return self.se.find_with_wait(CREATE_A_NEW_CLASS)

    def get_add_class_window(self):
        return self.se.find_with_wait(ADD_CLASS_WINDOW)

    def get_class_name(self):
        return self.se.find_with_wait(CLASS_NAME_FIELD)

    def get_grade(self):
        return self.se.find_with_wait(GRADE)

    def get_period(self):
        return self.se.find_with_wait(PERIOD)

    def get_curriculum(self):
        return self.se.find_with_wait(CURRICULUM)

    def get_language(self):
        return self.se.find_with_wait(LANGUAGE)

    def get_status(self):
        return self.se.find_with_wait(STATUS)

    def get_create_class_on_modal(self):
        return self.se.find_with_wait(CREATE_CLASS_ON_MODAL)

    def get_nice_work_text(self):
        return self.se.find_with_wait(NICE_WORK)

    def get_no_thanks(self):
        return self.se.find_with_wait(NO_THANKS)

    def get_class_table(self):
        return self.se.find_with_wait(CLASS_TABLE)

    def get_class_name_inside_table(self):
        return self.se.find_with_wait(CLASS_NAME_INSIDE_TABLE)

    def get_student_count(self):
        return self.se.find_with_wait(STUDENT_COUNT)

    def get_confirm_field(self):
        return self.se.find_with_wait(CONFIRM_FIELD)

    def get_checkmark(self):
        return self.se.find_with_wait(CLASS_CHECKBOX)

    def get_bulk_action(self):
        return self.se.find_with_wait(BULK_ACTION)

    def get_delete(self):
        return self.se.find_with_wait(CLASS_DELETE)

    def get_ok(self):
        return self.se.find_with_wait(OK)

    def click_create_class_button(self):
        self.get_create_class_button().click()

    def type_class_name(self):
        self.get_class_name().write(CLASS_NAME)

    def type_confirm(self):
        self.get_confirm_field().write(CONFIRM)

    def type_grade(self):
        self.get_grade().write(GRADE_VALUE)

    def type_period(self):
        self.get_period().write(PERIOD_VALUE)

    def select_curriculum(self):
        self.get_curriculum().select(value=ENGLISH_VALUE)

    def select_language(self):
        self.get_language().select(value=LANGUAGE_VALUE)

    def select_status(self):
        self.get_status().select(value=STATUS_VALUE)

    def click_create_class_on_modal(self):
        self.get_create_class_on_modal().click()

    def click_no_thanks(self):
        self.get_no_thanks().click()

    def click_checkmark(self):
        self.get_checkmark().click()

    def click_bulk_action(self):
        self.get_bulk_action().click()

    def click_delete(self):
        self.get_delete().click()

    def click_ok(self):
        self.get_ok().click()

# Below functions are for Create Class -> with Add student flow

    def get_add_student(self):
        return self.se.find_with_wait(ADD_STUDENT)

    def click_add_student(self):
        self.get_add_student().click()

    def get_add_student_title(self):
        return self.se.find_with_wait(ADD_STUDENT_TITLE)

    def get_add_single_student(self):
        return self.se.find_with_wait(ADD_A_SINGLE_STUDENT)

    def click_add_single_student(self):
        self.get_add_single_student().click()

    def get_student_details(self):
        return self.se.find_with_wait(STUDENT_DETAILS)

    def get_username(self):
        return self.se.find_with_wait(USERNAME)

    def get_student_password(self):
        return self.se.find_with_wait(STUDENT_PASSWORD)

    def get_first_name(self):
        return self.se.find_with_wait(FIRST_NAME)

    def get_last_name(self):
        return self.se.find_with_wait(LAST_NAME)

    def get_create_student(self):
        return self.se.find_with_wait(CREATE_STUDENT_ON_MODAL)

    def type_username(self, username):
        self.get_username().write(username)

    def send_tab(self):
        self.get_username().write(Keys.TAB)

    def type_student_password(self):
        self.get_student_password().write(ST_PASSWORD)

    def type_first_name(self):
        self.get_first_name().write(STUDENT_FNAME)

    def type_last_name(self):
        self.get_last_name().write(STUDENT_LNAME)

    def click_create_student(self):
        self.get_create_student().click()

# Below is Error modal buttons functions

    def get_error_modal(self):
        return self.se.find_with_wait(ERROR_WINDOW)

    def get_error_text(self):
        return self.se.find_with_wait(ERROR_TEXT).text()

    def get_ok_on_error(self):
        return self.se.find_with_wait(OK_ON_ERROR)

    def click_ok_on_modal(self):
        self.get_ok_on_error().click()
Ejemplo n.º 4
0
NOTE:
    1) If Google ever changes their main page, this example will break.
    2) This assumes that you have Firefox installed on your machine
    3) This was tested on an OS X 10.10 machine running Firefox. YMMV.

To run:

    pip install -U selenium
    python simple.py
"""

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

from elementium.drivers.se import SeElements

# Create an Elements object that wraps the Selenium Firefox driver
elements = SeElements(webdriver.Firefox())

# Navigate to the Google search page
elements.navigate("http://www.google.com")

# Find the search box
search_box = elements.find('#lst-ib')[0]

# Enter something into the field to so that we can search for it
search_box.write("github elementium").write(Keys.RETURN)

# Quite the browser
elements.browser.quit()
# Value Sets Files
# Template for test results: sideA;	sideB;	sideC;	er; # er = expected result
at_testResult = 'at-testResult.csv'
# Template for test input: CaseID;	Priority;	sideA;	sideB;	sideC;	expRes;	TestThing;
at_testInput = 'at-testInput.csv'

try:
    if not os.path.exists(workDir):
        os.mkdir(workDir)
finally:
    print('Create dir: ' + workDir)

b = webdriver.Chrome(driverPath)
browser = SeElements(b)
browser.set_window_size(500, 600)
browser.navigate(formURL)

'''
1. МЕТОДЫ ДЛЯ ТЕСТИРОВАНИЯ ОЖИДАЕМОГО РЕЗУЛЬТАТА
2. МЕТОДЫ ДЛЯ ТЕСТИРОВАНИЯ ИНПУТОВ
'''

''' ##################### '''
''' ######### 1 ######### '''
''' ##################### '''


resultFileForTR = f'/{at_testResult}-RUN-{datetime.today().strftime("%Y-%m-%d_%H.%M.%S")}.csv'
# Метод чтения кейсов для проверки получаемого результата.
# На вход необходимо подать путь к файлу
# Возвращает массив массивов