Exemple #1
0
 def setUp(self):
     self.check = True
     self.driver = Selenium()
     self.driver.init()
     self.driver.open_link(self.test_url)
     self.home_page = HomePage(self.driver)
     self.login_page = LoginPage(self.driver)
Exemple #2
0
    def login_to_app(self, driver):
        qa_sandbox_page = QASandboxPage(driver)
        qa_sandbox_page.login_btn.click()

        login_page = LoginPage(driver)
        login_page.login("*****@*****.**", "lINKINpARK06")

        return DashboardPage(driver)
    def test_login_to_sandbox(self):
        qa_sandbox_page = QASandboxPage(self.driver)
        qa_sandbox_page.login_btn.click()
        login_page = LoginPage(self.driver)
        login_page.login("*****@*****.**", "lINKINpARK06")

        dashboard_page = DashboardPage(self.driver)

        assert "Stančić Milan" == dashboard_page.profile_card_title, "Incorrect user is logged in application."
Exemple #4
0
 def setUp(self):
     self.driver = webdriver.Firefox()
     self.driver.get("https://qa-sandbox.apps.htec.rs/dashboard")
     loginFromContainer = self.driver.find_element_by_class_name('btn-secondary')
     loginFromContainer.click()
     WebDriverWait(self.driver, 10).until(
         ExpectedConditions.visibility_of_element_located((By.CSS_SELECTOR, "button[data-testid='submit_btn']"))
     )
     loginPage = LoginPage(self.driver)
     loginPage.enter_login_credentials("*****@*****.**", "lINKINpARK06")
     loginPage.submitButton.click()
    def test_validate_inputs(self):
        qa_sandbox_page = QASandboxPage(self.driver)
        qa_sandbox_page.login_btn.click()
        login_page = LoginPage(self.driver)
        login_page.submit_btn.click()

        email_incorrect = "*****@*****.**"
        email_correct = "*****@*****.**"
        password_incorrect = "Password incorrect"
        password_upper_case = "LINKINPARK06"
        password_short = "pass"

        # Empty email and password fields
        assert login_page.find_email_validation_message("Email field is required"), \
            "Validation error message is not visible for empty email."
        assert login_page.find_password_validation_message("Password is required"), \
            "Validation error message is not visible for empty password."

        # Incorrect user and password
        assert login_page.check_validation(email_incorrect, password_incorrect, "User not found"), \
            "Validation error message is not visible for non existing user."

        # Incorrect password with valid user
        assert login_page.check_validation(email_correct, password_incorrect, password_incorrect), \
            "Validation error message is not visible for incorrect password."

        # Check password for case sensitivity with valid user
        assert login_page.check_validation(email_correct, password_upper_case, password_incorrect), \
            "Password is not case sensitive or there isn't expected validation."

        # password must be at least 6 characters long valid user
        assert login_page.check_validation(email_correct, password_short, "Password must be at least 6 characters long"),\
            "Validation for minimum password length is not visible."
Exemple #6
0
 def test_other(self):
     LoginPage(self.driver).login_as_user(
         self.employees['other'].get_email())
     if element_exists(self.driver,
                       SearchPageLocators.button_show_search_form):
         self.fail(
             "Zaměstnanci je přístupno vyhledávání i když není ničím nadřízeným!"
         )
