def testLogin(self):
        """
        test login
        :return:
        """

        try:

            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation", "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # login the app
            bsnsCommon.login(self.email, self.password)

            # check the result
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #2
0
    def testProfileAddressDelete(self):
        try:
            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation", "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            # enter my address
            self.logger.info("Enter the my address")

            Element("profile", "profile_tv").clicks(3)

            self.addAddress()

            # delete address

            bsnsCommon.wait_loading()
        except Exception as ex:
            self.logger.error(str(ex))
    def testLogin(self):
        """
        test login
        :return:
        """

        try:

            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation",
                              "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # login the app
            bsnsCommon.login(self.email, self.password)

            # check the result
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testDeleteAddress(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            # login app
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # go to 'ME'
            bsnsCommon.go_to_me()
            sleep(1)
            # go to add address page
            Element("address_management", "address_book").click()

            if Element("Address", "delete_address").is_exist():
                # delete address
                Element("Address", "delete_address").clicks(0)
                if Element("Alert", "layout").does_exist():
                    Element("Alert", "confirm").click()
            else:
                self.addAddress()
                # delete address
                Element("Address", "delete_address").clicks(0)
                if Element("Alert", "layout").does_exist():
                    Element("Alert", "confirm").click()

        except Exception as ex:
            self.logger.error(str(ex))
    def testAddress(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()

            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # go to 'ME'
            bsnsCommon.go_to_me()
            # go to address_book
            Element("address_management", "address_book").click()

            # add address
            Element("address_management", "add_address").click()
            bsnsCommon.input_address(self.first_name, self.last_name,
                                     self.phone, self.zip_code, self.address_1,
                                     self.address_2, self.city, self.country,
                                     self.state)

            # check result
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testChangePassword(self):
        try:
            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation", "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            # enter the account setting
            Element("profile", "profile_tv").clicks(0)
            bsnsCommon.wait_loading()

            # enter the change password
            Element("account_setting", "change_password").click()
            bsnsCommon.wait_loading()

            self.input_password(self.old_password, self.new_password, self.confirm_password)

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testMyTickets(self):
        try:
            login_email = loginGls[0][1]
            login_pass = loginGls[0][2]
            bsnsCommon.login(login_email, login_pass)
            bsnsCommon.wait_loading()
            bsnsCommon.cancel_update()

            bsnsCommon.go_to_me()
            sleep(1)
            Element("my_tickets", "my_tickets").click()
            bsnsCommon.wait_loading()

            Element("my_tickets", "add_tickets").click()
            bsnsCommon.wait_loading()

            Element("my_tickets", "tickets_topic").click()
            bsnsCommon.wait_loading()

            self.inputTickets(self.first_name, self.last_name, self.email,
                              self.language, self.content)
            self.checkResult()

        except Exception as ex:
            self.logger.error(str(ex))
    def testRecentlyViewed(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # go to daily new
            Element("daily_new", "daily_new").click()
            bsnsCommon.wait_loading()
            # view a goods
            Element("daily_new", "daily_new_goods").clicks(0)
            sleep(1)
            common.my_swipe_to_up()
            self.goods_name = Element("daily_new",
                                      "goods_name").get_attribute("text")

            # go to recently viewed
            common.back()
            sleep(1)
            bsnsCommon.go_to_me()
            bsnsCommon.wait_loading()
            Element("recently_viewed", "recently_viewed").click()

            # check result
            self.checkResult()

        except Exception as ex:
            self.logger.error(str(ex))
    def testDeleteGoods(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()

            # go to daily new
            Element("daily_new", "daily_new").click()
            bsnsCommon.wait_loading()

            # find a goods
            Element("daily_new", "daily_new_goods").clicks(0)
            while Element("daily_new", "new_guide").is_exist():
                Element("daily_new", "new_guide").click()
            else:
                pass

            self.deleteGoods()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #10
0
    def testAddShoppingBag(self):

        try:
            # login
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            # click cancel for update
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()

            # go to daily new
            Element("daily_new", "daily_new").click()
            bsnsCommon.wait_loading()

            # find a goods
            Element("daily_new", "daily_new_goods").clicks(0)
            # click new guide
            while Element("daily_new", "new_guide").does_exist():
                Element("daily_new", "new_guide").click()
            else:
                pass

            self.addShoppingBag()

            self.check_Result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testSave(self):

        try:

            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation",
                              "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            bsnsCommon.return_index()

            self.logger.info("Enter the goods details")

            while not Element("Shop", "goods").is_exist():
                myCommon.my_swipe_to_up()
            else:
                myCommon.my_swipe_to_up()
                Element("Shop", "goods").clicks(0)

            bsnsCommon.wait_loading()

            self.logger.info("Get the goods's name")

            self.goods_name = Element("title", "title").get_attribute("text")

            Element("Good_details", "save").click()

            self.check_result(self.goods_name)

        except Element as ex:

            self.logger.error(str(ex))
    def testSave(self):

        try:

            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation", "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            bsnsCommon.return_index()

            self.logger.info("Enter the goods details")

            while not Element("Shop", "goods").is_exist():
                myCommon.my_swipe_to_up()
            else:
                myCommon.my_swipe_to_up()
                Element("Shop", "goods").clicks(0)

            bsnsCommon.wait_loading()

            self.logger.info("Get the goods's name")

            self.goods_name = Element("title", "title").get_attribute("text")

            Element("Good_details", "save").click()

            self.check_result(self.goods_name)

        except Element as ex:

            self.logger.error(str(ex))
    def testCheckOut(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            bsnsCommon.cancel_update()

            bsnsCommon.add_goods_in_cart(1)
            # enter shopping bag
            Element("title", "right_shopping_bag").click()
            bsnsCommon.wait_loading()
            # get total price in shopping car
            self.total_price = bsnsCommon.get_total_price_in_cart()
            Element("shopping_bag", "checkout").click()

            # add address
            bsnsCommon.add_address_in_checkout(
                addressGls[0][1], addressGls[0][2], addressGls[0][3],
                addressGls[0][4], addressGls[0][5], addressGls[0][6],
                addressGls[0][7], addressGls[0][8], addressGls[0][9])
            bsnsCommon.wait_loading()

            # choose shipping and payment method
            bsnsCommon.choose_shipping_payment_methods_in_checkout(
                self.shipping_method, self.payment_method)

            # input coupon code
            self.code_coupon = bsnsCommon.input_coupon_code(self.coupon_code)
            # input freebie
            self.code_freebie = bsnsCommon.input_freebie(self.freebie)

            # check price
            if self.check_price():
                # enter payment page
                Element("checkout", "place_order").click()
                bsnsCommon.wait_loading()
                if bsnsCommon.input_card_paypal_message_in_payment(
                        self.payment_method, self.card_number, self.cvv):
                    self.result = 0

            # check result
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testLogin(self):
        """
        Test Login
        :return:
        """
        try:
            # login the app
            bsnsCommon.login(self.email, self.password)
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            self.check_result()

        except Exception as ex:
            self.logger.err(str(ex))
Exemple #15
0
    def testClearCache(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # go to account setting
            bsnsCommon.go_to_setting()
            self.clearCache()
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #16
0
    def testAddAddress(self):
        try:
            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation",
                              "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            # enter my address
            self.logger.info("Enter the my address")

            Element("profile", "profile_tv").clicks(3)

            bsnsCommon.wait_loading()

            # add new address
            self.logger.info("Enter the Address Management")
            Element("address_management", "add_address").click()

            bsnsCommon.wait_loading()

            self.input_info()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testAddAddress(self):
        try:
            self.logger.info("Enter the profile")

            # find the bottom Navigation bar
            while not Element("BottomNavigation", "BottomNavigation").is_exist():
                sleep(1)
            else:
                # enter the profile
                Element("BottomNavigation", "profile").click()

            bsnsCommon.wait_loading()

            # first login
            user_name = loginCls[0][1]
            password = loginCls[0][2]

            bsnsCommon.login(user_name, password)

            bsnsCommon.wait_loading()

            # enter my address
            self.logger.info("Enter the my address")

            Element("profile", "profile_tv").clicks(3)

            bsnsCommon.wait_loading()

            # add new address
            self.logger.info("Enter the Address Management")
            Element("address_management", "add_address").click()

            bsnsCommon.wait_loading()

            self.input_info()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #18
0
    def testWishlist(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # test add goods to wish list
            self.addWishlist()
            # check add wish list result
            self.checkAddResult()
            # test remove goods from wish list
            self.removeWishlist()
            # check remove wish list result
            self.checkRemoveResult()

        except Exception as ex:
            self.logger.error(str(ex))
    def testAboutUs(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            # go to account setting
            bsnsCommon.go_to_setting()

            Element("account_setting", "shipping_info").click()
            bsnsCommon.wait_loading()
            self.checkpoint = self.log.take_shot(self.driver, self.case_name)
            self.logger.info("Take a shot, the picture path is:" + self.checkpoint)
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #20
0
    def testChangePassword(self):

        try:
            email = loginCls[0][1]
            password = loginCls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            bsnsCommon.go_to_setting()

            Element("account_setting", "change_password").click()

            self.input_password(self.oldPassword, self.newPassword,
                                self.confirmPassword)

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Exemple #21
0
    def testSort(self):
        try:
            email = loginGls[0][1]
            password = loginGls[0][2]
            bsnsCommon.login(email, password)
            bsnsCommon.wait_loading()
            self.logger.info("login.")
            if Element("Alert", "update_title").is_exist():
                Element("Alert", "cancel").click()
            else:
                pass

            Element("daily_new", "daily_new").click()
            bsnsCommon.wait_loading()
            self.logger.info("daily new.")

            for i in range(1, 3):
                while not bsnsCommon.wait_loading():
                    common.my_swipe_to_up()
                else:
                    break
            else:
                break

            goods_name = Element("wish_list",
                                 "wish_goods_name").get_element_list()

            if len(goods_name) != 0:
                for i in len(goods_name):
                    self.names = goods_name[i].get_attribute("text")

                else:
                    break
                self.logger.info("names are:" + self.names)
            else:
                self.logger.info("No find elements.")

            # self.sort_left = Element("category", "sort_left").get_element_list()
            # self.sort_right = Element("category", "sort_right").get_element_list()
            # left_category = []
            # right_category = []
            # if len(self.sort_left) != 0:
            #     for i in len(self.sort_left):
            #         left_category[i] = self.sort_left[i].get_attribute("text")
            #         self.logger.info("Left category are:" + left_category[i] + "  ")
            # else:
            #     self.logger.info("Don't get the left category!")
            #     return False
            # if len(self.sort_right) != 0:
            #     for j in len(self.sort_right):
            #         right_category[j] = self.sort_left[j].get_attribute("text")
            #         self.logger.info("Right category are:" + right_category[j] + "  ")
            # else:
            #     self.logger.info("Don't get the right category!")
            #     return False
            # category_name = []
            # for n in range(1, 60):
            #     if n % 2 != 0:
            #         category_name[n] = left_category[(n+1)/2]
            #     else:
            #         category_name[n] = right_category[n/2]
            #     pass

        except Exception as ex:
            self.logger.error(str(ex))