Exemple #1
0
    def test_press_login_btn(self):

        time.sleep(3)

        btn = HomePage(self.driver)

        btn.enter_login_page()
def verify_greeting(context):
    try:
        home_page = HomePage(context.driver)
        home_page.verify_greeting(context.username)
    except Exception as e:
        logging.error(e)
        raise e
Exemple #3
0
    def test_e2e(self):

        log = self.getlogger()

        homePage = HomePage(self.driver)
        log.info("get all the items of mobiles")
        log.info("getall items of all mobiles")
        log.info("print all demos")
        log.info("values1")
        log.info("values2")
        log.info("values3")
        log.info("values4")
        checkoutPageObject = homePage.shopItems()
        products = checkoutPageObject.mobileelements()
        for product in products:
            productscheck = CheckOutPage(product)
            productname = productscheck.mobilename().text
            log.info(productname)
            if (productname == "Blackberry"):

                productscheck.AddMobile().click()
                break

        checkoutPageObject.AddBlackBerry().click()
        ConfirmOrder = checkoutPageObject.ConfirmCheckOut()
        log.info("enter country Name as India ")
        ConfirmOrder.CountryName().send_keys("ind")
        self.VerifyLinkPresence("India")
        ConfirmOrder.ProvideCountry().click()
        ConfirmOrder.AcceptConditions().click()
        ConfirmOrder.Purchase().click()
        textMatch = ConfirmOrder.Alert().text
        #print(textMatch)
        #log.info("Text received from application is "+textMatch)
        assert "Success!" in textMatch
Exemple #4
0
    def test_press_register_btn(self):

        time.sleep(3)

        btn = HomePage(self.driver)

        btn.enter_register_page()
Exemple #5
0
    def test_shoppingCart(self):
        homepage = HomePage(self.driver)
        homepage.shopItem().click()
        log = self.getLogger()
        log.info("Clicking on shop Button :")

        checkout = CheckOut(self.driver)
        checkout.ShopPhone().click()
        log.info("Clicking on the product to be purchased ")
        Product_text = self.driver.find_element_by_link_text("iphone X").text
        assert "iphone X" == Product_text
        log.info("The product selected is : " + Product_text)

        confirm_CheckOut = Checkout(self.driver)
        confirm_CheckOut.CheckoutConfirmation().click()
        log.info("Final Checkout is done :")

        confirm_address = AddressConfirmation(self.driver)
        confirm_address.address_confirmtion().click()

        successMsg = FinalCheckout(self.driver)
        successText = successMsg.alertSuccess().text
        assert "Success! Thank you!" in successText
        log.info("Alert received after successful placement of order : " +
                 successText)
    def test_e2e(self):

        log = self.getlogger()
        homepage = HomePage(self.driver)                   # Homepage

        shoppingpage = homepage.click_shoppingpage()       # Shopping page

        log.info("Getting all the cards title")
        cards = shoppingpage.getcardtitle()
        # print("No of cards on this page is : ", len(cards))
        for card in cards:
            cardText = card.text
            log.info(cardText)
            if cardText == "Blackberry":
                shoppingpage.add_itemincard().click()
                print("Selected card is ", cardText)

        checkoutpage = shoppingpage.click_checkoutpage()     # Checkout page

        confirmpage = checkoutpage.finalcheckout()           # Confirm page
        log.info("Entering Country name")
        confirmpage.enter_countryname().send_keys("ind")

        self.valifylinkpresence("India")
        confirmpage.select_country().click()
        confirmpage.click_checkbox().click()
        confirmpage.click_topurchage().click()

        alert_text = confirmpage.get_alert().text
        print(alert_text)
        log.info(alert_text)
        assert "Success" in alert_text

        confirmpage.get_screenshot()