Exemple #7
0
 def test_tracking_link_with_referrer(self):
     driver = self.driver
     wait = WebDriverWait(self.driver, 10)
     # TODO: как вынести объявления классов отдельно (в BaseTest)
     login = LoginPage(driver)
     creds = Credentials()
     helper = Helper(driver)
     urls = Urls()
     login.login_as_user(creds.admin_login, creds.admin_pw)
     # TODO: перенести wait.until отдельно (в пейдж обджект?)
     wait.until(
         ec.visibility_of_element_located(
             (By.XPATH, '//redirect-to-new-app')))
     side_menu = Sidemenu(driver)
     # side_menu.click_see_new_view_link()
     # time.sleep(3)
     helper.open_url(driver,
                     urls.domain_dev + urls.atl + urls.aff_campaigns)
     # time.sleep(5)
     wait.until(ec.visibility_of_element_located(
         (By.XPATH, '(//input)[2]')))
     aff_campaigns = AffCampaigns(driver)
     aff_campaigns.fill_search_input("AutoTest - affiliateAuto - tracking")
     aff_campaigns.click_apply_button()
     wait.until(
         ec.visibility_of_element_located(
             (By.XPATH, '//a[@title="View Campaign"]')))
     # TODO:
     time.sleep(5)
     # helper.wait_for_page_load()
     # aff_campaigns.is_aff_camp_name_exists()
     # print("len is " + str(aff_campaigns.get_aff_camp_names_len()) + " " + aff_campaigns.get_aff_camp_name_text())
     aff_campaigns.click_aff_camp_name()
     wait.until(
         ec.visibility_of_element_located(
             (By.XPATH, '(//*[@qa_id="link_tracking-link"])[1]')))
     # time.sleep(2)
     # helper.wait_for_page_load()
     aff_camp_view = AffCampaignView(driver)
     aff_camp_view.click_tracking_link_first()
     helper.switch_to_new_tab()
     aff_camp_view.send_ftd()
     helper.close_current_browser_tab()
Exemple #8
0
 def test_superior(self):
     email_superior = self.employees['superior'].get_email()
     LoginPage(self.driver).login_as_user(email_superior)
     error = "Nadřízený %s nevidí svého podřízeného %s!"
     self.verify_user(
         True, email_superior, self.employees['subordinate'].get_inquiry()
         ['part1']['birth_number'], error)
     error = "Nadřízený %s vidí zaměstnance %s, jehož není nadřízeným!"
     self.verify_user(
         False, email_superior,
         self.employees['other'].get_inquiry()['part1']['birth_number'],
         error)
     error = "Nadřízený %s vidí zaměstnance %s, jehož není nadřízeným! Tento zaměstnanec je nadřízeným své pozice!"
     self.verify_user(
         False, email_superior,
         self.employees['otherSuperior'].get_inquiry()['part1']
         ['birth_number'], error)
Exemple #9
0
 def test_other_superior(self):
     email_other_superior = self.employees['otherSuperior'].get_email()
     LoginPage(self.driver).login_as_user(email_other_superior)
     error = "Zaměstnanec %s vidí jiného zaměstnance %s! Tento zaměstnanec není ničím nadřízeným a je podřízeným jiného zaměstnance!"
     self.verify_user(
         False, email_other_superior,
         self.employees['subordinate'].get_inquiry()['part1']
         ['birth_number'], error)
     error = "Zaměstnanec %s vidí jiného zaměstnance %s! Tento zaměstnanec není níčím nadřízeným ani podřízeným!"
     self.verify_user(
         False, email_other_superior,
         self.employees['other'].get_inquiry()['part1']['birth_number'],
         error)
     error = "Zaměstnanec %s vidí jiného zaměstnance %s! Tento Zaměstnanec je něčím nadřízeným!"
     self.verify_user(
         False, email_other_superior,
         self.employees['superior'].get_inquiry()['part1']['birth_number'],
         error)
Exemple #10
0
 def setUpClass(cls):
     super().setUpClass()
     cls.create_data()
     if cls.createFail is None:
         try:
             LoginPage(cls.driver).login_as_user(cls.employees['superior'].get_email())
             MenuEmployeesPage(cls.driver).click_link_employees()
             EmployeesPage(cls.driver).find_employee("no-employments", None, cls.company, cls.employees['subordinate'].get_id())
             EmployeeCardPage(cls.driver).add_employment(cls.company)
             cls.employment_page = NewEmployment1Page(cls.driver)
             cls.employment_page.select_radio_type(cls.test_data['type'])
             cls.employment_page.fill_field_start_date(cls.test_data['start_date'])
             cls.employment_page.fill_filed_boarding_date(cls.test_data['boarding_date'])
         except Exception as e:
             cls.createFail = str(e)
             cls.driver.quit()
     else:
         cls.driver.quit()
