def check_result(self):
        """
        check the result
        :return:
        """

        self.CheckPoint = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is " + self.CheckPoint)

        # login success
        if self.results == '1':

            bsnsCommon.wait_loading()

            value = Element("profile", "user").get_attribute("text")

            self.assertEqual(value, self.message)

        # login fail
        if self.results == '0':

            sleep(1)

            if Element("Alert", "layout").does_exist():

                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message)

                sleep(1)
                Element("Alert", "confirm").click()
    def check_result(self):

        # go to daily new
        while not Element("BottomNavigation", "BottomNavigation").is_exist():
            common.back()
        else:
            Element("BottomNavigation", "SHOP").click()
            sleep(1)
        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").does_exist():
            Element("daily_new", "new_guide").click()
        else:
            pass
        # get goods currency
        value2 = Element("daily_new", "goods_currency").get_attribute("text")
        self.logger.info("Changed currency is:" + value2[0:3])

        if value2[0:3] == self.value:
            self.assertEqual(1, 1)
        else:
            self.assertEqual(0, 1)

        while not Element("BottomNavigation", "BottomNavigation").is_exist():
            common.back()
Beispiel #3
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 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 testReview(self):
        try:
            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("Enter the write review")
            while not Element("Good_details", "write_review").is_exist():
                myCommon.my_swipe_to_up()
            else:
                Element("Good_details", "write_review").click()

            bsnsCommon.wait_loading()

            self.logger.info("Write review")

            self.write_reviews()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Beispiel #6
0
    def check_result(self):

        self.CheckPoint = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is " + self.CheckPoint)
        result = self.first_name + " " + self.last_name
        if self.results == "1":

            bsnsCommon.wait_loading()

            element_list = Element("address_management",
                                   "recipient").get_element_list()

            for i in range(len(element_list)):

                value = element_list[i].get_attribute("text")

                if result == value:

                    self.assertEqual(1, 1)

        if self.results == "0":
            sleep(1)

            if Element("Alert", "layout").does_exist():

                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message)

                sleep(1)
                Element("Alert", "confirm").click()
    def testQty_minus(self):
        try:

            # Enter to the shopping cart
            self.logger.info("Enter to the shopping cart")
            Element("Shopping_cart", "shopping_cart").click()

            bsnsCommon.wait_loading()
            Element("Shopping_cart", "goods_num").send_keys(0, "0")

            # change qty_minus
            os.popen("adb shell input keyevent 61")
            sleep(1)
            os.popen("adb shell input keyevent 66")

            if Element("Alert", "layout").does_exist():

                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message_min)

                sleep(1)
                Element("Alert", "confirm").click()
            # return the index
            bsnsCommon.return_index()

        except Exception as ex:
            self.logger.error(str(ex))
    def check_result(self):
        """
        check the result
        :return:
        """

        self.CheckPoint = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is " + self.CheckPoint)

        # login success
        if self.results == '1':

            bsnsCommon.wait_loading()

            value = Element("profile", "user").get_attribute("text")

            self.assertEqual(value, self.message)

        # login fail
        if self.results == '0':

            sleep(1)

            if Element("Alert", "layout").does_exist():

                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message)

                sleep(1)
                Element("Alert", "confirm").click()
    def check_result(self):

        self.CheckPoint = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is " + self.CheckPoint)
        result = self.first_name+" "+self.last_name
        if self.results == "1":

            bsnsCommon.wait_loading()

            element_list = Element("address_management", "recipient").get_element_list()

            for i in range(len(element_list)):

                value = element_list[i].get_attribute("text")

                if result == value:

                    self.assertEqual(1, 1)

        if self.results == "0":
            sleep(1)

            if Element("Alert", "layout").does_exist():

                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message)

                sleep(1)
                Element("Alert", "confirm").click()
