Exemplo n.º 1
0
 def error_check(self):
     if function.is_element_present(driver, self, By.XPATH, '//*[contains(text(), "Close")]'):
         if function.is_element_present(driver, self, By.XPATH,'/html/body/div[5]/div[2]/div/mat-dialog-container/error-dialog/h1'):
             ui_element=driver.find_element_by_xpath('/html/body/div[5]/div[2]/div/mat-dialog-container/error-dialog/h1')
             error_element=ui_element.text
             print (error_element)
         driver.find_element_by_xpath('//*[contains(text(), "Close")]').click()
         print ("rdd error closed")
Exemplo n.º 2
0
def test_03_create_newuser_primarygroup_uncheck(browser):
    # Click create new user option
    browser.find_element_by_xpath(xpaths['fabAction']).click()
    # wait on the page to load
    wait = wait_on_element(browser, xpaths['newUserName'])
    assert wait, f'Loading Users Add page timeout'
    # Enter User Full name
    browser.find_element_by_xpath(
        xpaths['newUserName']).send_keys(uncheckuserfn)
    # clear user name and enter new Username
    browser.find_element_by_xpath(xpaths['newUser']).clear()
    browser.find_element_by_xpath(xpaths['newUser']).send_keys(uncheckuser)

    # Enter Password
    browser.find_element_by_xpath(
        xpaths['newUserPass']).send_keys(newuserpassword)
    # Enter Password Conf
    browser.find_element_by_xpath(
        xpaths['newUserPassConf']).send_keys(newuserpassword)
    # Click on create new User button
    assert is_element_present(browser, xpaths['saveButton']) is True
    browser.find_element_by_xpath(xpaths['saveButton']).click()
    # wait on the fabAction
    wait = wait_on_element(browser, xpaths['fabAction'])
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    assert wait, f'Loading Users page timeout'
    # check if there is a generic error when making a duplicate user, and print the error
    no_error = error_check(browser)
    assert no_error['result'], no_error['traceback']
Exemplo n.º 3
0
def test_06_create_newuser_suggested_name(browser):
    # Click create new user option
    browser.find_element_by_xpath(xpaths['fabAction']).click()
    # wait on the page to load
    wait = wait_on_element(browser, xpaths['newUserName'])
    assert wait, f'Loading Users Add page timeout'
    # Enter User Full name
    browser.find_element_by_xpath(xpaths['newUserName']).send_keys(nouserfn)

    browser.find_element_by_xpath(
        xpaths['newUserEmail']).send_keys(newuseremail)
    # Enter Password
    browser.find_element_by_xpath(
        xpaths['newUserPass']).send_keys(newuserpassword)
    # Enter Password Conf
    browser.find_element_by_xpath(
        xpaths['newUserPassConf']).send_keys(newuserpassword)
    # Click on create new User button
    assert is_element_present(browser, xpaths['saveButton']) is True
    browser.find_element_by_xpath(xpaths['saveButton']).click()
    # wait on the fabAction
    wait = wait_on_element(browser, xpaths['fabAction'])
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    assert wait, f'Loading Users page timeout'
    no_error = error_check(browser)
    assert no_error['result'], no_error['traceback']
Exemplo n.º 4
0
 def test_01_login(self):
     try:
         print ("loging in TrueNAS new webui- woot woot")
         # enter username in the username textbox
         driver.find_element_by_xpath(xpaths['usernameTxtBox']).clear()
         driver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username)
         # enter password in the password textbox
         driver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password)
         # click
         driver.find_element_by_xpath(xpaths['submitButton']).click()
         # check if the dashboard opens
         time.sleep(1)
         # get the ui element
         ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a')
         # get the weather data
         page_data=ui_element.text
         print ("The page now is: " + page_data)
         # assert response
         self.assertTrue("Dashboard" in page_data)
         # cancelling the tour
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[5]/div[1]/button'):
             driver.find_element_by_xpath('/html/body/div[5]/div[1]/button').click()
         driver.execute_script("document.body.style.zoom='50 %'")
         #taking screenshot
         function.screenshot(driver, self)
     except Exception:
         exc_info_p = traceback.format_exception(*sys.exc_info())
         #taking screenshot
         function.screenshot(driver, self)
         for i in range(1,len(exc_info_p)):
             print (exc_info_p[i])
         self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
