def test_checkElements(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Login' # Test scope - Check that HeaderMenu, FooterMenu, SearchField, INFO Banner are present on HomePage for UnAuthorized User time.sleep(3) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.assertIs(True, HomePage.checkHeaderMenuPresent(self)) self.assertIs(True, HomePage.checkFooterMenuPresent(self)) self.assertIs(True, HomePage.checkSearchPresent(self)) # Test scope - Check that HeaderMenu, FooterMenu, SearchField, INFO Banner are present on HomePage for Authorized User driver.get(url_1) LoginPage.logIn(self, "svetast555", "Ss123456") HelperTestBase.waitLogOutLink(self) driver.get(self.base_url) time.sleep(5) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.assertIs(True, HomePage.checkHeaderMenuPresent(self)) self.assertIs(True, HomePage.checkFooterMenuPresent(self)) self.assertIs(True, HomePage.checkSearchPresent(self))
def test_registrationAgeUnder18(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' url_2 = self.base_url + '/Account/ApplyNow' url_3 = self.base_url + '/Account/ApplyNow#' x = random.randint(10, 1000) text3 = 'Employment Information' text4 = 'Personal Information' text7 = 'We’re sorry.' text8 = 'We were unable to locate enough information to approve you for a spending limit at this time.' LoginPage.startRegistration(self) ##### Page 1: START ########### PORTAL = 'mainstreet' RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') HelperTestBase.waitNextButton(self) ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='6547899123', portal=PORTAL) ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4_AgeLimitation(self, ssn='121512230', driverLic='555555555', state='PA') time.sleep(35) self.assertIn(text7, self.driver.page_source) self.assertIn(text8, self.driver.page_source) ### Check that Home button is present: RegistrationPage5.clickHomeButton(self) ### click on Home button => Home Page is opened, INFO banner, Header menu, Footer menu, Search field are presennt: self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.assertIs(True, HomePage.checkHeaderMenuPresent(self)) self.assertIs(True, HomePage.checkFooterMenuPresent(self)) self.assertIs(True, HomePage.checkSearchPresent(self))
def test_CartQTY(self): """Test scope - impossible add to Cart : 0, 100, empty data, invalid data => appropriate message is displayed. The 'No items found in your cart.' is displayed after product has been removed from Cart.""" driver = self.driver driver.get(self.base_url + '/Account/Login') url_2 = self.base_url + '/cart' text1 = 'No items found in your cart.' text5 = 'Change Payment Method' LoginPage.logIn(self, "svetast555", "Ss123456") HomePage.submitSearch(self, 'canon') time.sleep(3) SearchResultsPage.clickAddToCart(self) driver.get(url_2) time.sleep(2) CartPage.clickChangePaymentInfoLink(self) time.sleep(3) self.assertIn(text5, self.driver.page_source) self.driver.back() CartPage.clickContinueShoppingButton(self) time.sleep(6) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.driver.back() time.sleep(5) CartPage.setQTY(self, '100') time.sleep(5) self.assertIs(True, CartPage.checkErrorMessagePresent(self)) self.driver.refresh() CartPage.setQTY(self, '') time.sleep(5) self.assertIs(True, CartPage.checkErrorMessagePresent(self)) self.driver.refresh() CartPage.setQTY(self, 'As!@#$%^&*()_-+<>?') time.sleep(5) self.assertIs(True, CartPage.checkErrorMessagePresent(self)) self.driver.refresh() self.driver.refresh() CartPage.setQTY(self, '0') time.sleep(5) self.assertIs(True, CartPage.checkErrorMessagePresent(self)) self.driver.refresh() CartPage.setQTY(self, '1') CartPage.clickCheckoutButton(self) time.sleep(5) CartPage.clickEditButton(self) CartPage.clickRemoveFromCartButton(self) time.sleep(5) self.assertIn(text1, self.driver.page_source)
def test_LeaseSuccessSTAGE_NewUser(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' x = random.randint(100, 10000) text6 = 'Congratulations!' text1 = 'Thank you.' text2 = 'No items found in your cart.' url_2 = self.base_url + '/cart' s = '/Secure/Orders/OrderManagement/ViewOrders/Default.aspx' url_3 = 'https://admin.xxx.com' self.driver.get(url_1) PORTAL = 'mainstreet' ##### Page 1: START Let’s Create Your Account ########### RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') HelperTestBase.waitNextButton(self) ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='1212121212', portal=PORTAL) ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4(self, ssn='121512230', driverLic='555555555', state="AL") ######## Page5: Payment Information ########################### RegistrationPage5.fillForm5(self, accountType='DebitCard', cardNumber='5454-5454-5454-5454', cvv="1234", month='12', year='2021') time.sleep(35) self.assertIn(text6, self.driver.page_source) RegistrationPage5.clickContinueButton(self) time.sleep(15) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) ### Precondition : check that Cart is empty: driver.get(url_2) self.assertIn(text2, self.driver.page_source) ### test scope : add the item to Cart: HomePage.submitSearch(self, 'canon') SearchResultsPage.clickAddToCart(self) self.driver.get(url_2) time.sleep(5) ### test scope : click on Checkout button : CartPage.clickCheckoutButton(self) time.sleep(3) ### test scope : click on Price Reviewed Opt In , ReviewYourLease buttons: CartPage.selectPriceReviewedOptIn(self) CartPage.clickReviewYourLease(self) ### test scope : check that user accepted the Lease: LeasePage.signAgreement(self, firstName='sveta', lastName=' step' + str(x)) time.sleep(100) self.assertIn(text1, self.driver.page_source) driver.get(url_2) time.sleep(8) self.assertIn(text2, self.driver.page_source) # time.sleep(10) ##### Checking - Admin can canceled payment ########## driver.get(url_3) time.sleep(8) ConfiguratorAdminPage.loginAdminStage(self) driver.get(url_3 + s) time.sleep(10) OrdersAdminPage.findOrdersByLastname(self, 'step' + str(x)) OrdersAdminPage.clickManageOrder(self) OrdersAdminPage.clickUpdateOrderStatus(self) OrdersAdminPage.clickCancelOrder(self) time.sleep(30) OrdersAdminPage.clickBackToOrderList(self)
def test_checkNavigation(self): driver = self.driver driver.get(self.base_url + '/Account/Dashboard') text1 = self.base_url + '/account/orderhistory' text2 = self.base_url + '/account/ordershipping' text3 = self.base_url + '/account/Settings' text4 = self.base_url + '/account/addressbook' text5 = self.base_url + '/LTO/EditEmploymentInformation' text6 = self.base_url + '/LTO/EditPersonalInformation' text7 = 'Change Payment Method' text9 = self.base_url + '/account/dashboard' text10 = "Register to Make Payments" LoginPage.logIn(self, "svetast555", "Ss123456") ManageAccountPage.clickOrderHistory(self) time.sleep(2) self.assertEqual(text1, HelperTestBase.getURL(self)) self.driver.back() ManageAccountPage.clickTrackShipping(self) time.sleep(2) self.assertEqual(text2, HelperTestBase.getURL(self)) self.driver.back() ManageAccountPage.clickAccountSettings(self) time.sleep(2) self.assertEqual(text3, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkNewPasswordFieldPresent(self)) self.assertIs(True, ManageAccountPage.checkNewEmailAddressFielfPresent(self)) self.driver.back() time.sleep(5) ManageAccountPage.clickAddressAndPhone(self) time.sleep(2) self.assertEqual(text4, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkAddressFieldPresent(self)) self.assertIs(True, ManageAccountPage.checkZipCodeFielfPresent(self)) self.assertIs(True, ManageAccountPage.checkMobilePhoneFielfPresent(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickEmploymentInformation(self) time.sleep(2) self.assertEqual(text5, HelperTestBase.getURL(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickPersonalInformation(self) time.sleep(2) self.assertEqual(text6, HelperTestBase.getURL(self)) self.assertIs(True, ManageAccountPage.checkSaveButton_Present(self)) self.assertIs(True, ManageAccountPage.checkCancelButton_Present(self)) self.assertIs(True, ManageAccountPage.checkSSNPresent(self)) self.assertIs(True, ManageAccountPage.checkDriverLisensePresent(self)) self.assertIs(True, ManageAccountPage.checkDriverLisenseStatePresent(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickChangePaymentMethod(self) time.sleep(2) self.assertIn(text7, self.driver.page_source) self.driver.back() time.sleep(2) ManageAccountPage.clickAccountSummary(self) time.sleep(2) self.assertEqual(text9, HelperTestBase.getURL(self)) self.driver.back() time.sleep(2) ManageAccountPage.clickShopNow(self) time.sleep(2) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) self.driver.back() time.sleep(2) #### add checking if self.driver.find_element_by_partial_link_text( "Click Here to go to").is_displayed(): ManageAccountPage.clickToGoTo(self) time.sleep(10) windows = driver.window_handles driver.switch_to.window(windows[1]) self.assertIn(text10, self.driver.page_source) self.driver.back() time.sleep(2)
def test_registration_GetSpendingLimitSuccess(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' url_2 = self.base_url + '/Account/ApplyNow' url_3 = self.base_url + '/Account/ApplyNow#' x = random.randint(100, 10000) text3 = 'Employment Information' text4 = 'Personal Information' text5 = 'Payment Information' text6 = 'Congratulations!' PORTAL = 'mainstreet' time.sleep(3) driver.get(self.base_url + '/Account/Signup') # self.assertEqual(url_1, HelperTestBase.getURL(self)) ##### Page 1: START Let’s Create Your Account ########### RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') # self.assertEqual(url_2, HelperTestBase.getURL(self)) HelperTestBase.waitNextButton(self) ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='7777777777', portal=PORTAL) time.sleep(20) self.assertEqual(url_3, HelperTestBase.getURL(self)) self.assertIn(text3, self.driver.page_source) ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') time.sleep(5) # self.assertIn(text4, self.driver.page_source) ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4(self, ssn='121512230', driverLic='555555555', state="AL") time.sleep(10) self.assertIn(text5, self.driver.page_source) ######## Page5: Payment Information ########################### RegistrationPage5.fillForm5(self, accountType='DebitCard', cardNumber='5454-5454-5454-5454', cvv="1234", month='12', year='2021') time.sleep(35) self.assertIn(text6, self.driver.page_source) RegistrationPage5.clickContinueButton(self) time.sleep(15) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) HomePage.logOut(self) #####Test scope - new user can Log In with credentials: driver.get(self.base_url + '/Account/Login') LoginPage.logIn(self, "svetast" + str(x), "Ss123456") self.assertIs(True, HomePage.checkLogOutLink(self))
def test_LeaseSuccess_NewUser(self): driver = self.driver driver.get(self.base_url) url_1 = self.base_url + '/Account/Signup' url_2 = self.base_url + '/Account/ApplyNow' url_3 = self.base_url + '/Account/ApplyNow#' x = random.randint(100, 10000) text3 = 'Employment Information' text4 = 'Personal Information' text5 = 'Payment Information' text6 = 'Congratulations!' time.sleep(3) driver.get(self.base_url + '/Account/Signup') self.driver.refresh() ##### Page 1: START Let’s Create Your Account ########### RegistrationPage1.fillForm1(self, email='*****@*****.**', username='******' + str(x), password="******", passwordConfirm="Ss123456", answer='valya') ################## Page2 : Contact Information ######################### RegistrationPage2.fillForm2(self, firstName='sveta', lastName='step' + str(x), phone='121212121212', portal='mainstreet') ################## Page3: Employment Information ######################### RegistrationPage3.fillForm3(self, employerName='Private Firm Niagara', empPhone='5986547899', income='9999', ohterIncome='') ################## Page4: Personal Information ######################### RegistrationPage4.fillForm4(self, ssn='121512230', driverLic='555555555', state="AL") time.sleep(5) self.assertIn(text5, self.driver.page_source) ######## Page5: Payment Information ########################### RegistrationPage5.fillForm5(self, accountType='DebitCard', cardNumber='5454-5454-5454-5454', cvv="1234", month='12', year='2021') time.sleep(35) self.assertIn(text6, self.driver.page_source) RegistrationPage5.clickContinueButton(self) time.sleep(15) self.assertIs(True, HomePage.checkINFOBannerPresent(self)) text1 = 'Thank you.' text2 = 'No items found in your cart.' url_2 = self.base_url + '/cart' ### Precondition : check that Cart is empty: driver.get(url_2) self.assertIn(text2, self.driver.page_source) ### test scope : add the item to Cart: HomePage.submitSearch(self, 'canon') SearchResultsPage.clickAddToCart(self) self.driver.get(url_2) time.sleep(5) ### test scope : click on Checkout button : CartPage.clickCheckoutButton(self) time.sleep(5) ### test scope : click on Price Reviewed Opt In , ReviewYourLease buttons: CartPage.selectPriceReviewedOptIn(self) CartPage.clickReviewYourLease(self) ### test scope : check that user accepted the Lease: LeasePage.signAgreement(self, firstName='sveta', lastName=' step' + str(x)) time.sleep(100) self.assertIn(text1, self.driver.page_source) driver.get(url_2) time.sleep(8) self.assertIn(text2, self.driver.page_source)