Beispiel #10
0
    def testDeleteGoods(self):

        try:

            # add goods to cart
            self.logger.info("Add 2 goods to cart")
            self.goods_name_list = bsnsCommon.add_goods_in_cart(2)

            # Enter to the shopping cart
            self.logger.info("Enter to the shopping cart")
            Element("Shopping_cart", "shopping_cart").click()

            bsnsCommon.wait_loading()

            # delete one goods
            bsnsCommon.delete_goods_in_cart(self.goods_name_list[0])

            # get the total_price
            total_price = bsnsCommon.get_total_price_in_cart()

            # check result
            self.check_result(total_price)

        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 check_result(self):
        """
        check result
        :return:
        """
        self.checkPoint = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is:" + self.checkPoint)

        # login successfully
        if self.results == '1':
            bsnsCommon.wait_loading()
            if not Element("Alert", "layout").dose_exist():
                self.message = ""

                if Element("BottomNavigation",
                           "BottomNavigation").dose_exist():
                    value = ""
                    self.assertEqual(value, self.message)
                    bsnsCommon.logout()

        # login fail
        if self.results == '0':

            sleep(1)

            if Element("Alert", "layout").does_exist():
                value = Element("Alert", "message").get_attribute("text")

                self.assertEqual(value, self.message)

                sleep(1)
                Element("Alert", "confirm").click()
            else:
                pass
Beispiel #13
0
    def testReview(self):
        try:
            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("Enter the write review")
            while not Element("Good_details", "write_review").is_exist():
                myCommon.my_swipe_to_up()
            else:
                Element("Good_details", "write_review").click()

            bsnsCommon.wait_loading()

            self.logger.info("Write review")

            self.write_reviews()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
Beispiel #14
0
    def addWishlist(self):
        # 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
        if Element("daily_new", "new_guide").is_exist():
            Element("daily_new", "new_guide").click()
        else:
            pass
        # get add goods name
        self.goods_name = Element("daily_new",
                                  "goods_name").get_attribute("text")
        # add goods to wish_list
        while not Element("daily_new", "add_wishlist").is_exist():
            common.my_swipe_to_up()
        else:
            Element("daily_new", "add_wishlist").click()
            if Element("Alert", "layout").does_exist():
                self.addResult = self.log.take_shot(self.driver,
                                                    self.case_name)
                self.logger.info("Take shot, the picture path is:" +
                                 self.addResult)
                Element("Alert", "confirm").click()
    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))
    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))
Beispiel #18
0
    def addAddress(self):
        # add new address
        self.logger.info("Enter the Address Management")
        Element("address_management", "add_address").click()

        bsnsCommon.wait_loading()

        # input the first name
        Element("Address", "first_name").send_key(address_cls[0][1])

        # input the last name
        Element("Address", "last_name").send_key(address_cls[0][2])

        # input the Gender
        if address_cls[0][3] == "MS.":
            Element("Address", "MS").click()

        if address_cls[0][3] == "MR.":
            Element("Address", "MR ").click()

        # input Country
        if address_cls[0][4] != "":
            Element("Address", "Country ").click()

            i = int(address_cls[0][4])

            Element("Address", "Country_State_list ").clicks(i)

        # input State_Province
        if address_cls[0][4] != "0" and address_cls[0][4] != "7":
            Element("Address", "State_Province").send_key(address_cls[0][5])
        else:
            i = int(address_cls[0][5])
            Element("Address", "Country_State_list ").clicks(i)

        # input city
        Element("Address", "City").send_key(address_cls[0][6])

        # input Address line1
        Element("Address", "Line1").send_key(address_cls[0][7])

        # input city
        Element("Address", "Line2").send_key(address_cls[0][8])

        # input Phone
        Element("Address", "Phone").send_key(address_cls[0][9])

        # input zip code
        Element("Address", "ZIP_code").send_key(address_cls[0][10])

        Element("title", "rightButton").click()
    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 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))
Beispiel #21
0
    def checkAddResult(self):
        # go to My Wishlist
        common.back()
        bsnsCommon.go_to_me()
        bsnsCommon.wait_loading()
        common.my_swipe_to_up()

        self.addResult = self.log.take_shot(self.driver, self.case_name)
        self.logger.info("Take shot, the picture path is:" + self.addResult)
        goods = Element("wish_list", "wish_goods_name").get_element_list()

        for name in goods:
            name.get_attribute("text")
            goods_name = name
            if goods_name == self.goods_name:
                self.assertEqual(1, 1)
                self.logger.info("Add goods successfully : OK")
Beispiel #22
0
    def addShoppingBag(self):

        # click add to bag
        while not Element("add_shopping_bag", "add_bag").is_exist():
            common.my_swipe_to_up()
        else:
            Element("add_shopping_bag", "add_bag").click()
        # choose size
        if Element("add_shopping_bag", "size").is_exist():
            Element("add_shopping_bag", "size").clicks(0)
        # click done
        if not Element("add_shopping_bag", "add_done").is_exist():
            common.my_swipe_to_up()
        else:
            Element("add_shopping_bag", "add_done").click()
        bsnsCommon.wait_loading()
        self.name = Element("add_shopping_bag", "name").get_attribute("text")