Exemplo n.º 5
0
def test_02_delete_user_(browser, user):
    assert is_element_present(browser, xpaths[f'{user}UserMenu']) is True
    browser.find_element_by_xpath(xpaths[f'{user}UserMenu']).click()
    assert is_element_present(browser, xpaths[f'{user}UserDelete']) is True
    browser.find_element_by_xpath(xpaths[f'{user}UserDelete']).click()
    assert is_element_present(browser, xpaths['confirmCheckbox']) is True
    browser.find_element_by_xpath(xpaths['confirmsecondaryCheckbox']).click()
    browser.find_element_by_xpath(xpaths['confirmCheckbox']).click()
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, f"{test_name}_before")
    browser.find_element_by_xpath(xpaths['deleteButton']).click()
    time.sleep(5)
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, f"{test_name}_after")
Exemplo n.º 6
0
def the_browser_is_open_the_freenas_url_and_logged_in(driver, nas_ip,
                                                      root_password):
    """the browser is open, the FreeNAS URL and logged in."""
    if nas_ip not in driver.current_url:
        driver.get(f"http://{nas_ip}")
        assert wait_on_element(driver, 10,
                               '//input[@data-placeholder="Username"]')
    if not is_element_present(driver,
                              '//mat-list-item[@ix-auto="option__Dashboard"]'):
        assert wait_on_element(driver, 10,
                               '//input[@data-placeholder="Username"]')
        driver.find_element_by_xpath(
            '//input[@data-placeholder="Username"]').clear()
        driver.find_element_by_xpath(
            '//input[@data-placeholder="Username"]').send_keys('root')
        driver.find_element_by_xpath(
            '//input[@data-placeholder="Password"]').clear()
        driver.find_element_by_xpath(
            '//input[@data-placeholder="Password"]').send_keys(root_password)
        assert wait_on_element(driver, 5, '//button[@name="signin_button"]')
        driver.find_element_by_xpath('//button[@name="signin_button"]').click()
    else:
        assert wait_on_element(
            driver, 10, '//mat-list-item[@ix-auto="option__Dashboard"]',
            'clickable')
        driver.find_element_by_xpath(
            '//mat-list-item[@ix-auto="option__Dashboard"]').click()
Exemplo n.º 7
0
 def test_02_create_newpool(self):
     try:
         print (" creating a new pool with 1 disk")
         # cancelling the tour
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'):
             driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click()
         time.sleep(1)
         # Click create new pool option
         driver.find_element_by_xpath(xpaths['addAction']).click()
         # Click create Pool Button
         driver.find_element_by_xpath(xpaths['forwardButton']).click()
         # Enter User Full name
         driver.find_element_by_xpath(xpaths['newpoolName']).send_keys(pool1)
         # Select the disk
         driver.find_element_by_xpath(xpaths['disk1Checkbox']).click()
         # Select the disk
         driver.find_element_by_xpath(xpaths['diskselectedmoveButton']).click()
         # Click on create new Pool button
         driver.find_element_by_xpath(xpaths['createButton']).click()
         # checkbox confirmation
         driver.find_element_by_xpath(xpaths['confirmCheckbox']).click()
         # Click Ok Button
         driver.find_element_by_xpath(xpaths['createpoolButton']).click()
         #taking screenshot
         function.screenshot(driver, self)
         self.error_check()
     except Exception:
         exc_info_p = traceback.format_exception(*sys.exc_info())
         #taking screenshot
         function.screenshot(driver, self)
         for i in range(1,len(exc_info_p)):
             print (exc_info_p[i].rstrip())
         self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
Exemplo n.º 8
0
def the_users_page_should_open(driver):
    """The Users page should open."""
    assert wait_on_element(driver, 0.5, 5, '//h1[contains(.,"Display Note")]')
    if is_element_present(driver, '//h1[contains(.,"Display Note")]'):
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__CLOSE"]').click()
    assert wait_on_element(driver, 0.5, 30, '//div[contains(.,"Users")]')
