Ejemplo n.º 1
0
class Test_CartItemCount(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)

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

        cartcount1 = int(self.hp.get_cart_count())
        print("BeforeCount:",cartcount1)

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

        #time.sleep(2)

        cartcount2 = int(self.hp.get_cart_count())
        print("AfterCount:",cartcount2)

        cartcount1=cartcount1+ 1

        assert cartcount2==cartcount1,"Cart count not incrementing"
        print("Cart Count incremented by one")
Ejemplo n.º 2
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")
Ejemplo n.º 3
0
class Test_StockAvailabilty(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)

    @pytest.mark.run(order=1)
    def test_stock_availability(self):
        self.hp.select_category("Beauty")
        self.plp.select_product()
        assert "InStock" in self.pdp.verifystock(), "Product not available"
        print("Product in stock")
Ejemplo n.º 4
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_PageNavigation(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self, oneTimeSetUp):
        self.hp = HomePage(self.driver)
        self.plp = ProductListPage(self.driver)

    @pytest.mark.run(order=1)
    def test_nextpage_option(self):
        self.hp.select_category("Automotive")
        self.plp.select_subshopByCategory()
        page_num_before = self.plp.get_current_page_number()
        time.sleep(2)
        print(page_num_before)
        self.plp.goToNextPage()
        time.sleep(5)
        page_num_after = self.plp.get_current_page_number()
        print(page_num_after)
        time.sleep(5)
        assert page_num_after == str(int(page_num_before) +
                                     1), "Page is not navigated to next page"
        print("Page Navigation is working")