Beispiel #23
0
    def checkRemoveResult(self):
        # go to My Wishlist
        common.back()
        bsnsCommon.wait_loading()
        common.my_swipe_to_up()

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

        if len(goods) > 0:
            for name in goods:
                name.get_attribute("text")
                goods_name = name
                if goods_name != self.goods_name:
                    pass
                else:
                    self.assertEqual(0, 1)
                    break
Beispiel #24
0
    def removeWishlist(self):
        # go to My Wishlist
        common.back()
        bsnsCommon.go_to_me()
        bsnsCommon.wait_loading()
        common.my_swipe_to_up()

        # get remove goods name
        self.re_goods_name = Element(
            "wish_list", "wish_goods_name").gets(0).get_attribute("text")
        # find a goods
        Element("wish_list", "wish_goods_name").clicks(0)

        # remove goods from wish list
        while not Element("daily_new", "add_wishlist").is_exist():
            common.my_swipe_to_up()
        else:
            Element("daily_new", "add_wishlist").click()
Beispiel #25
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))
Beispiel #26
0
    def check_result(self):
        sleep(1)

        if Element("Alert", "layout").does_exist():
            value = Element("Alert", "message").get_attribute("text")

            self.assertEqual(value, self.message)
            sleep(1)
            Element("Alert", "confirm").click()
            sleep(1)

        if self.result == "1":
            Element("account_setting", "change_password").click()
            bsnsCommon.wait_loading()

            self.input_password(self.newPassword, self.oldPassword,
                                self.oldPassword)
            sleep(1)
            Element("Alert", "confirm").click()
Beispiel #27
0
    def tearDown(self):
        self.End = self.log.take_shot(self.driver, self.case_name)

        self.logger.info("Take shot, the picture path is " + self.End)

        self.logger.info("Enter the shopping cart")

        Element("Shopping_cart", "shopping_cart").click()

        bsnsCommon.wait_loading()

        # delete the goods which we add to shopping cart
        bsnsCommon.delete_goods_in_cart(self.goods_name)

        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.caseNo)
Beispiel #28
0
    def tearDown(self):
        self.End = self.log.take_shot(self.driver, self.case_name)

        self.logger.info("Take shot, the picture path is " + self.End)

        self.logger.info("Enter the shopping cart")

        Element("Shopping_cart", "shopping_cart").click()

        bsnsCommon.wait_loading()

        # delete the goods which we add to shopping cart
        bsnsCommon.delete_goods_in_cart(self.goods_name)

        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.caseNo)
Beispiel #29
0
    def check_Result(self):

        # go to shopping bag
        Element("add_shopping_bag", "shop_bag").click()
        bsnsCommon.wait_loading()
        # click new guide
        if Element("shopping_bag", "new_guide").is_exist():
            Element("shopping_bag", "new_guide").click()
        else:
            pass
        names = Element("shopping_bag", "name").get_element_list()

        for name in names:
            value = name.get_attribute("text")
            self.logger.info("names are : " + value + "\n")
            if value == self.name:
                self.assertEqual(1, 1)
            else:
                pass
    def deleteGoods(self):
        # add goods to shopping bag
        # click add to bag
        while not Element("add_shopping_bag", "add_bag").is_exist():
            common.my_swipe_to_up()
        else:
            Element("add_shopping_bag", "add_bag").click()
        # choose size
        if Element("add_shopping_bag", "size").is_exist():
            Element("add_shopping_bag", "size").clicks(0)
        # click done
        if not Element("add_shopping_bag", "add_done").is_exist():
            common.my_swipe_to_up()
        else:
            Element("add_shopping_bag", "add_done").click()
        bsnsCommon.wait_loading()

        # go to shopping bag
        Element("add_shopping_bag", "shop_bag").click()
        bsnsCommon.wait_loading()
        # click new guide
        if Element("shopping_bag", "new_guide").is_exist():
            Element("shopping_bag", "new_guide").click()
        else:
            pass

        goods = Element("shopping_bag", "name").get_element_list()
        self.length = len(goods)

        # delete a goods
        if len(goods) == 1:
            common.my_swipe_to_right_2()
            if Element("shopping_bag", "delete").is_exist():
                Element("shopping_bag", "delete").click()
        elif len(goods) >= 2:
            while not Element("shopping_bag", "shopping").does_exist():
                common.my_swipe_to_up()
            else:
                common.my_swipe_to_right()
                if Element("shopping_bag", "delete").is_exist():
                    Element("shopping_bag", "delete").click()
    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))