Exemplo n.º 9
0
def test_04_create_superuser(browser):
    test_name = sys._getframe().f_code.co_name
    browser.find_element_by_tag_name('html').send_keys(Keys.END)
    # Click create new user option
    browser.find_element_by_xpath(xpaths['fabAction']).click()
    # Enter User Full name
    browser.find_element_by_xpath(xpaths['newUserName']).send_keys(superuserfn)
    # clear user name and enter new Username
    browser.find_element_by_xpath(xpaths['newUser']).clear()
    browser.find_element_by_xpath(xpaths['newUser']).send_keys(superuser)

    # Enter Password
    browser.find_element_by_xpath(
        xpaths['newUserPass']).send_keys(superuserpassword)
    # Enter Password Conf
    browser.find_element_by_xpath(
        xpaths['newUserPassConf']).send_keys(superuserpassword)
    # check Permit Sudo Checkbox
    browser.find_element_by_xpath(xpaths['permitSudocheckbox']).click()
    # Click on create new User button
    assert is_element_present(browser, xpaths['saveButton']) is True
    browser.find_element_by_xpath(xpaths['saveButton']).click()
    # wait on the fabAction
    xpath = xpaths['fabAction']
    wait = wait_on_element(browser, xpath, script_name, test_name)
    assert wait, f'Loading Users page timeout'
    # taking screenshot
    take_screenshot(browser, script_name, test_name)
    # check if there is a generic error when making a duplicate user, and print the error
    no_error = error_check(browser)
    assert no_error['result'], no_error['traceback']
Exemplo n.º 10
0
def test_02_create_newuser(browser):
    test_name = sys._getframe().f_code.co_name
    # Click create new user option
    browser.find_element_by_xpath(xpaths['fabAction']).click()
    # Enter User Full name
    browser.find_element_by_xpath(xpaths['newUserName']).send_keys(newuserfn)
    # clear user name and enter new Username
    browser.find_element_by_xpath(xpaths['newUser']).clear()
    browser.find_element_by_xpath(xpaths['newUser']).send_keys(newuser)
    # Enter User email id
    browser.find_element_by_xpath(
        xpaths['newUserEmail']).send_keys(newuseremail)
    # Enter Password
    browser.find_element_by_xpath(
        xpaths['newUserPass']).send_keys(newuserpassword)
    # Enter Password Conf
    browser.find_element_by_xpath(
        xpaths['newUserPassConf']).send_keys(newuserpassword)
    # Click on create new User button
    assert is_element_present(browser, xpaths['saveButton']) is True
    print("found the save button")
    browser.find_element_by_xpath(xpaths['saveButton']).click()
    # wait on the fabAction
    xpath = xpaths['fabAction']
    wait = wait_on_element(browser, xpath, script_name, test_name)
    assert wait, f'Loading Users page timeout'
    # taking screenshot
    take_screenshot(browser, script_name, test_name)
    no_error = error_check(browser)
    assert no_error['result'], no_error['traceback']
Exemplo n.º 11
0
 def test_01_login(self):
     try:
         print ("loging in FreeNAS new webui- woot woot")
         # enter username in the username textbox
         driver.find_element_by_xpath(xpaths['usernameTxtBox']).clear()
         driver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username)
         # enter password in the password textbox
         driver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password)
         # click
         driver.find_element_by_xpath(xpaths['submitButton']).click()
         # check if the dashboard opens
         time.sleep(1)
         self.error_check()
         self.error_check()
         # get the ui element
         ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a')
         # get the weather data
         page_data=ui_element.text
         print ("The page now is: " + page_data)
         # assert response
         self.assertTrue("Dashboard" in page_data)
         # cancelling the tour
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[5]/div[1]/button'):
             driver.find_element_by_xpath('/html/body/div[5]/div[1]/button').click()
         driver.execute_script("document.body.style.zoom='50 %'")
         #taking screenshot
         function.screenshot(driver, self)
     except Exception:
         exc_info_p = traceback.format_exception(*sys.exc_info())
         #taking screenshot
         function.screenshot(driver, self)
         for i in range(1,len(exc_info_p)):
             print (exc_info_p[i].rstrip())
         self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