Exemple #7
0
 def setup_method(self):
     self.browser = webdriver.Chrome(
         executable_path="../Drivers/chromedriver")
     self.testData = json.loads(open("../TestData/data.json").read())
     self.browser.set_window_size(1600, 1200)
     self.home_page = HomePage()
     self.search_result_page = SearchResultPage()
     self.home_page.go_to_url(self.browser, self.testData["homePageUrl"])
    def test_05_Bar_click(self):
        '''主页操作并退出'''
        HomePage().home_click()
        HomePage().baidu_click()
        HomePage().webview_click()
        HomePage().personal_click()
        HomePage().personal_logout_click()

        LoginPage.LoginPage().wait_page()
 def test_add_new_hotLaunchSourceID(self, get_hotLaunchSourceId):
     #add a new category
     HOME_PAGE = HomePage(self.driver)
     log.info("Login and goto Homepage")
     CATALOG_PAGE = HOME_PAGE.goto_add_category()
     log.info("Goto Add Category")
     CATALOG_PAGE.add_and_publish_category(get_hotLaunchSourceId["hlsId"])
     log.info("Add a new category and publish it")
     #delete category
     HOME_PAGE.goto_list_categories()
     CATALOG_PAGE.delete_category(get_hotLaunchSourceId["hlsId"])
    def test_stb_config_add(self):

        # add stb config
        HOME_PAGE = HomePage(self.driver)
        STB_CONFIG_ADD_PAGE = HOME_PAGE.goto_add_stbConfig_page()
        STB_CONFIG_ADD_PAGE.add_stb_config()
        STB_CONFIG_ADD_PAGE.get_stb_configuration_list()
        STB_CONFIG_ADD_PAGE.verify_add_db_stb_config()

        # delete stb config
        STB_CONFIG_LIST_PAGE = HOME_PAGE.goto_list_stbConfig_page()
        STB_CONFIG_LIST_PAGE.delete_stb_config()
        STB_CONFIG_LIST_PAGE.verify_delete_db_stb_config()
        STB_CONFIG_LIST_PAGE.get_stb_configuration_list()
 def test_Homepage_assertion(self):
     driver = self.driver
     is_enabled = HomePage.is_Mange_work_enabled(self)
     if is_enabled == True:
         print ('Manage work is enabled')
     else:
         print('Manage Work is disabled')
    def test_log_in_with_valid_data(self):
        self.loginPage = LoginPage(self.driver)
        self.homePage = HomePage(self.driver)

        self.loginPage.set_account_info("*****@*****.**",
                                        "Test987654123@")
        self.loginPage.click_login()

        self.loginPage.verify_status("Signed in successfully.")
Exemple #13
0
 def test_08_swipe(self):
     '''swipe 滑动测试'''
     HomePage().home_click()
     self.d(resourceId="com.github.android_app_bootstrap:id/list_button").click()
     self.d(text='Gesture').click()
     self.swipe_up()
     self.swipe_left()
     self.swipe_down()
     self.swipe_right()
Exemple #14
0
    def test_002_Products(self):
        hp = HomePage(self.driver)
        hp.click_Shop()

        Cart = ProductsPage(self.driver)
        Cart.Product_Title()

        i = -1
        for item in Cart.Product_Title():

            i = i + 1
            item_Name = item.text
            # print(item_Name)

            if item_Name == "Nokia Edge":
                Cart.Product_Add()[i].click()

        Cart.Click_CheckOut()
Exemple #15
0
    def test_e2e(self):
        
        log=self.test_getLogger()
        #Calling/defining Home Page constructor
        homepage=HomePage(self.driver)
        checkout=homepage.shopItems()
        log.info("Getting all the cart Titles")
        #checkout=CheckoutPage(self.driver)   
        products=checkout.getcartTitles()
        
        #confirmpage=ConfirmPage(self.driver)
        
        i=-1
        for product in products:
            i=i+1
            prodName=product.text
            log.info(prodName)
            if prodName=="Blackberry":
                #add item to cart
                #//div[@class='card h-100']/div[2]/button
                checkout.getcartFooters()[i].click()
        
        checkout.getcheckout().click()
        confirmpage=checkout.getcartcheckout()
        log.info("Entering Country Name-IND")
        confirmpage.getSearch().send_keys("Ind")
        
        self.verifyLinkPresence("India")

        #=======================================================================
        # wait=WebDriverWait(self.driver,7)
        # wait.until(expected_conditions.presence_of_element_located(confirmpage.enteredtxt))
        #=======================================================================
        confirmpage.getEnteredText().click()

        confirmpage.getCheckbox().click()
        confirmpage.getButton().click()

        print(confirmpage.getAlertText().text)
        message=confirmpage.getAlertText().text
        log.info("Text received form application is"+message)
        assert "Your order will be delivered" in message
    def test_login_sucessfully(self):

        HomePage(self.driver).enter_login_page()

        loginPage = LoginPage(self.driver)

        loginPage.input_email("*****@*****.**")

        loginPage.input_password("123")

        loginPage.press_login_btn()