Beispiel #32
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 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))
Beispiel #34
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))
Beispiel #35
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))
    def testFreight(self):

        try:
            # Enter to the shopping cart
            self.logger.info("Enter to the shopping cart")
            Element("Shopping_cart", "shopping_cart").click()

            # clear the shopping cart
            bsnsCommon.clear_cart()

            # add goods to shopping cart
            self.logger.info("Add 1 goods to cart")
            self.goods_name_list = bsnsCommon.add_goods_in_cart("1")

            # enter the shopping cart
            self.logger.info("Enter to the shopping cart")
            Element("Shopping_cart", "shopping_cart").click()

            bsnsCommon.wait_loading()

            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testRegister(self):
        """
        test register
        :return:
        """
        try:

            self.logger.info("Enter the profile page")
            # 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()

            self.logger.info("Enter the sign in page")

            if not Element("profile", "SignIn").is_exist():

                self.logger.debug("Current is already login, first logout")

                bsnsCommon.logout()

            Element("profile", "SignIn").click()

            bsnsCommon.wait_loading()

            self.logger.info("Enter the register page")

            Element("login", "register").click()

            bsnsCommon.wait_loading()

            self.logger.info("input email,password,confirm_password")
            self.register()

            bsnsCommon.wait_loading()

            self.logger.info("check the %s result"%(self.case_name))
            self.check_result()

        except Exception as ex:
            self.logger.error(str(ex))
    def testRecentlyViewed(self):
        try:
            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")

            # return the index
            bsnsCommon.return_index()

            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()

            myCommon.my_swipe_to_up()

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

            element_list = Element("profile", "profile_tv").get_element_list()

            for i in range(len(element_list)):

                element_name = element_list[i]

                if element_name == "Recently Viewed":

                    element_list[i].click()

                    break

            bsnsCommon.wait_loading()

            self.check_result(self.goods_name)

        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))
    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 testSettingFeedBack(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()

            myCommon.my_swipe_to_up()

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

            element_list = Element("profile", "profile_tv").get_element_list()

            for i in range(len(element_list)):

                element_name = element_list[i]

                if element_name == "Setting":

                    element_list[i].click()

                    break

            bsnsCommon.wait_loading()

            Element("setting", "feed_back").click()

            bsnsCommon.wait_loading()

            Element("feed_back", "email").send_key(self.email)

            Element("feed_back", "advice").send_key(self.advice)

            Element("title","rightButton").click()

        except Exception as ex:
            self.logger.error(str(ex))
Beispiel #42
0
    def testAddCart(self):
        try:
            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")

            self.logger.info("Enter the shopping cart")

            Element("Shopping_cart", "shopping_cart").click()

            bsnsCommon.wait_loading()

            bsnsCommon.delete_goods_in_cart(self.goods_name)

            myCommon.back()

            bsnsCommon.wait_loading()

            goods_num = Element("Shopping_cart", "shopping_cart").get_attribute("text")

            self.logger.info("Add goods to cart")

            self.add_cart()

            self.check_result(goods_num)

        except Exception as ex:
            self.logger.error(str(ex))
    def check_result(self, goods_name):

        value = Element("Good_details", "save").get_attribute("text")

        while value != "saved":
            sleep(1)
        else:
            bsnsCommon.return_index()

        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()

        self.logger.info("Enter the my wish list")

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

        bsnsCommon.wait_loading()

        goods_list = []

        self.logger.info("Determine whether there is a goods")

        while Element("wish_list", "goods_name").is_exist():
            self.logger.info("Get the goods name")

            element_list = Element("Shopping_cart", "goods_name").get_element_list()

            if element_list is not None:

                self.logger.info("Get the last goods name")
                last_goods_name = element_list[-1].get_attribute("text")

                for i in range(len(element_list)):

                    value = element_list[i].get_attribute("text")

                    if value == goods_name:

                        self.assertEqual("1", "1")

                        Element("Shopping_cart", "delete_goods").clicks(i)

                        Element("Alert", "confirm").click()

                        bsnsCommon.wait_loading()

                        return

            if last_goods_name not in goods_list:

                self.logger.info("Goods is not end")

                self.logger.info("Swipe up, if not end")

                myCommon.my_swipe_to_up()

                goods_list.append(last_goods_name)
            else:
                self.logger.info("Goods is end")
                self.assertEqual("1", "0")
                return