Exemplo n.º 12
0
 def test_02_create_newpool(self):
     try:
         print (" creating a new pool with 1 disk")
         # cancelling the tour
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'):
             driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click()
         time.sleep(1)
         # Click create new pool option
         driver.find_element_by_xpath(xpaths['addAction']).click()
         # Click create Pool Button
         driver.find_element_by_xpath(xpaths['forwardButton']).click()
         # Enter User Full name
         driver.find_element_by_xpath(xpaths['newpoolName']).send_keys(pool1)
         # Select the disk
         driver.find_element_by_xpath(xpaths['disk1Checkbox']).click()
         # Select the disk
         driver.find_element_by_xpath(xpaths['diskselectedmoveButton']).click()
         # Click on create new Pool button
         driver.find_element_by_xpath(xpaths['createButton']).click()
         # checkbox confirmation
         driver.find_element_by_xpath(xpaths['confirmCheckbox']).click()
         # Click Ok Button
         driver.find_element_by_xpath(xpaths['createpoolButton']).click()
         #taking screenshot
         function.screenshot(driver, self)
         self.error_check()
     except Exception:
         exc_info_p = traceback.format_exception(*sys.exc_info())
         #taking screenshot
         function.screenshot(driver, self)
         for i in range(1,len(exc_info_p)):
             print (exc_info_p[i].rstrip())
         self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
Exemplo n.º 13
0
def error_check(wb_driver):
    closeButton = '//*[contains(text(), "Close")]'
    xpath = '/html/body/div[5]/div[2]/div/mat-dialog-container/error-dialog/h1'
    if is_element_present(wb_driver, closeButton):
        ui_element = wb_driver.find_element_by_xpath(xpath)
        wb_driver.find_element_by_xpath(closeButton).click()
        assert False, ui_element.text
Exemplo n.º 14
0
 def selectlist(self, element):
     for i in range(0,10):
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[4]/div[2]/div/div/md-option[' + str(i) + ']'):
             dropdown_el = driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div/md-option[' + str(i) + ']')
             dropdown_text = dropdown_el.text
             if dropdown_text == element:
                 dropdown_el.click()
                 break
Exemplo n.º 15
0
def verify_that_the_user_is_root_and_the_group_is_wheel(driver):
    """verify that the user is root and the group is wheel."""
    assert wait_on_element(driver, 5,
                           '//div[contains(text(),"owner@ - root")]')
    assert wait_on_element(driver, 5,
                           '//div[contains(text(),"group@ - root")]')
    assert not is_element_present(
        driver, '//div[contains(text(),"Group - builtin_users")]')
Exemplo n.º 16
0
 def selectlist(self, element):
     for i in range(0,10):
         if function.is_element_present(driver, self, By.XPATH, '/html/body/div[4]/div[2]/div/div/md-option[' + str(i) + ']'):
             dropdown_el = driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div/md-option[' + str(i) + ']')
             dropdown_text = dropdown_el.text
             if dropdown_text == element:
                 dropdown_el.click()
                 break
Exemplo n.º 17
0
def test_01_go_settings_preferences(browser):
    browser.find_element_by_xpath(xpaths['Setting']).click()
    browser.find_element_by_xpath(xpaths['Preferences']).click()
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    find_select = is_element_present(browser, xpaths['SelectTheme'])
    assert find_select is True, find_select
Exemplo n.º 18
0
def test_04_save_nfs_configuration(wb_driver):
    # click on save button
    wb_driver.find_element_by_xpath(xpaths['saveButton']).click()
    time.sleep(5)
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(wb_driver, script_name, test_name)
    assert is_element_present(wb_driver, xpaths['breadcrumbBar2']) is False
Exemplo n.º 19
0
def test_10_set_destroy_data_and_Confirm_press_export_disconnect(browser):
    test_name = sys._getframe().f_code.co_name
    browser.find_element_by_xpath(xpaths['pooldestroyCheckbox']).click()
    browser.find_element_by_xpath(xpaths['poolconfirmCheckbox']).click()
    element_present = is_element_present(browser, xpaths['confirmButton'])
    take_screenshot(browser, script_name, test_name)
    assert element_present, f'XPath Not Found: {xpaths["confirmButton"]}'
    browser.find_element_by_xpath(xpaths['confirmButton']).click()
Exemplo n.º 20
0
def verify_that_the_user_and_group_is_ericbsd(driver):
    """verify that the user and group is ericbsd."""
    assert wait_on_element(driver, 5,
                           '//div[contains(text(),"owner@ - ericbsd")]')
    assert wait_on_element(driver, 5,
                           '//div[contains(text(),"group@ - ericbsd")]')
    assert not is_element_present(
        driver, '//div[contains(text(),"Group - builtin_users")]')