class HomeAction(object):
    def __init__(self, driver):

        self.driver = driver
        self.HP = HomePage(self.driver)

    def click_Mail_list(self):

        try:
            # 在主页上单击通讯录
            self.HP.ContactModuleObj().click()
        except Exception as error:
            raise error

    def click_WriteLetter(self):

        try:
            # 在主页上单击写信
            self.HP.WriteLetterObj().click()
        except Exception as error:
            raise error
def login_with_valid_account(context):
    try:
        # logging.info("Check cookies")
        # context.driver.check_cookie()

        logging.info("Go to login page")
        login_page = LoginPage(context.driver)
        login_page.go_to_page(LoginPage.url, LoginPage.title)

        logging.info("Login with valid user account")
        login_page.login(context.test_data["user_account"]["username"],
                         context.test_data["user_account"]["password"])

        logging.info("Verify greeting information")
        home_page = HomePage(context.driver)
        home_page.verify_greeting(
            context.test_data["user_account"]["username"])

        logging.info("Reset test data")
        home_page.click_reset_test_data_button()
        reset_test_data_page = ResetTestDataPage(context.driver)
        reset_test_data_page.reset_test_data()

    except Exception as e:
        logging.error(e)
        raise e
    def test_CitySale(self, getData):

        driver = self.driver
        HP_obj = HomePage(driver)
        '''
        Implementing Try Except block because some City names are not present on UI
        '''
        try:
            ''' Getting Dynamic City Name'''
            CityElement = HP_obj.getCity(getData)
            self.GenericWait(driver, CityElement)
            self.Click_Element(driver, CityElement)

            ''' Get Total number of Sale record present for specific Town '''
            totalcolumns = HP_obj.getTotalRowCount()
            for i in range(len(totalcolumns)):
                Date_Element = HP_obj.getDate(str(i + 2))
                DateText = self.Get_Text(driver, Date_Element)

                ''' Validating current record date is within 7 days or not '''
                if self.is_date_valid(DateText):

                    ViewNoticeElement = HP_obj.getNotice(str(i + 2))
                    nextURL = self.Get_Element_Attribute(driver, ViewNoticeElement, "href")

                    ''' Opening View Full Notice on new tab '''

                    script = 'window.open("' + nextURL + '", "_blank");'
                    print(script)
                    driver.execute_script(script)
                else:
                    print("For town " + getData + " there is no sale record within 7 days")

        except:
            print("Town with name " + getData + " is not present on Homepage")
Exemple #20
0
 def test_03_auto_click_alert(self):
     '''弹窗自动点击测试'''
     self.watch_device()
     HomePage().home_click()
     self.d(resourceId="com.github.android_app_bootstrap:id/list_button").click()
     self.d(text='Alert').click()
     self.d(text='Show Dialog').click()
     time.sleep(0.2)
     self.d(text='Show Dialog').click()
     time.sleep(0.2)
     self.d(text='Show Dialog').click()
     time.sleep(0.2)
     self.d(text='Show Dialog').click()
     self.screenshot()  # 手动截图
     time.sleep(3)  # 等待3秒内自动点击yes后,继续后面的操作
     self.back()
     self.back()
     self.unwatch_device()
    def test_dup_stb_config_add(self):
        #add first stb config
        HOME_PAGE = HomePage(self.driver)
        STB_CONFIG_ADD_PAGE = HOME_PAGE.goto_add_stbConfig_page()
        STB_CONFIG_ADD_PAGE.add_stb_config()
        HOME_PAGE.goto_add_stbConfig_page()
        STB_CONFIG_ADD_PAGE.verify_add_db_stb_config()

        # add duplicate stb config
        STB_CONFIG_ADD_PAGE = HOME_PAGE.goto_add_stbConfig_page()
        STB_CONFIG_ADD_PAGE.add_stb_config()
        STB_CONFIG_ADD_PAGE.verify_error_on_adding_duplicate_stbConfig()
        STB_CONFIG_LIST_PAGE = HOME_PAGE.goto_list_stbConfig_page()

        #delete stb config
        STB_CONFIG_LIST_PAGE.delete_stb_config()
        STB_CONFIG_LIST_PAGE.verify_delete_db_stb_config()
    def test_cp_add(self):

        #add stb configuration
        HOME_PAGE = HomePage(self.driver)
        STB_CONFIG_PAGE = HOME_PAGE.goto_add_stbConfig_page()
        STB_CONFIG_PAGE.add_stb_config()
        STB_CONFIG_PAGE.verify_add_db_stb_config()

        #add broadcast offering
        HOME_PAGE = HomePage(self.driver)
        BROADCAST_OFFERING_PAGE = HOME_PAGE.goto_add_broadcast_offering_page()
        BROADCAST_OFFERING_PAGE.add_broadcast_offering()

        # delete broadcast offering
        BROADCAST_OFFERING_PAGE.delete_broadcast_offering()
        BROADCAST_OFFERING_PAGE.verify_delete_db_broadcast_offering_()

        # delete stb configuration
        HOME_PAGE.goto_list_stbConfig_page()
        STB_CONFIG_PAGE.delete_stb_config()
        STB_CONFIG_PAGE.verify_delete_db_stb_config()