Exemple #11
0
class LoginTest(unittest.TestCase):
    # get script name
    basename = gl.get_value('basename')
    # screenshot folder path
    folderpath = gl.get_value('screenshot_path')

    device = conf.get('BrowserInfo', 'device')

    check = True
    test_url = gl.get_value('test_url')

    def setUp(self):
        self.check = True
        self.driver = Selenium()
        self.driver.init()
        self.driver.open_link(self.test_url)
        self.home_page = HomePage(self.driver)
        self.login_page = LoginPage(self.driver)

    def tearDown(self):
        if self.check == False:
            picture_name = self.basename + "(" + self.id().split('.')[-1] + ")"
            ss = ScreenShot(self.driver, self.folderpath, picture_name)
            ss.screenshot()
        self.driver.quit()

    def test_login(self):
        try:
            self.home_page.click_button("sign_in_button")
            self.login_page.input_element_text('username',
                                               "*****@*****.**")
            self.login_page.input_element_text('password', "25178489test")
            self.login_page.click_button('submit')
            self.home_page.click_button('avatar_img')

            if "test25178489" in self.home_page.get_element_text('user_name'):
                print("pass")
            else:
                print("username= " +
                      self.home_page.get_element_text('user_name'))
                raise Exception
        except Exception:
            self.check = False
            raise
Exemple #12
0
 def setUp(self):
     super().setUp()
     self.driver = super().run_driver()
     self.driver = EventFiringWebDriver(
         self.driver, ScreenshotListener(self._testMethodName))
     LoginPage(self.driver).login_as_super_admin()
Exemple #13
0
 def test1(self):
     driver = self.driver
     base = BaseTest(driver)
     base.setUp()
     login = LoginPage(driver)
     login.login_as_user(self, "root", "OLS46J25ZQ0fns0Oq6")
