Exemplo n.º 1
0
 def __init__(self, driver):
     self.home = HomePage(driver)
     self.user_center = UserCenter(driver)
     self.login = LoginPage(driver)
     self.address = AddressPage(driver)
     self.goods_detial = GoodsDetail(driver)
     self.confirm_order = ConfirmOrder(driver)
Exemplo n.º 2
0
class CommentFlow():
    def __init__(self, driver):
        self.home = HomePage(driver)
        self.user_center = UserCenter(driver)
        self.login = LoginPage(driver)
        self.address = AddressPage(driver)
        self.goods_detial = GoodsDetail(driver)
        self.confirm_order = ConfirmOrder(driver)
        self.comment_center = CommentCenter(driver)

    def comment_flow(self, username, password, text):
        """评价流程"""
        # 在首页点击我的进入用户中心
        self.home.click_user_center()
        # 点击个人中心的头像进入登陆界面
        self.user_center.click_address()
        self.login.input_username(username)
        self.login.input_password(password)
        self.login.click_login()

        #点击待评价订单
        time.sleep(6)
        self.user_center.click_wait_evaluate()
        #进入评价中心,获取标题
        self.comment_center.get_text()
        #点击评价晒单
        self.comment_center.click_evaluate_img()

        #输入评价内容
        time.sleep(9)
        self.comment_center.input_evaluate_content(text)
        #星级评价
        time.sleep(9)
        self.comment_center.click_star()
        #点击提交
        self.comment_center.click_submit()
        #点击已评价
        self.comment_center.click_have_comment()
        #点击评价的商品
        time.sleep(9)
        self.comment_center.find_have_comment_goods()
        #点击评价
        time.sleep(9)
        self.goods_detial.click_comment()
        #打印评价内容
        time.sleep(9)
        content = self.goods_detial.find_comment(text)
        return content
Exemplo n.º 3
0
class Promotion():
    def __init__(self, driver):
        self.home = HomePage(driver)
        self.user_center = UserCenter(driver)
        self.login = LoginPage(driver)
        self.address = AddressPage(driver)
        self.goods_detial = GoodsDetail(driver)
        self.confirm_order = ConfirmOrder(driver)

    def promotion_flow(self, username, password):
        #在首页点击我的进入用户中心
        self.home.click_user_center()
        #点击个人中心的头像进入登陆界面
        self.user_center.click_address()
        #登录
        self.login.input_username(username)
        self.login.input_password(password)
        self.login.click_login()
        #回到首页
        self.home.click_home()
        time.sleep(6)
        #选择商品

        time.sleep(7)
        self.home.search_goods()
        #点击立即购买
        time.sleep(5)
        self.goods_detial.click_buy_now()
        self.goods_detial.click_confirm()
        #使用积分和余额付款
        self.confirm_order.click_order_point()
        self.confirm_order.click_order_balance()
        #点击提交订单
        time.sleep(5)
        self.confirm_order.click_submit()
        self.confirm_order.input_pay_passwd("111111")
        self.confirm_order.click_confirm_pay()
        #点击用户中心
        self.home.click_user_center()
        self.user_center.click_my_order()
        order_number = self.user_center.get_order_number()
        return order_number
Exemplo n.º 4
0
class Shopping():
    def __init__(self, driver):
        self.home = HomePage(driver)
        self.user_center = UserCenter(driver)
        self.login = LoginPage(driver)
        self.address = AddressPage(driver)
        self.goods_detial = GoodsDetail(driver)
        self.confirm_order = ConfirmOrder(driver)

    def shopping_flow(self, username, password, data):
        #在首页点击我的进入用户中心
        self.home.click_user_center()
        #点击个人中心的头像进入登陆界面
        self.user_center.click_address()
        #登录
        self.login.input_username(username)
        self.login.input_password(password)
        self.login.click_login()
        #新建一个地址
        time.sleep(6)
        self.user_center.click_address()
        self.address.click_add_new_address()
        self.address.input_consignee_name(data["consignee_name"])
        self.address.input_consignee_mobile(data["consignee_mobile"])
        self.address.choose_consignee_region()
        self.address.input_consignee_address(data["consignee_address"])
        self.address.click_save_address()

        #回到首页
        self.home.click_home()
        #选择商品
        self.home.click_goods()
        #点击立即购买
        time.sleep(5)
        self.goods_detial.click_buy_now()
        self.goods_detial.click_confirm()
        #使用积分和余额付款
        self.confirm_order.click_order_point()
        self.confirm_order.click_order_balance()
        #点击提交订单
        time.sleep(5)
        self.confirm_order.click_submit()
        self.confirm_order.input_pay_passwd("111111")
        self.confirm_order.click_confirm_pay()
        # 点击用户中心
        self.home.click_user_center()
        self.user_center.click_my_order()
        order_number = self.user_center.get_order_number()
        return order_number
Exemplo n.º 5
0
        self.send_keys(self.consignee_address_loc, text)

    def click_save_address(self):
        """点击保存收货地址"""
        self.click(self.save_address_loc)
        time.sleep(5)
        self.click_back()


if __name__ == '__main__':
    driver = open_app()
    swipe = Base(driver)
    home = HomePage(driver)
    # home.click_mine()
    home.click_user_center()
    user = UserCenter(driver)
    time.sleep(5)
    user.click_address()
    login = LoginPage(driver)
    login.input_username("17788888888")
    login.input_password("123456")
    login.click_login()
    time.sleep(10)
    user.click_address()
    address = AddressPage(driver)
    address.click_add_new_address()
    time.sleep(5)
    address.input_consignee_name("三只松鼠")
    address.input_consignee_mobile(18888888888)
    address.choose_consignee_region()
    address.input_consignee_address("三只小猪")