Esempio n. 1
0
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.do_logout()
            x = driver.title
            assert x == 'abc'

        except AssertionError as error:
            print("Assertion error occurred")
            print(error)
            currentTimeStamp = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testName = utils.whoami()
            screenshotName = testName+"_"+currentTimeStamp
            allure.attach(self.driver.get_screenshot_as_png(), name=screenshotName,
                      attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file("/home/akash/PycharmProjects/AutomationFramework/screenshots/"+screenshotName+".png")
            raise

        except:
            print("There was an exception")
            raise

        else:
            print("No Exception raised")
Esempio n. 2
0
 def test_click_first_clock(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/catalog/accessories/8936")
     homepage = HomePage(driver)
     homepage.click_on_product_page_link_clock()
     URL = driver.current_url
     assert homepage.first_clock_link in URL
Esempio n. 3
0
 def test_click_on_product_page_link(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/catalog/phone/224")
     homepage = HomePage(driver)
     homepage.click_on_product_page_link()
     URL = driver.current_url
     assert homepage.first_telephone_link in URL
Esempio n. 4
0
class TestHome:



    def setup(self):
        chrome_options=Options()
        chrome_options.debugger_address = "127.0.0.1:9222"
        self.driver = webdriver.Chrome(options=chrome_options)
        # self.driver = webdriver.Chrome()
        self.driver.get("http://172.16.201.60:8099/#/user/login")
        self.login = LoginPage(self.driver)
        # self.login.login("yueye", "Datac@123456")

        self.home = HomePage(self.driver)
        self.home.goto_RanchInformationPage()
        # self.driver.get("http://172.16.201.60:8099/#/user/login")
        # self.login = LoginPage(self.driver)


    def test_3(self):
        print("test3")
        # self.home.goto_RanchInformationPage()

        assert 1 == 1

    def teardown(self):
        self.driver.quit()
Esempio n. 5
0
 def setup(self):
     self.basesetup = BaseSetup()
     driver = self.basesetup.setup()
     self.homepage = HomePage(driver)
     self.loginpage = LoginPage(driver)
     self.signuppage = SignUpPage(driver)
     self.gmailpage = GmailPage(driver)
Esempio n. 6
0
 def test_click_first_mac(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/catalog/notebook/1738/apple")
     homepage = HomePage(driver)
     homepage.click_on_first_mac()
     URL = driver.current_url
     assert homepage.first_mac_link in URL
Esempio n. 7
0
 def test_click_first_audio(self):
     driver = self.driver
     driver.get(
         "https://www.svyaznoy.ru/catalog/audiovideo/1558/tag/besprovodnye")
     homepage = HomePage(driver)
     homepage.click_on_first_audio()
     URL = driver.current_url
     assert homepage.first_audio_link in URL
Esempio n. 8
0
class SignUpLoginFeature(BaseSetup):
    def setup(self):
        self.basesetup = BaseSetup()
        driver = self.basesetup.setup()
        self.homepage = HomePage(driver)
        self.loginpage = LoginPage(driver)
        self.signuppage = SignUpPage(driver)
        self.gmailpage = GmailPage(driver)

    def verify_if_login_page_is_displayed(self):
        if self.loginpage.salesforce_logo():
            print('SalesForce Login page is displayed..')
        else:
            print('SalesForce Login Page is not displayed')

    def verify_signup_functionality(self):
        self.loginpage.signup_link()
        print('Navigated to SignUp Page')
        self.signuppage.enter_firstName()
        print('Entered First Name')
        self.signuppage.enter_lastName()
        print('Entered Last Name')
        self.signuppage.enter_jobTitle()
        print('Entered Job Title')
        self.signuppage.enter_email()
        print('Entered Email')
        self.signuppage.enter_phone()
        print('Entered Phone number')
        self.signuppage.enter_company()
        print('Entered Company name')
        self.signuppage.select_number_of_employees()
        print('Chose the number of employees')
        # self.signuppage.select_state()
        # print('Chose the state')
        self.signuppage.agree_privacy()
        print('Checked the Privacy Policy')
        self.signuppage.click_free_trial()
        print('Created user has auto logged in')

    def verify_signedup_user_is_logged_in(self):
        if self.homepage.verify_header():
            print('SalesForce Header is displayed')
        if self.homepage.verify_page_title():
            print('User is logged in and Home Page with Dashboard is viewed')

    def verify_login_functionality(self):
        self.loginpage.username_login()
        print('Enter SalesForce Username')
        self.loginpage.password_login()
        print('Enter SalesForce Password')
        self.loginpage.login()

    def enter_verification_code(self, code):
        self.loginpage.verification_code(code)
        print('Enter the Verification Code obtained from GMail')

    def tear_down(self):
        self.basesetup.tear_down()
Esempio n. 9
0
    def test_login_valid(self):
        driver = self.driver
        driver.get(utils.URL)

        homepage = HomePage(driver)
        homepage.click_login_link()

        login = LoginPage(driver)
        login.enter_username(utils.USERNAME)
        login.enter_password(utils.PASSWORD)
        login.click_login()
Esempio n. 10
0
    def setup(self):
        chrome_options=Options()
        chrome_options.debugger_address = "127.0.0.1:9222"
        self.driver = webdriver.Chrome(options=chrome_options)
        # self.driver = webdriver.Chrome()
        self.driver.get("http://172.16.201.60:8099/#/user/login")
        self.login = LoginPage(self.driver)
        # self.login.login("yueye", "Datac@123456")

        self.home = HomePage(self.driver)
        self.home.goto_RanchInformationPage()
Esempio n. 11
0
 def test_home(self):
     Log().info('----------主页测试开始----------')
     self.login_action()  # 重新调用一下登录页面
     hp = HomePage(self.driver)
     hp.home_page()
     result = self.base_driver.get_element_text(hp.get_assertion_ele(), '跳转到应用主页,获取断言文本')
     if result != '我的申请':
         self.save_screenshot('主页断言失败')
     self.assertEqual(result, '我的申请', msg='主页断言失败,实际值{}与期望值{}不符'.format(result, '我的申请'))
     Log().info('----------主页测试通过----------')
     Log().info('----------测试完成----------')
    def test_login(self):
        driver = self.driver
        driver.get(Variables.naukri_homepage_url)
        WebDriverUtil.close_all_popup_windows(driver)

        login_drawer = LoginDrawer(driver)
        login_drawer.click_loginLayer_tab()
        login_drawer.enter_username(Variables.naukri_email_id)
        login_drawer.enter_password(Variables.naukri_password)
        login_drawer.click_login_button()

        home_page = HomePage(driver)
        home_page.check_profileSection_card()
Esempio n. 13
0
 def test_place_cursor_telephone_btn(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/")
     homepage = HomePage(driver)
     homepage.close_pop_up()
     homepage.click_catalog()
     homepage.place_cursor_telephone_btn()
     assert self.driver.find_element_by_xpath(homepage.hover_telephone_btn)
Esempio n. 14
0
 def test_scroll_down_assert_footer(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/")
     homepage = HomePage(driver)
     page = driver.find_element_by_tag_name("html")
     page.send_keys(Keys.END)
     assert driver.find_element_by_xpath(homepage.footer_block)
Esempio n. 15
0
    def test_login(self, username, password):
        """Sign in to the website"""
        driver = self.driver
        driver.get(utils.URL)
        login = LoginPage(driver)
        homepage = HomePage(driver)
        login_page_asserts = LoginAsserts(driver)

        time.sleep(3)
        login_page_asserts.panel_header_check()
        login_page_asserts.assert_login_page_contains_logo_image()
        login_page_asserts.assert_forgot_password_link_displayed()

        login.login_crm_system(username, password)
        login.click_login_button()
        homepage.check_dashboard_visibility()
Esempio n. 16
0
def before_all(context):
    #checks config.py to determine proper browser
    browser = str.lower(config.browser)
    if browser == "firefox":
        driver = webdriver.Firefox()
    elif browser == "chrome":
        driver = webdriver.Chrome("./chromedriver")
    elif browser == "ie":
        driver = webdriver.Ie("./selenium-server-standalone-2.48.2.jar")
    else:
        raise Exception(
            "No appropriate browser selected, please check config.py")

    #navigates to home page
    currentPage = HomePage(driver)
    try:
        #wait for inital page to load
        element = WebDriverWait(driver, 10).until(
            EC.element_to_be_clickable((By.LINK_TEXT, "January")))
    except:
        #if loading fails then quit
        driver.quit()
        raise

    #add browser and currentpage to context
    context.browser = driver
    context.currentPage = currentPage
Esempio n. 17
0
    def test_login_valid(self):
        driver = self.driver

        driver.get("https://www.svyaznoy.ru/")

        homepage = HomePage(driver)
        homepage.click_login_button()

        login = LoginPage(driver)
        login.enter_username("*****@*****.**")
        login.enter_password("123456Pp")
        login.click_login2()

        wait = WebDriverWait(self.driver, 10)
        assert self.driver.find_element_by_class_name(
            'b-personal__board-name').text == "Dan"
Esempio n. 18
0
    def test_login_invalid_password(self):
        driver = self.driver

        driver.get("https://www.svyaznoy.ru/")

        homepage = HomePage(driver)
        homepage.click_login_button()

        login = LoginPage(driver)
        login.enter_username("*****@*****.**")
        login.enter_password("123456")
        login.click_login2()

        wait = WebDriverWait(self.driver, 10)
        assert self.driver.find_element_by_xpath(
            "//span[@id='user[username]-error']"
        ).text == "Логин или пароль неверен"
Esempio n. 19
0
    def test_login_emptyfield_password(self):
        driver = self.driver

        driver.get("https://www.svyaznoy.ru/")

        homepage = HomePage(driver)
        homepage.click_login_button()

        login = LoginPage(driver)
        login.enter_username("*****@*****.**")
        login.enter_password("")
        login.click_login2()

        wait = WebDriverWait(self.driver, 10)
        assert self.driver.find_element_by_xpath(
            "//span[@id='user[password]-error']"
        ).text == "Это поле необходимо заполнить."
Esempio n. 20
0
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_logout_link()
            x = driver.title
            assert x == 'Redmine demo'

        except AssertionError as error:
            print("Assertion error occurred")
            print(error)
            curr_time = moment.now().strftime('%H-%M-%S_%m-%d-%Y')
            test_name = utils.whoami()
            screenshot_name = test_name + '_' + curr_time
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshot_name,
                          attachment_type=allure.attachment_type.PNG)
            driver = self.driver
            driver.get_screenshot_as_file(
                '/Users/alionap/PycharmProjects/AutomationFramework_1/screenshots/'
                + screenshot_name + '.png')
            raise
        except:
            print('There was an exception')
            curr_time = moment.now().strftime('%H-%M-%S_%m-%d-%Y')
            test_name = utils.whoami()
            screenshot_name = test_name + '_' + curr_time
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshot_name,
                          attachment_type=allure.attachment_type.PNG)
            driver = self.driver
            driver.get_screenshot_as_file(
                '/Users/alionap/PycharmProjects/AutomationFramework_1/screenshots/'
                + screenshot_name + '.png')
            raise

        else:
            print('No exceptions occurred')

        finally:
            print('I am inside finally block')
Esempio n. 21
0
 def test_logout(self):
     try:
         driver = self.driver
         homepage = HomePage(driver)
         homepage.click_welcome()
         time.sleep(5)
         homepage.click_logout()
         x = driver.title
         assert x == "OrangeHRM1"
     except AssertionError as e:
         print("there was an assertion error")
         print(e)
         testName = utils.whoami() + str(datetime.now())
         allure.attach(self.driver.get_screenshot_as_file(),
                       name=testName,
                       attachment_type=allure.attachment_type.PNG)
         driver.get_screenshot_as_file(
             "C:/Users/Ernest/PycharmProjects/AutomationFramework/screenshots/"
             + testName + '.png')
         raise
     except:
         print("there was an exception")
         raise
     else:
         print("no exception")
     finally:
         print("I am inside finally")
    def test_logout(self, test_setup):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_welcome()
            homepage.click_logout()
            x = driver.title
            print(x)
            assert x == "OrangeHRM"
        except AssertionError as error:
            print("Assertion error occurred")
            print(error)
            currTime = moment.now().strftime("%H-%M-%S_%m-%d-%Y")
            testName = utils.whoami()
            screenshotName = testName + "_" + currTime
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshotName,
                          attachment_type=allure.attachment_type.PNG)

            utils.save_screenshot(driver, screenshotName)
            raise
        except:
            print("Some exception occurred")
            allure.attach(self.driver.get_screenshot_as_png(),
                          name="screenshot_",
                          attachment_type=allure.attachment_type.PNG)
            raise

        else:
            print("No exceptions occurred")
        finally:
            print("This block will always execute | Close DB")
Esempio n. 23
0
 def test_logout(self):
     driver = self.driver
     homepage = HomePage(driver)
     homepage.click_welcome()
     homepage.click_logout()
     x = driver.title
     assert x == "OrangeHRM"
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_welcome()
            homepage.click_logout()
            x = driver.title
            assert x == "abc"

        except AssertionError as error:
            print("assertion error occured")
            print(error)

            allure.attach(self.driver.get_screenshot_as_png(),
                          name="screenshot",
                          attachment_type=allure.attachment_type.PNG)
            raise

        except:
            print("There was an exception")
            raise
        else:
            print("No exceptions occured")

        finally:
            print("I am inside finally block")
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_welcome()
            homepage.click_logout()
            x = driver.title
            assert x == "BCXOrangeHRM"

        except AssertionError as error:
            print("Assertion error occured")
            print(error)
            current_time = datetime.now().strftime("%d-%m-%Y_%H-%M-%S")
            testname = utils.whoami()
            screenshotName = testname + current_time
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshotName,
                          attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file(
                "C:/Users/sa53/PycharmProjects/FrameworkPrac1/screenshots/" +
                screenshotName + ".png")
            raise

        except:
            print("there was an exception ")
            raise
        else:
            print("no exception")

        finally:
            print("i am inside finally block")
 def test_logout(self):
     try:
         driver = self.driver
         homepage = HomePage(driver)
         time.sleep(5)
         homepage.click_welcome()
         homepage.click_logout()
         x = driver.title
         assert x == "OrangeHRM"
     except AssertionError as error:
         print("Assertion error occured")
         print(error)
         currTime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
         testName = utils.whoami()
         screenshotName = testName + "_" + currTime
         allure.attach(self.driver.get_screenshot_as_png(),
                       name=screenshotName,
                       attachment_type=allure.attachment_type.PNG)
         driver.get_screenshot_as_file(
             "C:/Users/Vinay/PycharmProjects/AutomationFramework_1/screenshot/"
             + screenshotName + ".png")
         raise
     except:
         print("There was an exception")
         currTime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
         testName = utils.whoami()
         screenshotName = testName + "_" + currTime
         allure.attach(self.driver.get_screenshot_as_png(),
                       name=screenshotName,
                       attachment_type=allure.attachment_type.PNG)
         raise
     else:
         print("No exception occured")
     finally:
         print("Test Completed successfully ")
Esempio n. 27
0
 def test_wish_list(self):
     driver = self.driver
     driver.get("https://www.svyaznoy.ru/")
     homepage = HomePage(driver)
     homepage.close_pop_up()
     homepage.click_wish_list()
     assert driver.find_element_by_xpath(homepage.drop_down_wish_list)
Esempio n. 28
0
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_admin()
            homepage.click_logout()
            x = driver.title
            assert x == "Dalet Brio Web Portal"

        except AssertionError as error:
            print("Assertion error occurred")
            print(error)
            currTime = x = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testName = utils.whoami()
            screenshotName = testName + "_" + currTime
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshotName,
                          attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file(
                "C:/Users/obulgakova/PycharmProjects/AutoWork_1/screenshots/" +
                screenshotName + ".png")
            raise

        except:
            print("There was am exception")

        else:
            print("No exception occured")

        finally:
            print("I am inside finally block")
Esempio n. 29
0
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            homepage.click_welcome()
            homepage.click_logout()
            title = driver.title
            assert title == "abc"

        except AssertionError as error:
            print("Assertion error occured")
            print(error)
            currTime = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            testName = utils.whoami()
            screenshotName = testName + "_" + currTime
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshotName,
                          attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file(
                "/Users/bobit/PycharmProjects/Pytest_Framework/screenshots/" +
                screenshotName + ".png")

            raise
        except:
            print("There was an exception in test_logout function")
            raise
        else:
            print("No exceptions occured")
        finally:
            print("I am inside the finally block")
Esempio n. 30
0
    def test_logout(self):
        try:
            driver = self.driver
            homepage = HomePage(driver)
            time.sleep(2)
            homepage.click_on_welcomedrpdwn()
            time.sleep(2)
            homepage.click_on_logout_button()
            x = driver.title
            assert x == 'OrangeHRM'
        except AssertionError:
            print('I knew my Mistake')
            currenttime = moment.now().strftime("%H-%M-%S_%d-%m_%Y")
            testname = utils.whoami()
            screenshot = testname + "_" + currenttime
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshot,
                          attachment_type=allure.attachment_type.PNG)
            driver.get_screenshot_as_file(
                'C:\\Users\\Muhammad.yaseen\\PycharmProjects\\Workspace_python\\Seleniumframework\\screenshots '
                + screenshot + " .png")
            raise
        except:
            print('no exception ocurred')
            currenttime = moment.now().strftime("%H-%M-%S_%d%m_%Y")
            testname = utils.whoami()
            screenshot = testname + "_" + currenttime
            allure.attach(self.driver.get_screenshot_as_png(),
                          name=screenshot,
                          attachment_type=allure.attachment_type.PNG)
            raise

        finally:
            print('i will execute anyway')