Exemple #23
0
    def test_valid_login(self):
        driver = self.driver
        self.driver.get("https://opensource-demo.orangehrmlive.com/")
        login = LoginPage(driver)
        login.enter_username("Admin")
        login.enter_password("admin123")
        login.click_login()

        hp = HomePage(driver)
        hp.click_welcome()
        title = driver.title
        print("Title-->", title)
        self.assertEqual(title, "OrangeHRM", "Web page title not matching")
        hp.click_logout()
        time.sleep(2)
Exemple #24
0
    def test_open_home_page(self):
        driver = Driver().start()
        homepage = HomePage(driver)

        # homepage.advertisement_close()
        homepage.login_link_click()
        loginpage = LoginPage(driver)
        loginpage.login()
        assert (homepage.username_display.is_displayed())
        assert (homepage.main_image.is_displayed())
        homepage.main_article_click()
        articlepage = ArticlePage(driver)
        assert (driver.title)
        assert (articlepage.headline == homepage.main_article_text)
        assert (articlepage.main_image().is_displayed())
    def test_add_duplicate_hotLaunchSourceId(self, get_dup_hotLaunchSourceId):
        # add a new category
        HOME_PAGE = HomePage(self.driver)
        CATALOG_PAGE = HOME_PAGE.goto_add_category()
        CATALOG_PAGE.add_and_publish_category(
            get_dup_hotLaunchSourceId["hlsId"])
        log.info("Add and publish a new category")

        # add a new category with duplicate hotLaunchSourceId
        CATALOG_PAGE = HOME_PAGE.goto_add_category()
        CATALOG_PAGE.add_and_publish_category(
            get_dup_hotLaunchSourceId["hlsId"])
        log.info("Add a new category with duplicate hotLaunchSourceId")

        # delete category
        HOME_PAGE.goto_list_categories()
        CATALOG_PAGE.delete_category(get_dup_hotLaunchSourceId["hlsId"])
