def runTest(self): self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_ACCOUNT_BUTTON) self.homePage.click(Locators.HOME_MYACCOUNT_LINK) self.loginPage = Login(self.driver) self.loginPage.click(Locators.LOGIN_CREATEACCOUNT_BUTTON) self.createAccount = CreateAccount(self.driver) self.createAccount.enter_text(Locators.CREATEACCOUNT_FIRSTNAME, TestData.CREATEACCOUNT_FISTNAME) self.createAccount.enter_text(Locators.CREATEACCOUNT_MIDDLENAME, TestData.CREATEACCOUNT_MIDDLENAME) self.createAccount.enter_text(Locators.CREATEACCOUNT_LASTNAME, TestData.CREATEACCOUNT_LASTNAME) self.createAccount.enter_text(Locators.CREATEACCOUNT_EMAIL, TestData.CREATEACCOUNT_EMAIL) self.createAccount.enter_text(Locators.CREATEACCOUNT_PASSWORD, TestData.CREATEACCOUNT_PASSWORD) self.createAccount.enter_text(Locators.CREATEACCOUNT_CONFIRMPASSWORD, TestData.CREATEACCOUNT_PASSWORD) self.createAccount.click(Locators.CREATEACCOUNT_REGISTER_BUTTON) self.assertIn(self.createAccount.getText(Locators.ACCOUNT_MSG), TestData.ACCOUNT_MSG) self.account = Account(self.driver) self.account.click(Locators.ACCOUNT_TV_LINK) self.tv = Tv(self.driver) self.tv.click(Locators.TV_WISHLIST_LGLCD_LINK) self.mywishlist = MyWishlist(self.driver) self.mywishlist.click(Locators.MYWISHLIST_SHAREWISHLIST_BUTTON) self.sharemywishlist = ShareWishlist(self.driver) self.sharemywishlist.enter_text(Locators.SHAREWISHLIST_EMAIL, TestData.SHAREWISHLIST_EMAIL) self.sharemywishlist.click(Locators.SHAREWISHLIST_BUTTON) self.assertIn(self.mywishlist.getText(Locators.MYWISHLIST_MSG), TestData.SHAREWISHLIST_MSG)
class Test_4(BaseTest): def setUp(self): super(Test_4, self).setUp() def runTest(self): self.homePage = HomePage(self.driver) self.homePage.clickMobile(); self.mobilePage = Mobile(self.driver) self.mobilePage.click(Locators.MOBILE_ADDTOCOMPARE_XPERIA) self.mobilePage.click(Locators.MOBILE_ADDTOCOMPARE_IPHONE) self.mobilePage.click(Locators.MOBILE_COMPARE_BUTTON) allWindows = self.driver.window_handles self.driver.switch_to_window(allWindows[1]) self.assertIn(TestData.COMPARE_POPUP_HEADING.lower(), self.driver.find_element_by_tag_name("h1").text.lower()) self.assertIn(self.driver.find_element_by_xpath("//*[@id='product_comparison']/tbody[1]/tr[1]/td[1]/h2/a").text,"SONY XPERIA") self.assertIn(self.driver.find_element_by_xpath("//*[@id='product_comparison']/tbody[1]/tr[1]/td[2]/h2/a").text,"IPHONE") def tearDown(self): super(Test_4, self).tearDown()
def runTest(self): self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_ACCOUNT_BUTTON) self.homePage.click(Locators.HOME_MYACCOUNT_LINK) self.loginPage = Login(self.driver) self.loginPage.enter_text(Locators.LOGIN_EMAIL, TestData.CREATEACCOUNT_EMAIL) self.loginPage.enter_text(Locators.LOGIN_PASSWORD, TestData.CREATEACCOUNT_PASSWORD) self.loginPage.click(Locators.LOGIN_LOGIN_BUTTON) self.account = Account(self.driver) self.account.click(Locators.ACCOUNT_REORDER_LINK) self.cart = Cart(self.driver) preGrandTotal = self.cart.getText(Locators.CART_GRANDTOTAL) self.cart.enter_text(Locators.CART_INPUT_QTY, TestData.CART_QTY) self.cart.click(Locators.CART_UPDATE_QTY) postGrandTotal = self.cart.getText(Locators.CART_GRANDTOTAL) self.assertNotEqual(preGrandTotal, postGrandTotal) self.cart.click(Locators.CART_PROCEEDTOCHECKOUT_BUTTON) self.checkout = Checkout(self.driver) self.checkout.click(Locators.CHECKOUT_BILLINGINFO_CONTINUEBUTTON) self.checkout.click(Locators.CHECKOUT_SHIPPINGMETHOD_CONTINUEBUTTON) self.checkout.click(Locators.CHECKOUT_CHECKMONEY_RADIO) self.checkout.click( Locators.CHECKOUT_PAYMENTINFORMATION_CONTINUEBUTTON) self.checkout.click(Locators.CHECKOUT_PLACEORDER) self.typ = ThankYouPage(self.driver) orderNumber = self.typ.getText(Locators.THANKYPAGE_ORDERNUMBER) self.assertIsNot(orderNumber, "")
class Test_7(BaseTest): def setUp(self): super(Test_7, self).setUp() def runTest(self): self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_ACCOUNT_BUTTON) self.homePage.click(Locators.HOME_MYACCOUNT_LINK) self.loginPage = Login(self.driver) self.loginPage.enter_text(Locators.LOGIN_EMAIL, TestData.CREATEACCOUNT_EMAIL) self.loginPage.enter_text(Locators.LOGIN_PASSWORD, TestData.CREATEACCOUNT_PASSWORD) self.loginPage.click(Locators.LOGIN_LOGIN_BUTTON) self.account = Account(self.driver) self.account.click(Locators.ACCOUNT_MYORDERS_LINK) self.myorders = MyOrders(self.driver) self.assertIn(self.myorders.getText(Locators.MYORDERS_STATUSFIRSTORDER), TestData.MYORDERS_PENDING_STATUS) self.myorders.click(Locators.MYORDERS_VIEWORDER_LINK) self.myorders.click(Locators.MYORDERS_FIRSTORDER) def tearDown(self): super(Test_7, self).tearDown()
def runTest(self): self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_ACCOUNT_BUTTON) self.homePage.click(Locators.HOME_MYACCOUNT_LINK) self.loginPage = Login(self.driver) self.loginPage.enter_text(Locators.CREATEACCOUNT_EMAIL) self.loginPage.enter_text(Locators.CREATEACCOUNT_PASSWORD) self.loginPage.click(Locators.LOGIN_LOGIN_BUTTON) self.account = Account(self.driver) self.account.click(Locators.ACCOUNT_MYWISHLIST_LINK) self.mywishlist = MyWishlist(self.driver) self.mywishlist.click(Locators.MYWISHLIST_ADDTOCART_BUTTON) self.cart = Cart(self.driver) self.cart.setSelectorVisibleText(Locators.CART_COUNTRY_SELECTOR, TestData.CART_COUNTRY_SELECTOR) self.cart.setSelectorVisibleText(Locators.CART_REGION_SELECTOR, TestData.CART_STATE_SELECTOR) self.cart.enter_text(Locators.CART_ZIPCODE_INPUT, TestData.CART_ZIP) self.cart.click(Locators.CART_ESTIMATE_LINK) self.assertIn(Locators.CART_SHIPPINGCOST, TestData.CART_FLAT_RATE) self.cart.click(Locators.CART_RATE_RADIO) self.cart.click(Locators.CART_UPDATETOTAL_BUTTON) self.cart.click(Locators.CART_PROCEEDTOCHECKOUT_BUTTON) self.checkout = Checkout(self.driver) self.checkout.enter_text(Locators.CHECKOUT_FIRSTNAME, TestData.CREATEACCOUNT_FISTNAME) self.checkout.enter_text(Locators.CHECKOUT_LASTNAME, TestData.CREATEACCOUNT_LASTNAME) self.checkout.enter_text(Locators.CHECKOUT_ADDRESS, TestData.CHECKOUT_ADDRESS) self.checkout.enter_text(Locators.CHECKOUT_CITY, TestData.CHECKOUT_CITY) self.checkout.setSelectorVisibleText(Locators.CART_REGION_SELECTOR, TestData.CART_STATE_SELECTOR) self.checkout.enter_text(Locators.CHECKOUT_ZIP, TestData.CART_ZIP) self.checkout.setSelectorVisibleText(Locators.CART_COUNTRY_SELECTOR, TestData.CART_COUNTRY_SELECTOR) self.checkout.enter_text(Locators.CHECKOUT_TELEPHONE, TestData.CHECKOUT_TELEPHONE) self.checkout.click(Locators.CHECKOUT_BILLINGINFO_CONTINUEBUTTON) self.checkout.click(Locators.CHECKOUT_SHIPPINGMETHOD_CONTINUEBUTTON) self.checkout.click(Locators.CHECKOUT_CHECKMONEY_RADIO) self.checkout.click( Locators.CHECKOUT_PAYMENTINFORMATION_CONTINUEBUTTONA) self.checkout.click(Locators.CHECKOUT_PLACEORDER) self.thankpage = ThankYouPage(self.driver) self.assertNotEqual( self.thankpage.getText(Locators.THANKYPAGE_ORDERNUMBER), "")
def runTest(self): self.homePage = HomePage(self.driver) self.assertIn(TestData.HOME_TITLE, self.homePage.getTitle()) self.homePage.clickMobile() self.mobilePage = Mobile(self.driver) self.assertIn(TestData.MOBILE_TITLE, self.mobilePage.getTitle()) self.mobilePage.setSelectorVisibleText(Locators.DROPDOWN, "Name") self.assertIn(TestData.FIRST_PRODUCT_NAME, self.mobilePage.getItemText((Locators.PRODUCT_NAME), 0))
class Test_12(BaseTest): def setUp(self): super(Test_12, self).setUp() def runTest(self): self.review = Review(self.driver) self.review.enter_text(Locators.REVIEWPAGE_REVIEW_FIELD, TestData.REVIEW_TEXT) self.review.enter_text(Locators.REVIEWPAGE_SUMMARY_FIELD, TestData.REVIEW_SUMMARY) self.review.enter_text(Locators.REVIEWPAGE_NICKNAME_FIELD, TestData.REVIEW_NICKNAME) self.review.click(Locators.REVIEWPAGE_SUBMIT_BUTTON) self.loginBack = LoginBack(self.driver) self.loginBack.enter_text(Locators.LOGINBACK_USERNAME_INPUT, TestData.LOGINBACK_USERNAME) self.loginBack.enter_text(Locators.LOGINBACK_PASSWORD_INPUT, TestData.LOGINBACK_PASSWORD) self.loginBack.click(Locators.LOGINBACK_LOGIN_BUTTON) self.customersBack = CustomersBack(self.driver) self.customersBack.click(Locators.CUSTOMERSBACK_CLOSEALERT) self.customersBack.click(Locators.CUSTOMERSBACK_CATALOG_LINK) self.customersBack.click(Locators.CUSTOMERSBACK_REVIEWS_AND_RATINGS) self.customersBack.click(Locators.CUSTOMERSBACK_CUSTOMER_REVIEWS) self.customersBack.click(Locators.CUSTOMERSBACK_PENDING_REVIEWS) self.pendingReviewsBack = PendingReviewsBack(self.driver) self.pendingReviewsBack.click(Locators.PENDINGREVIEWSBACK_REVIEW_ID) self.pendingReviewsBack.click(Locators.PENDINGREVIEWSBACK_EDIT_LINK) self.editReviewBack = EditReviewBack(self.driver) self.editReviewBack.setSelectorVisibleText( Locators.EDITREVIEWBACK_STATUS, "Approved") self.editReviewBack.click(Locators.EDITREVIEWBACK_SAVE_REVIEW) self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_MOBILE_LINK) self.mobile = Mobile(self.driver) self.mobile.click(Locators.MOBILE_IMAGE_XPERIA) self.mobile.click(Locators.MOBILE_REVIEW_TAB) self.assertIn( self.mobile.getText(Locators.MOBILE_REVIEW_COMMENT).upper(), TestData.REVIEW_SUMMARY.upper()) def tearDown(self): super(Test_12, self).tearDown()
def runTest(self): self.homePage = HomePage(self.driver) self.homePage.clickMobile() self.mobilePage = Mobile(self.driver) XperiaPriceCategoryPage = self.mobilePage.getText( Locators.MOBILE_PRODUCT_PRICE) self.mobilePage.click(Locators.MOBILE_IMAGE_XPERIA) self.productPage = ProductPage(self.driver) XperiaPriceProductPage = self.productPage.getText( Locators.PP_MOBILE_PRICE) print(XperiaPriceCategoryPage) self.assertIn(XperiaPriceCategoryPage, XperiaPriceProductPage)
def runTest(self): self.homePage = HomePage(self.driver) self.homePage.click(Locators.HOME_MOBILE_LINK) self.mobile = Mobile(self.driver) self.mobile.click(Locators.MOBILE_ADDTOCART_IPHONE) self.cart = Cart(self.driver) pricebeforecoupon = self.cart.getText(Locators.CART_GRANDTOTAL) self.cart.enter_text(Locators.CART_COUPONCODE_INPUT, TestData.CART_COUPONCODE) priceaftercoupon = self.cart.getText(Locators.CART_GRANDTOTAL) self.assertEqual( float(pricebeforecoupon[1:]) * (1 - TestData.CART_DISCOUNT), float(priceaftercoupon[1:]))
def runTest(self): self.homePage = HomePage(self.driver) self.homePage.clickMobile(); self.mobilePage = Mobile(self.driver) self.mobilePage.click(Locators.MOBILE_ADDTOCART_XPERIA) self.cartPage = Cart(self.driver) self.cartPage.enter_text(Locators.CART_INPUT_QTY,TestData.CART_QTY) self.cartPage.click(Locators.CART_UPDATE_QTY) self.assertIn(TestData.CART_MAXIMUMQTY_ALLOWED,self.cartPage.getText(Locators.CART_ERROR_MSG)) self.cartPage.click(Locators.CART_EMPTYCART_BUTTON) self.assertIn(TestData.CART_CARTEMPTY,self.cartPage.getText(Locators.CART_EMPTYCART_MST))
class Test_1(BaseTest): def setUp(self): super(Test_1, self).setUp() def runTest(self): self.homePage = HomePage(self.driver) self.assertIn(TestData.HOME_TITLE, self.homePage.getTitle()) self.homePage.clickMobile() self.mobilePage = Mobile(self.driver) self.assertIn(TestData.MOBILE_TITLE, self.mobilePage.getTitle()) self.mobilePage.setSelectorVisibleText(Locators.DROPDOWN, "Name") self.assertIn(TestData.FIRST_PRODUCT_NAME, self.mobilePage.getItemText((Locators.PRODUCT_NAME), 0)) def tearDown(self): super(Test_1, self).tearDown()
class Test_14(BaseTest): def setUp(self): super(Test_14, self).setUp() def runTest(self): global p self.home = HomePage(self.driver) self.home.click(Locators.HOME_ADVANCE_SEARCH) self.advanceSearch = AdvanceSearch(self.driver) self.advanceSearch.enter_text(Locators.ADVANCESEARCH_PRICE, "0") self.advanceSearch.enter_text(Locators.ADVANCESEARCH_PRICETO, TestData.ADVANCESEARCH_PRICETO1) self.advanceSearch.click(Locators.ADVANCESEARCH_SEARCH_BUTTON) self.advanceSearchResult = AdvanceSearchResult(self.driver) lista1 = self.advanceSearch.getAllItems( Locators.ADVANCESEARCH_PRODUCT_NAME) lista2 = self.advanceSearchResult.getAllItems( Locators.ADVANCESEARCH_PRODUCT_PRICE) for p in range(len(lista1)): print(lista1[p].text) for q in range(len(lista2)): print(lista2[p].text) self.driver.back() self.advanceSearch.enter_text(Locators.ADVANCESEARCH_PRICE, TestData.ADVANCESEARCH_PRICE2) self.advanceSearch.enter_text(Locators.ADVANCESEARCH_PRICETO, TestData.ADVANCESEARCH_PRICETO2) self.advanceSearch.click(Locators.ADVANCESEARCH_SEARCH_BUTTON) lista1 = self.advanceSearch.getAllItems( Locators.ADVANCESEARCH_PRODUCT_NAME) lista2 = self.advanceSearchResult.getAllItems( Locators.ADVANCESEARCH_PRODUCT_PRICE) for p in range(len(lista1)): print(lista1[p].text) for q in range(len(lista2)): print(lista2[p].text) def tearDown(self): super(Test_14, self).tearDown()
class Test_2(BaseTest): def setUp(self): super(Test_2, self).setUp() def runTest(self): self.homePage = HomePage(self.driver) self.homePage.clickMobile() self.mobilePage = Mobile(self.driver) XperiaPriceCategoryPage = self.mobilePage.getText( Locators.MOBILE_PRODUCT_PRICE) self.mobilePage.click(Locators.MOBILE_IMAGE_XPERIA) self.productPage = ProductPage(self.driver) XperiaPriceProductPage = self.productPage.getText( Locators.PP_MOBILE_PRICE) print(XperiaPriceCategoryPage) self.assertIn(XperiaPriceCategoryPage, XperiaPriceProductPage) def tearDown(self): super(Test_2, self).tearDown()