class Test_itemCount(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.lp = LoginPage(self.driver)
        self.pdp = ProductDetailsPage(self.driver)
        self.sp = ShoppingCartPage(self.driver)
        self.cp = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_goToPDP(self):
        self.hp.goToLogin()
        credentials = json.loads(open('loginCredential.json').read())
        username = credentials.get('username')
        password = credentials.get('password')
        # l = [i for i in credentials.values()]
        self.lp.loginAmazon(username,password)
        self.hp.goToAmazonEcho()
        self.pdp.addToCart()
        self.sp.goToCart()
        before=self.cp.getTheQuantity()
        self.driver.back()
        self.driver.back()
        self.pdp.addToCart()
        self.sp.goToCart()
        after=self.cp.getTheQuantity()
        assert before<after,"Quantity is not incremented"
Beispiel #2
0
class Test_CartChangeQuantity(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.plp = ProductListPage(self.driver)
        self.pdp = PDP_Page(self.driver)
        self.cartpage = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_cart_changeqty_priceupdate(self):
        self.hp.search_product("bangles")
        self.plp.select_product()
        self.pdp.clickAddToCart()
        self.hp.click_cart_icon()

        subtotal1 = float(self.cartpage.get_subtotal())
        print("Subtotal price before qty update:", subtotal1)
        cartcount1 = self.hp.get_cart_count()
        print("Cart Count Before:", cartcount1)
        price = self.cartpage.get_prod_price()
        price_of_prod = price[0]

        self.cartpage.change_Quantity("2")
        time.sleep(3)
        subtotal2 = float(self.cartpage.get_subtotal())
        print("SubTotal price After quantity update:", subtotal2)
        cartcount2 = self.hp.get_cart_count()
        print("Cart Count After:", cartcount2)

        assert cartcount2 == str(int(cartcount1) +
                                 1), "cart count not incremented"
        print("Cart count is incremented by one")

        assert subtotal2 == price_of_prod * 2, "Subtotal price not updated"
        print("Subtotal price in cart page is updated")
Beispiel #3
0
class Test_CartRemoveItem(unittest.TestCase):

    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.plp = ProductListPage(self.driver)
        self.pdp = PDP_Page(self.driver)
        self.cartpage = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_cart_removeitem_priceupdate(self):
        self.hp.search_product("bangles")
        self.plp.select_product()
        self.pdp.clickAddToCart()

        self.hp.select_category()
        self.plp.select_product()
        self.pdp.clickAddToCart()

        self.hp.click_cart_icon()
        totalprice_before = self.cartpage.get_subtotal()
        print(totalprice_before)

        remove_price=self.cartpage.get_remove_prod_price()

        self.cartpage.remove_product()
        time.sleep(2)
        totalprice_after = self.cartpage.get_subtotal()
        print(totalprice_after)

        result_price = str(float(totalprice_before) - float(remove_price))

        assert totalprice_after in result_price,"Subtotal price not updated"
        print("Subtotal price is updated after removing the product from the cart")
class Test_productDetails(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.lp = LoginPage(self.driver)
        self.pdp = ProductDetailsPage(self.driver)
        self.sp = ShoppingCartPage(self.driver)
        self.cp = CartPage(self.driver)
        self.dap = DeliveryAddressPage(self.driver)
        self.sop = ShippingOptionPage(self.driver)
        self.pp = PaymentPage(self.driver)

    @pytest.mark.run(order=1)
    def test_goToPDP(self):
        self.hp.goToLogin()
        credentials = json.loads(open('loginCredential.json').read())
        username = credentials.get('username')
        password = credentials.get('password')
        self.lp.loginAmazon(username, password)
        self.hp.goToAmazonEcho()
        self.pdp.addToCart()
        self.sp.goToCart()
        self.cp.proceedToCheckout()
        self.dap.goToAdress()
        self.sop.continueCheckout()
        self.pp.paymentDetails()
 def classSetup(self, oneTimeSetUp):
     self.hp = HomePage(self.driver)
     self.lp = LoginPage(self.driver)
     self.pdp = ProductDetailsPage(self.driver)
     self.sp = ShoppingCartPage(self.driver)
     self.cp = CartPage(self.driver)
     self.dap = DeliveryAddressPage(self.driver)
     self.sop = ShippingOptionPage(self.driver)
     self.pp = PaymentPage(self.driver)
Beispiel #6
0
 def classSetup(self, oneTimeSetUp):
     self.hp = HomePage(self.driver)
     self.plp = ProductListPage(self.driver)
     self.pdp = PDP_Page(self.driver)
     self.cartpage = CartPage(self.driver)
     self.sign_up = SignUpPage(self.driver)
     self.address = DeliveryAddressPage(self.driver)
     self.shipment = ShipmentPage(self.driver)
     self.payment = PaymentMethodPage(self.driver)
     self.order = PlaceOrderPage(self.driver)
Beispiel #7
0
class Test_ReviewFilter(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.plp = ProductListPage(self.driver)
        self.pdp = PDP_Page(self.driver)
        self.cartpage = CartPage(self.driver)
        self.sign_up = SignUpPage(self.driver)
        self.address = DeliveryAddressPage(self.driver)
        self.shipment = ShipmentPage(self.driver)
        self.payment = PaymentMethodPage(self.driver)
        self.order = PlaceOrderPage(self.driver)

    @pytest.mark.run(order=1)
    def test_verify_invalid_couponcode(self):
        self.hp.mouseOverOnSignIn()
        self.hp.toClickOnSignIn()
        self.sign_up.set_username(
            self.hp.getDataFromJsonFile("UserCredential.json", "username"))
        self.sign_up.set_password(
            self.hp.getDataFromJsonFile("UserCredential.json", "password"))
        self.sign_up.click_signIn()
        #self.hp.search_product(self.hp.getDataFromJsonFile("ReadProductName.json","b"))
        self.hp.select_category("Beauty")
        # self.plp.select_subshopByCategory()
        self.plp.select_product()
        self.pdp.clickAddToCart()
        self.hp.click_cart_icon()
        self.cartpage.clickProceedToCheckOut()
        self.sign_up.set_username(
            self.hp.getDataFromJsonFile("UserCredential.json", "username"))
        self.sign_up.set_password(
            self.hp.getDataFromJsonFile("UserCredential.json", "password"))
        self.sign_up.click_signIn()
        self.address.clickAddressBtn()
        self.shipment.clickContinueBtn()
        self.payment.clickToContinue()
        self.order.enterCouponCode("GETAPAY10")
        self.order.applyCouponCode()
        # msg = self.order.getMessageForInvalidCoupon()
        # print(msg)
        assert 'not valid' in self.order.getMessageForInvalidCoupon(
        ), "Coupon code is valid Test case failed"
        print("Coupon invalid and it is not accepted,Test passed")
class Test_productDetails(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.lp = LoginPage(self.driver)
        self.pdp = ProductDetailsPage(self.driver)
        self.sp = ShoppingCartPage(self.driver)
        self.cp = CartPage(self.driver)

    @pytest.mark.run(order=1)
    def test_goToPDP(self):
        self.hp.goToLogin()
        credentials = json.loads(open('loginCredential.json').read())
        username = credentials.get('username')
        password = credentials.get('password')
        self.lp.loginAmazon(username, password)
        self.hp.goToAmazonEcho()
        self.pdp.addToCart()
        self.sp.goToCart()
        before = self.cp.getTheTotalAmount()
        self.driver.close()
Beispiel #9
0
 def classSetup(self, oneTimeSetUp):
     self.hp = HomePage(self.driver)
     self.plp = ProductListPage(self.driver)
     self.pdp = PDP_Page(self.driver)
     self.cartpage = CartPage(self.driver)
 def classSetup(self, oneTimeSetUp):
     self.hp = HomePage(self.driver)
     self.lp = LoginPage(self.driver)
     self.pdp = ProductDetailsPage(self.driver)
     self.sp = ShoppingCartPage(self.driver)
     self.cp = CartPage(self.driver)