Exemplo n.º 21
0
def create_smb_share_with_path_tankrtacltest1share(driver, path):
    """Create SMB share with path tank/rt-acl-test-1/share."""
    assert wait_on_element(driver, 10,
                           '//mat-list-item[@ix-auto="option__Shares"]',
                           'clickable')
    driver.find_element_by_xpath(
        '//mat-list-item[@ix-auto="option__Shares"]').click()
    assert wait_on_element(driver, 5, '//div[contains(.,"Shares")]')
    assert wait_on_element(
        driver, 7,
        '//mat-card[contains(.,"Windows (SMB) Shares")]//button[contains(.,"Add")]',
        'clickable')
    driver.find_element_by_xpath(
        '//mat-card[contains(.,"Windows (SMB) Shares")]//button[contains(.,"Add")]'
    ).click()
    assert wait_on_element(driver, 5, '//h3[contains(text(),"Add SMB")]')
    global smb_path
    smb_path = path
    assert wait_on_element(driver, 5, '//input[@ix-auto="input__path"]',
                           'inputable')
    driver.find_element_by_xpath('//input[@ix-auto="input__path"]').clear()
    driver.find_element_by_xpath('//input[@ix-auto="input__path"]').send_keys(
        path)
    assert wait_on_element(driver, 5, '//input[@ix-auto="input__Name"]',
                           'inputable')
    driver.find_element_by_xpath('//input[@ix-auto="input__Name"]').clear()
    driver.find_element_by_xpath('//input[@ix-auto="input__Name"]').send_keys(
        "rt-test")
    assert wait_on_element(driver, 5,
                           '//mat-checkbox[@ix-auto="checkbox__Enabled"]',
                           'clickable')
    checkbox_checked = attribute_value_exist(
        driver, '//mat-checkbox[@ix-auto="checkbox__Enabled"]', 'class',
        'mat-checkbox-checked')
    if not checkbox_checked:
        driver.find_element_by_xpath(
            '//mat-checkbox[@ix-auto="checkbox__Enabled"]').click()
    assert attribute_value_exist(
        driver, '//mat-checkbox[@ix-auto="checkbox__Enabled"]', 'class',
        'mat-checkbox-checked')
    time.sleep(1)
    assert wait_on_element(driver, 5, '//input[@ix-auto="input__Description"]',
                           'inputable')
    driver.find_element_by_xpath(
        '//input[@ix-auto="input__Description"]').clear()
    driver.find_element_by_xpath(
        '//input[@ix-auto="input__Description"]').send_keys("rt-test")
    assert wait_on_element(driver, 5, '//button[@ix-auto="button__SAVE"]',
                           'clickable')
    driver.find_element_by_xpath('//button[@ix-auto="button__SAVE"]').click()
    assert wait_on_element_disappear(driver, 15,
                                     '//h6[contains(.,"Please wait")]')
    if is_element_present(driver, '//h1[contains(., "Enable service")]'):
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__ENABLE SERVICE"]').click()
        assert wait_on_element(driver, 5, '//h1[contains(., "SMB Service")]')
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__CLOSE"]').click()
Exemplo n.º 22
0
def test_02_change_theme_to_(browser, theme):
    browser.find_element_by_xpath(xpaths['SelectTheme']).click()
    time.sleep(1)
    find_theme = is_element_present(browser, theme_name[theme])
    assert find_theme is True, find_theme
    browser.find_element_by_xpath(theme_name[theme]).click()
    time.sleep(2)
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
Exemplo n.º 23
0
def test_02_check_update_now(wb_driver):
    # Click on the checknow button
    wb_driver.find_element_by_xpath(xpaths['buttonChecknow']).click()
    time.sleep(1)
    # get the ui element, check if first element is present, if yes, check value text if as expected
    if is_element_present(
            wb_driver,
            "/html/body/app-root/app-admin-layout/mat-sidenav-container/mat-sidenav-content/div/app-update/mat-card[1]/div/div[4]/div/table/tbody/tr[1]/td[1]"
    ):
        ui_element = wb_driver.find_element_by_xpath(
            "/html/body/app-root/app-admin-layout/mat-sidenav-container/mat-sidenav-content/div/app-update/mat-card[1]/div/div[4]/div/table/tbody/tr[1]/td[1]"
        )
        update_data = ui_element.text
        if update_data == "Upgrade":
            print("There is an available upgrade")
            # assert response
            assert "Upgrade" in update_data, update_data
            error_check_sys()
        else:
            print("There is an unexpected issue: it is not an upgrade")
            error_check_sys()
    elif is_element_present(
            wb_driver,
            "/html/body/app-root/app-admin-layout/md-sidenav-container/div[6]/div/app-update/md-card/div/div[4]/div/div"
    ):
        ui_element2 = wb_driver.find_element_by_xpath(
            "/html/body/app-root/app-admin-layout/md-sidenav-container/div[6]/div/app-update/md-card/div/div[4]/div/div"
        )
        update_data2 = ui_element2.text
        if "No" in update_data2:
            print("There is no update available")
            assert "No" in update_data2, update_data2
            error_check_sys()
        else:
            print(
                "There is an unexpected issue: something wrong with no update available element:"
                + update_data2)
            error_check_sys()
    else:
        print("There is an unexpected issue")
        error_check_sys()
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(wb_driver, script_name, test_name)
Exemplo n.º 24
0
def if_login_appear_enter_user_and_password(driver, user, password):
    """If login page appear enter "{user}" and "{password}"."""
    assert wait_on_element(driver, 5, '//input[@data-placeholder="Username"]')
    if is_element_present(driver, '//input[@data-placeholder="Username"]'):
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').send_keys(user)
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').send_keys(password)
        assert wait_on_element(driver, 7, '//button[@name="signin_button"]', 'clickable')
        driver.find_element_by_xpath('//button[@name="signin_button"]').click()