Exemple #26
0
    def test_Greencart(self):
        log = self.getLogger()

        homepage = HomePage(self.driver)
        homepage.Add_veggies().clear()
        log.info("Adding Veggies into the cart : ")

        homepage.Add_fruits().clear()
        log.info("Adding Fruits into the cart :")

        homepage.Add_Nuts().click()
        log.info("Adding Nuts into the cart :")

        homepage.checkout().click()

        orderconfirmation = OrderConfirmation(self.driver)
        orderconfirmation.PromoCode().click()
        time.sleep(12)
        code_validation = self.driver.find_element_by_class_name(
            "promoInfo").text
        assert code_validation == "Code applied ..!"
        log.info("Promo Code Validation :" + code_validation)

        orderconfirmation.TotalAmountConfirmation().text
        TotalAmount = self.driver.find_element_by_xpath(
            "//span[@class='totAmt']").text
        log.info("The Total purchase amount is :" + TotalAmount)

        orderconfirmation.DiscountedAmount().text
        DiscountedAmount = self.driver.find_element_by_xpath(
            "//span[@class='discountAmt']").text
        log.info("The discounted amount is :" + DiscountedAmount)

        orderconfirmation.PlaceOrder().click()
        log.info("Placing the final order")

        checkout = FinalCheckout(self.driver)
        checkout.CheckOut().click()
        log.info("The order has been placed ")
    def test_data_driven_login(self):
        driver=self.driver
        self.driver.get("https://opensource-demo.orangehrmlive.com/")

        logging.getLogger().info("URL Launced")
        time.sleep(2)
        rows=get_row_count(self.path,'Sheet1')
        for r in range(2,rows+1):
            username=read_data(self.path,"Sheet1",r,1)
            password=read_data(self.path,"Sheet1",r,2)
            login = LoginPage(driver)
            login.enter_username(username)

            self.logger.info("Username entered")
            login.enter_password(password)

            self.logger.info("Password entered")
            login.click_login()


            flag=len(driver.find_elements_by_id("welcome"))
            #print("Flag value",flag)


            if flag>0:
                print("Test Case Pass",username,password)
                logging.getLogger().info("Valid Login")
                write_data(self.path,'Sheet1',r,3,"Test Pass")

                hp = HomePage(driver)
                hp.click_welcome()

                self.logger.info("Home Page Open")
                hp.click_logout()
                time.sleep(2)


            else:

                self.logger.error("Login Failed")
                print("Test Case Fail",username,password)
                write_data(self.path,'Sheet1',r,3,"Test Fail")
Exemple #28
0
    def test_formSubmission(self, getData):

        log = self.test_getLogger()
        homepage = HomePage(self.driver)
        log.info("Entering data for form submission")
        log.info("Name is" + getData["Firstname"])
        homepage.getname().send_keys(getData["Firstname"])
        homepage.getEmail().send_keys(getData["Email"])
        homepage.getPassword().send_keys("123456")
        homepage.getCheckMe().click()

        self.selectOptionbyVisibleText(homepage.getGender(), getData["Gender"])
        #=======================================================================
        # mygender=Select(homepage.getGender())
        # mygender.select_by_visible_text("Female")
        #=======================================================================
        homepage.getStatus().click()
        homepage.getDateofBirth().send_keys("12/03/1991")
        homepage.getSubmit().click()
        message = homepage.getAlertMsg().text

        #for substring match
        assert "Success" in message
        #assert "Success! The Form has been submitted successfully!." == message
        self.driver.refresh()
    def __init__(self, driver):

        self.driver = driver
        self.HP = HomePage(self.driver)
    def test_formsubmission(self, getdata):

        homepage = HomePage(self.driver)
        log = self.getlogger()

        # homepage.get_name().send_keys("Gourav")
        homepage.get_name().send_keys(getdata["Name"])
        log.info("Name is : " + getdata["Name"])

        # homepage.get_email().send_keys("xyz.gmail.com")
        homepage.get_email().send_keys(getdata["Email"])
        log.info("Email is : " + getdata["Email"])

        # homepage.get_password().send_keys("Password")
        homepage.get_password().send_keys(getdata["Password"])
        log.info("Password is : " + getdata["Password"])

        self.select_option(homepage.get_gender(), getdata["Gender"])
        log.info("Gender is : " + getdata["Gender"])

        homepage.select_typeemployeeorstudent().click()
        homepage.click_tosubmit().click()

        alertext = homepage.get_alert().text
        log.info(alertext)
        assert "Success" in alertext
        homepage.get_screenshot()
        self.driver.refresh()
Exemple #31
0
 def testformsubmission(self, getData):
     log = self.getlogger()
     homepage = HomePage(self.driver)
     log.info("values5")
     log.info("the firstname is" + getData["firstname"])
     homepage.getName().send_keys(getData["firstname"])
     homepage.getEmail().send_keys(getData["lastname"])
     homepage.checkBox().click()
     self.selectoptionbyText(homepage.getdropdown(), getData["Gender"])
     homepage.clickSubmit().click()
     message = homepage.successMessage().text
     assert "success" in message
     self.driver.refresh()