Exemple #14
0
def test_login_IE(env):

    test_case = "test_login_IE"
    # driver = browser

    # Create Time Stamp Variable (using Date Time Generator Class in utilities)
    dg = date_time_generator()
    time_stamp = dg.return_time_stamp()

    # Declare csv directory
    # csv_directory = str(test_case_directory / test_case) + ".csv"

    # CSV Reader
    # Read in username, password and env variables
    with open(csv_directory) as f:
        rows = list(csv.reader(f))
        test_scenario = rows[3][0]
        username = rows[3][1]
        password = rows[3][2]
        account_number = rows[3][3]

    cap = DesiredCapabilities.INTERNETEXPLORER.copy()
    # cap['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
    # cap['nativeEvents'] = False
    cap['IE_ENSURE_CLEAN_SESSION'] = True
    cap['ENABLE_ELEMENT_CACHE_CLEANUP'] = True

    # cap['pageLoadStrategy'] = 'eager'

    driver = webdriver.Ie(str(CONFIG_PATH / 'IEDriverServer.exe'))

    ## Select Appropriate URL based on the Environment Value (env)

    # env = "BICL_UAT"
    baseURL = Environments.return_environments(env)
    # baseURL = "https://beta.bi.dev.wedbush.com"

    driver.get(baseURL)
    driver.maximize_window()

    # This section closes extra open window tabs
    handles = driver.window_handles
    size = len(handles)
    parent_handle = driver.current_window_handle
    for x in range(size):
        if handles[x] != parent_handle:
            driver.switch_to.window(handles[x])
            print(driver.title)
            driver.close()
        else:
            driver.switch_to.window(parent_handle)
            print(driver.title)

    time.sleep(5)

    # If IE browser, click More Information \ Proceed to Website
    more_information_link = driver.find_element(By.LINK_TEXT,
                                                "More information")
    ActionChains(driver).move_to_element(more_information_link).perform()
    more_information_link.click()
    time.sleep(5)

    # IESNS = IE_Site_Not_Secure(driver)
    # proceed_link = driver.find_element(By.ID, "overridelink")
    # IESNS.locate_click_proceed_link_action_chains(proceed_link)

    # Workaround to click "Override Link" -K.V. 5-20-19
    proceed_link = driver.find_element(By.ID, "overridelink")
    ActionChains(driver).move_to_element(proceed_link).perform()
    proceed_link.click()

    time.sleep(5)

    # Login to Site
    lp = LoginPage(driver)

    # Verify if UserName field displays, if not, throw exception and take screenshot
    try:
        username_field = lp.Page_Elements().driver.find_element_by_id(
            "UserName")
        username_field.click()
    except NoSuchElementException:
        screenshot_name = "FAIL" + "_" + test_scenario + "_" + env + "_" + time_stamp + ".png"
        saved_screenshot_location = str(screenshot_directory / screenshot_name)
        driver.get_screenshot_as_file(saved_screenshot_location)
        raise

    # enter username and password
    lp.IE_login(username, password)

    # Note: Script would hang after clicking "Login" button
    # to fix this, I added an IE_login() method with the following lines
    # ...send_keys(Keys.TAB)
    # ...send_keys(Keys.ENTER)
    #
    # Script works with this update -- K.V 5-2-19

    # Added wait because script cannot find "user_drop_down_element --K.V. 5-2-19
    time.sleep(10)

    # Take screenshot and save to utilities/test_results/screenshots
    screenshot_name = test_scenario + "_" + env + "_" + time_stamp + ".png"
    saved_screenshot_location = str(screenshot_directory / screenshot_name)
    driver.get_screenshot_as_file(saved_screenshot_location)

    # Move Mouse to User Drop Down (Upper Right Corner)
    user_drop_down = driver.find_element(
        By.XPATH, "/html/body/div[1]/header/div[3]/i[2]")
    ActionChains(driver).move_to_element(user_drop_down).perform()

    # Click Logout, if not, throw exception and take screenshot
    logout_link = driver.find_element(
        By.XPATH, "/html/body/div[1]/header/div[3]/div/ul/li/a")
    # ActionChains(driver).move_to_element(logout_link).perform()
    logout_link.click()

    time.sleep(10)

    # For IE Browser, Force Navigate to Logout page
    # Logout Workaround -K.V. --5-20-19
    # current_url = driver.current_url
    # slashparts = current_url.split('/')
    # Now join back the first three sections 'http:', '' and 'example.com'
    # new_base_url = '/'.join(slashparts[:3]) + '/'
    # logout_string = "/user/login?logout=1"
    # logout_screen = new_base_url + logout_string
    # driver.get(logout_screen)

    # IE-Specific Logout

    # Click User Drop Down
    # IEU = IE_User_Drop_Down(driver)
    # user_drop_down = driver.find_element(By.XPATH, "/html/body/div[1]/header/div[3]/i[2]")
    # ActionChains(driver).move_to_element(user_drop_down).perform()
    # user_drop_down.click()

    # Click Logout
    # logout_link = driver.find_element(By.XPATH, "/html/body/div[1]/header/div[3]/div/ul/li/a")
    # ActionChains(driver).move_to_element(logout_link).perform()
    # logout_link.click()

    # Close Browser
    driver.close()
 def setUpClass(cls):
     cls.driver = super().run_driver()
     LoginPage(cls.driver).login_as_super_admin()
Exemple #16
0
 def test_login_negative(self, username, password):
     LoginPage(self.driver).test_basic_negative(username, password)
 def tearDownClass(cls):
     cls.driver = super().run_driver()
     LoginPage(cls.driver).login_as_super_admin()
     super().delete_users(cls.driver, cls.employees)
     super().delete_company(cls.driver, cls.ico)
     cls.driver.quit()
Exemple #18
0
 def test21(self):
     driver = self.driver
     login = LoginPage(driver)
     login.login_as_user("root", "OLS46J25ZQ0fns0Oq6")
     side_menu = Sidemenu(driver)
     assert side_menu.is_user_role_exists()
Exemple #19
0
 def setUp(self):
     super().setUp()
     self.driver = super().run_driver()
     LoginPage(self.driver).login_as_super_admin()
     MenuAttendancePage(self.driver).click_link_plan()
Exemple #20
0
 def test1(self):
     driver = self.driver
     login = LoginPage(driver)
     login.login_as_user("", "OLS46J25ZQ0fns0Oq6")
     side_menu = Sidemenu(driver)
     assert not side_menu.is_sidebar_exists()