Exemplo n.º 25
0
def mysmbshare_should_be_added_click_on_service_and_the_service_page_should_open(
        driver, smbname):
    """"{smbname}" should be added, Click on service and the Service page should open."""
    if is_element_present(driver, '//h1[contains(.,"Enable service")]'):
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__ENABLE SERVICE"]').click()
        assert wait_on_element(driver, 5, '//h1[contains(.,"SMB Service")]')
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__CLOSE"]').click()
    assert wait_on_element(driver, 5, f'//div[contains(.,"mysmbshare")]')
    time.sleep(2)
Exemplo n.º 26
0
def test_05_set_destroy_data_and_Confirm_press_export_disconnect(browser):
    browser.find_element_by_xpath(xpaths['pooldestroyCheckbox']).click()
    browser.find_element_by_xpath(xpaths['poolconfirmCheckbox']).click()
    wait_on_element(browser, xpaths['confirmInput'])
    browser.find_element_by_xpath(xpaths['confirmInput']).send_keys(pool1)
    element_present = is_element_present(browser, xpaths['confirmButton'])
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    assert element_present, f'XPath Not Found: {xpaths["confirmButton"]}'
    browser.find_element_by_xpath(xpaths['confirmButton']).click()
Exemplo n.º 27
0
def click_advanced_and_input_truenas_servers_to_computer_account_ou(
        driver, ca_ou):
    """Click advanced, and input "{ca_ou}" to Computer Account OU."""
    if is_element_present(driver,
                          '//button[@ix-auto="button__ADVANCED OPTIONS"]'):
        driver.find_element_by_xpath(
            '//button[@ix-auto="button__ADVANCED OPTIONS"]').click()
    driver.find_element_by_xpath(
        '//input[@ix-auto="input__Computer Account OU"]').clear()
    driver.find_element_by_xpath(
        '//input[@ix-auto="input__Computer Account OU"]').send_keys(ca_ou)
Exemplo n.º 28
0
def make_sure_the_installed_tab_is_open(driver):
    """make sure the installed tab is open."""
    if is_element_present(
            driver,
            '//mat-ink-bar[@style="visibility: visible; left: 0px; width: 183px;"]'
    ) is False:
        assert wait_on_element(
            driver, 10, '//div[contains(text(),"Installed Applications")]',
            'clickable')
        driver.find_element_by_xpath(
            '//div[contains(text(),"Installed Applications")]').click()
