def test9(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ppage = productPage(self.driver) ListOfLoc = [] for i in range(2): cpage.openRandomProduct(ListOfLoc) ppage.addNewProduct(3 - i) cpage.backAndWait() self.mpage.cartClick() shoppingc = shoppingCart(self.driver) shoppingc.checkOutButtonClick() log = User(self.driver) log.LogIn('By123','Cer1') orderp = orderPayment(self.driver) orderIdAfterPayment = orderp.paymentProcessMasterCredit() self.mpage.returnToMainPage() orderidOrders=User(self.driver).getLastOrderId() self.assertEqual(orderidOrders,orderIdAfterPayment) logTest("INFO", 9) except: logTest("ERROR", 9) logFails(9) self.fail()
def test6(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc = [] ppage = productPage(self.driver) for i in range(2): cpage.openRandomProduct(ListOfLoc) ppage.addNewProduct(3) cpage.backAndWait() productsDetails=self.mpage.getProductDetails() self.mpage.cartClick() cartpage=shoppingCart(self.driver) cartpage.editProduct(1) ppage.reduceQuantity(1) self.mpage.cartClick() cartpage.editProduct(1) ppage.reduceQuantity(1) productsDetails[0][1] = 2 productsDetails[1][1] = 2 self.assertTrue(self.mpage.cartCompare(productsDetails)) logTest("INFO", 6) except: logTest("ERROR", 6) logFails(6) self.fail()
def test5(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc = [] productsDetails = [] sum=0 ppage = productPage(self.driver) for i in range(3): cpage.openRandomProduct(ListOfLoc) productsDetails.append(ppage.addNewProduct(3 - i)) sum=sum+productsDetails[i][2] if(i==0): print("The products details are:") ppage.printProductDetails() cpage.backAndWait() shoppingc = shoppingCart(self.driver) self.mpage.cartClick() shoppingc.implicityWaitCartPage() checkoutprice=shoppingc.checkOut() sum=round(sum,2) checkoutprice=round(checkoutprice,2) self.assertEqual(checkoutprice,sum) logTest("INFO", 5) except: logTest("ERROR", 5) logFails(5) self.fail()
def test10(self): try: log=User(self.driver) log.LogIn('By1zx', 'Cb12') log.LogOut() logTest("INFO",10) except: logTest("ERROR", 10) logFails(10) self.fail()
def test7(self): try: self.mpage.enterCategoryPage('tablets') Ppage=productPage(self.driver) cpage= categoryPage(self.driver) cpage.openRandomProduct([]) Ppage.addNewProduct(1) cpage.backAndWait() self.assertTrue(cpage.categoryTitleEqual('TABLETS')) self.mpage.returnToMainPage() logTest("INFO", 7) except: logTest("ERROR", 7) logFails(7) self.fail()
def test1(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc=[] ppage = productPage(self.driver) for i in range(2): cpage.openRandomProduct(ListOfLoc) ppage.addNewProduct(3 - i) cpage.backAndWait() self.assertTrue(int(self.mpage.cartAmount())==5) logTest("INFO", 1) except: logTest("ERROR", 1) logFails(1) self.fail()
def test3(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc = [] ppage = productPage(self.driver) for i in range(2): cpage.openRandomProduct(ListOfLoc) ppage.addNewProduct(3 - i) cpage.backAndWait() productr=self.mpage.cartRemove() self.assertFalse(self.mpage.isInCart(productr)) logTest("INFO", 3) except: logTest("ERROR", 3) logFails(3) self.fail()
def test2(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc =[] productsDetails=[] ppage = productPage(self.driver) for i in range(3): cpage.openRandomProduct(ListOfLoc) productsDetails.append(ppage.addNewProduct(3-i)) cpage.backAndWait() self.assertTrue(self.mpage.cartCompare(productsDetails)) logTest("INFO", 2) except: logTest("ERROR", 2) logFails(2) self.fail()
def test4(self): try: self.mpage.enterCategoryPage(self.lCategory[self.categorynum]) cpage = categoryPage(self.driver) ListOfLoc = [] ppage = productPage(self.driver) for i in range(2): cpage.openRandomProduct(ListOfLoc) ppage.addNewProduct(3 - i) cpage.backAndWait() self.mpage.cartClick() cartp=shoppingCart(self.driver) cartp.implicityWaitCartPage() logTest("INFO", 4) except: logTest("ERROR", 4) logFails(4) self.fail()