Esempio n. 1
0
    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))
Esempio n. 2
0
    def tearDown(self):
        self.End = self.log.take_shot(self.driver, self.caseName)

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

        bsnsCommon.return_index()

        self.log.build_end_line(self.caseNo)
Esempio n. 3
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)
        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.caseNo)
    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)
        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.caseNo)
    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 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))
Esempio n. 7
0
    def tearDown(self):

        for good_name in self.goods_name_list:
            bsnsCommon.delete_goods_in_cart(good_name)

        self.End = self.log.take_shot(self.driver, self.case_name)

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

        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.case_name)
    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))
Esempio n. 10
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)
Esempio n. 11
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)
    def tearDown(self):
        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.case_name)
    def tearDown(self):
        # return the index
        bsnsCommon.return_index()

        # test Start
        self.log.build_end_line(self.case_name)
    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
    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