Exemplo n.º 29
0
    def test_06_create_newuser_suggestedname(self):
        try:
            print(" creating a new user with suggested name")
            # Click User submenu
            driver.find_element_by_xpath(xpaths['submenuUser']).click()
            # cancelling the tour
            if function.is_element_present(driver, self, By.XPATH,
                                           '/html/body/div[6]/div[1]/button'):
                driver.find_element_by_xpath(
                    '/html/body/div[6]/div[1]/button').click()
            # scroll down to find hover tab
            driver.find_element_by_tag_name('html').send_keys(Keys.END)
            time.sleep(2)
            # Click create new user option
            driver.find_element_by_xpath(xpaths['fabAction']).click()
            # Enter User Full name
            driver.find_element_by_xpath(
                xpaths['newUserName']).send_keys(newuserfname)

            # not required since UI auto fills suggested username
            #            driver.find_element_by_xpath(xpaths['newUser']).clear()
            #            driver.find_element_by_xpath(xpaths['newUser']).send_keys(newusername)
            # Enter User email id

            driver.find_element_by_xpath(
                xpaths['newUserEmail']).send_keys(newuseremail)
            # Enter Password
            driver.find_element_by_xpath(
                xpaths['newUserPass']).send_keys(newuserpassword)
            # Enter Password Conf
            driver.find_element_by_xpath(
                xpaths['newUserPassConf']).send_keys(newuserpassword)
            # Click on create new User button
            if driver.find_element_by_xpath(xpaths['saveButton']):
                print("found the save button")
                driver.find_element_by_xpath(xpaths['saveButton']).click()
            else:
                print("could not find the save button and clicking")

            # check if there is a generic error when making a duplicate user, and print the error
            time.sleep(1)
            #taking screenshot
            function.screenshot(driver, self)
            self.error_check()
        except Exception:
            exc_info_p = traceback.format_exception(*sys.exc_info())
            #taking screenshot
            function.screenshot(driver, self)
            for i in range(1, len(exc_info_p)):
                print(exc_info_p[i].rstrip())
            self.assertEqual("Just for fail",
                             str(Exception),
                             msg="Test fail: Please check the traceback")
Exemplo n.º 30
0
def login_appear_enter_user_and_password(driver, user, password):
    """Login appear enter "{user}" and "{password}"."""
    if not is_element_present(driver, '//mat-list-item[@ix-auto="option__Dashboard"]'):
        wait_on_element(driver, 1, 10, '//input[@data-placeholder="Username"]')
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').send_keys(user)
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').send_keys(password)
        wait_on_element(driver, 0.5, 4, '//button[@name="signin_button"]')
        driver.find_element_by_xpath('//button[@name="signin_button"]').click()
    else:
        driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Dashboard"]').click()
Exemplo n.º 31
0
def if_login_page_appear_enter_root_and_password(driver, user, password):
    """If login page appear enter "{user}" and "{password}"."""
    if not is_element_present(driver, '//mat-list-item[@ix-auto="option__Dashboard"]'):
        assert wait_on_element(driver, 10, '//input[@data-placeholder="Username"]')
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Username"]').send_keys(user)
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').clear()
        driver.find_element_by_xpath('//input[@data-placeholder="Password"]').send_keys(password)
        assert wait_on_element(driver, 5, '//button[@name="signin_button"]', 'clickable')
        driver.find_element_by_xpath('//button[@name="signin_button"]').click()
    else:
        driver.find_element_by_xpath('//mat-list-item[@ix-auto="option__Dashboard"]').click()
Exemplo n.º 32
0
def test_05_verify_usernas_permit_sudo_is_true(browser):
    assert is_element_present(browser, xpaths['newuserUserMenu'])
    browser.find_element_by_xpath(xpaths['newuserUserMenu']).click()
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    ui_element = browser.find_element_by_xpath(xpaths['newuserPermitSudo'])
    # get the weather data
    page_data = ui_element.text
    # assert response
    assert page_data == "true", page_data
    browser.find_element_by_xpath(xpaths['newuserUserMenu']).click()
Exemplo n.º 33
0
def test_03_verify_usernas_email_changed(browser):
    assert is_element_present(browser, xpaths['newuserUserMenu'])
    browser.find_element_by_xpath(xpaths['newuserUserMenu']).click()
    # taking screenshot
    test_name = sys._getframe().f_code.co_name
    take_screenshot(browser, script_name, test_name)
    ui_element = browser.find_element_by_xpath(xpaths['newuserEmail'])
    # get the weather data
    page_data = ui_element.text
    # assert response
    assert page_data == "*****@*****.**", page_data
    browser.find_element_by_xpath(xpaths['newuserUserMenu']).click()
Exemplo n.º 34
0
 def test_05_create_duplicateuser(self):
     try:
         print(" creating a duplicate user")
         # Click User submenu
         driver.find_element_by_xpath(xpaths['submenuUser']).click()
         # cancelling the tour
         if function.is_element_present(driver, self, By.XPATH,
                                        '/html/body/div[6]/div[1]/button'):
             driver.find_element_by_xpath(
                 '/html/body/div[6]/div[1]/button').click()
         # scroll down to find hover tab
         driver.find_element_by_tag_name('html').send_keys(Keys.END)
         time.sleep(2)
         # Perform hover to show menu
         hover_element = driver.find_element_by_xpath(xpaths['fabTrigger'])
         hover = ActionChains(driver).move_to_element(hover_element)
         hover.perform()
         time.sleep(1)
         # Click create new user option
         driver.find_element_by_xpath(xpaths['fabAction']).click()
         # Enter New Username
         driver.find_element_by_xpath(
             xpaths['newUser']).send_keys(newusername)
         # Enter User Full name
         driver.find_element_by_xpath(
             xpaths['newUserName']).send_keys(newuserfname)
         # Enter Password
         driver.find_element_by_xpath(
             xpaths['newUserPass']).send_keys(newuserpassword)
         # Enter Password Conf
         driver.find_element_by_xpath(
             xpaths['newUserPassConf']).send_keys(newuserpassword)
         # Click on create new User button
         if driver.find_element_by_xpath(xpaths['saveButton']):
             print("found the save button")
             driver.find_element_by_xpath(xpaths['saveButton']).click()
         else:
             print("could not find the save button and clicking")
         #taking screenshot
         function.screenshot(driver, self)
         # check if there is a generic error when making a duplicate user, and print the error
         time.sleep(1)
         self.error_check()
     except Exception:
         exc_info_p = traceback.format_exception(*sys.exc_info())
         #taking screenshot
         function.screenshot(driver, self)
         for i in range(1, len(exc_info_p)):
             print(exc_info_p[i])
         self.assertEqual("Just for fail",
                          str(Exception),
                          msg="Test fail: Please check the traceback")
Exemplo n.º 35
0
    def test_06_create_newuser_suggestedname(self):
        try:
            print (" creating a new user with create new primary group")
            # cancelling the tour
            if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'):
                driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click()
            # scroll down to find hover tab
            driver.find_element_by_tag_name('html').send_keys(Keys.END)
            time.sleep(2)
            # Click create new user option
            driver.find_element_by_xpath(xpaths['fabAction']).click()
            # Enter User Full name
            driver.find_element_by_xpath(xpaths['newUserName']).send_keys(newuserfname)

            # not required since UI auto fills suggested username
#            driver.find_element_by_xpath(xpaths['newUser']).clear()
#            driver.find_element_by_xpath(xpaths['newUser']).send_keys(newusername)
            # Enter User email id

            driver.find_element_by_xpath(xpaths['newUserEmail']).send_keys(newuseremail)
            # Enter Password
            driver.find_element_by_xpath(xpaths['newUserPass']).send_keys(newuserpassword)
            # Enter Password Conf
            driver.find_element_by_xpath(xpaths['newUserPassConf']).send_keys(newuserpassword)
            # Click on create new User button
            if driver.find_element_by_xpath(xpaths['saveButton']):
                print ("found the save button")
                driver.find_element_by_xpath(xpaths['saveButton']).click()
            else:
                print ("could not find the save button and clicking")

            # check if there is a generic error when making a duplicate user, and print the error
            time.sleep(1)
            #taking screenshot
            function.screenshot(driver, self)
            self.error_check()
        except Exception:
            exc_info_p = traceback.format_exception(*sys.exc_info())
            #taking screenshot
            function.screenshot(driver, self)
            for i in range(1,len(exc_info_p)):
                print (exc_info_p[i].rstrip())
            self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")