def Register_with_valid_input(self,email, nickname, password, firstname, surname, company, capacity, dateofbirth, phone, mobile,address, zipcode, town, country, how_do_you_know_our_website): self.driver.get(Conf.read_ini_config('Paths','RegisterURL')) self.driver.find_element(*RegistrationPage.Email).send_keys(email) self.driver.find_element(*RegistrationPage.Nickname).send_keys(nickname) self.driver.find_element(*RegistrationPage.Password).send_keys(password) self.driver.find_element(*RegistrationPage.FirstName).send_keys(firstname) self.driver.find_element(*RegistrationPage.Surname).send_keys(surname) self.driver.find_element(*RegistrationPage.Company).send_keys(company) self.driver.find_element(*RegistrationPage.Phone).send_keys(phone) self.driver.find_element(*RegistrationPage.Mobile).send_keys(mobile) self.driver.find_element(*RegistrationPage.Address).send_keys(address) self.driver.find_element(*RegistrationPage.Zipcode).send_keys(zipcode) self.driver.find_element(*RegistrationPage.Phone).send_keys(phone) self.driver.find_element(*RegistrationPage.Town).send_keys(town) self.driver.find_element(*RegistrationPage.Title).click() self.driver.find_element(*RegistrationPage.Capacity).send_keys(capacity) self.driver.find_element(*RegistrationPage.DateOfBirth).send_keys(dateofbirth) self.driver.find_element(*RegistrationPage.Country).send_keys(country) self.driver.find_element(*RegistrationPage.How_do_you_know_our_website).send_keys(how_do_you_know_our_website) self.driver.find_element(*RegistrationPage.Code).send_keys('12340') self.driver.find_element(*RegistrationPage.FirstSelection).click() self.driver.find_element(*RegistrationPage.SecondSelection).click() self.driver.find_element(*RegistrationPage.OpenAccount).click() alert =self.driver.find_element(*RegistrationPage.Thanks_Msg).text LoginLogoutPage.logout(self) return alert
def navigate_to_admin(self,username, password): if Conf.read_ini_config('Paths','HomeURL') in self.driver.current_url: self.driver.find_element(*AdminBase.admin_button).click() elif Conf.read_ini_config('Paths','AdminURL') not in self.driver.current_url: if self.driver.find_element(*LoginLogoutPage.login_link).text == 'Log in': LoginLogoutPage.login_with_valid_credentials(self,username,password) self.driver.get(Conf.read_ini_config('Paths','HomeURL')) self.driver.find_element(*AdminBase.admin_button).click()
def test_product_details(self,username,password,productName,Category): LoginLogoutPage.login_with_valid_credentials(self,username,password) SearchPage.search_data(self,productName,Category) ProductDetailsPage.get_product_details(self,productName) ProductDetailsPage.give_your_Opinion_page(self,'Very Good') ProductDetailsPage.get_product_details(self,productName) self.assertTrue(ProductDetailsPage.add_to_notePad_Page(self,productName)) ProductDetailsPage.get_product_details(self,productName) ProductDetailsPage.ge_details_tab(self)
def test_manage_billing(self,name,password,surAddress, surName, firstName, email, company, address, zipCode, town, country, phone): LoginLogoutPage.login_with_valid_credentials(self,name,password) ManageBillingAddressPage.navigate_to_manage_billing(self) old_billing_no = len(ManageBillingAddressPage.get_billingAddress_list(self).options) ManageBillingAddressPage.Create_Another_Address(self, surAddress, surName, firstName, email, company, address, zipCode, town, country, phone) # assert that the new address is created and added to drop down list self.assertIn('Your new address was created.', ManageBillingAddressPage.get_createAddress_msg(self)) self.assertEqual(old_billing_no+1, len(ManageBillingAddressPage.get_billingAddress_list(self).options)) self.assertEqual(old_billing_no+1 , len(ManageBillingAddressPage.get_shippingAddress_list(self).options)) # Make the added address is default billing and shipping address ManageBillingAddressPage.get_billingAddress_list(self).select_by_visible_text(surAddress) ManageBillingAddressPage.get_shippingAddress_list(self).select_by_visible_text(surAddress)
def Register_with_valid_input(self, password, firstname, surname, company, capacity, dateofbirth, phone, mobile, address, zipcode, town, country, how_do_you_know_our_website): self.driver.get(Conf.read_ini_config('Paths', 'RegisterURL')) self.driver.find_element(*RegistrationPage.Email).send_keys( *RegistrationPage.mail) self.driver.find_element(*RegistrationPage.Nickname).send_keys( *RegistrationPage.username) self.driver.find_element( *RegistrationPage.Password).send_keys(password) self.driver.find_element( *RegistrationPage.FirstName).send_keys(firstname) self.driver.find_element(*RegistrationPage.Surname).send_keys(surname) self.driver.find_element(*RegistrationPage.Company).send_keys(company) self.driver.find_element(*RegistrationPage.Phone).send_keys(phone) self.driver.find_element(*RegistrationPage.Mobile).send_keys(mobile) self.driver.find_element(*RegistrationPage.Address).send_keys(address) self.driver.find_element(*RegistrationPage.Zipcode).send_keys(zipcode) self.driver.find_element(*RegistrationPage.Phone).send_keys(phone) self.driver.find_element(*RegistrationPage.Town).send_keys(town) self.driver.find_element(*RegistrationPage.Title).click() self.driver.find_element( *RegistrationPage.Capacity).send_keys(capacity) self.driver.find_element( *RegistrationPage.DateOfBirth).send_keys(dateofbirth) self.driver.find_element(*RegistrationPage.Country).send_keys(country) self.driver.find_element(*RegistrationPage.How_do_you_know_our_website ).send_keys(how_do_you_know_our_website) self.driver.find_element(*RegistrationPage.Code).send_keys('12340') self.driver.find_element(*RegistrationPage.FirstSelection).click() self.driver.find_element(*RegistrationPage.SecondSelection).click() self.driver.find_element(*RegistrationPage.OpenAccount).click() alert = self.driver.find_element(*RegistrationPage.Thanks_Msg).text LoginLogoutPage.logout(self) return alert
def navigate_to_page(self,username, password): if Conf.read_ini_config('Paths','AdminURL') in self.driver.current_url: self.driver.get(Conf.read_ini_config('Paths','HomeURL')) if self.driver.find_element(*LoginLogoutPage.login_link).text == 'Log in': LoginLogoutPage.login_with_valid_credentials(self,username,password)
def test_smoke_testcase1(self,admin,adminpass,email,nickname,password,firstName,surname,company,capacity,dateofbirth,phone,mobile,address,zipcode,town,country,how_do_you_know_our_website, confirm): self.assertIn(confirm,RegistrationPage.Register_with_valid_input(self,email,nickname,password,firstName,surname,company,capacity,dateofbirth,phone,mobile,address,zipcode,town,country,how_do_you_know_our_website)) self.assertTrue(email,RegistrationPage.verify_user_at_DB(self,nickname)) self.assertIn(email,ManageUserPage.edit_user(self,admin,adminpass,email)) LoginLogoutPage.logout(self) self.assertEqual(email,LoginLogoutPage.login_with_valid_credentials(self,nickname,password))
def test_logout(self): LoginLogoutPage.logout(self)
def test_login_valid(self,username,password): self.assertEqual(username,LoginLogoutPage.login_with_valid_credentials(self,username,password))
def test_login_invalid(self,scen,username,password,error): self.assertTrue(error,LoginLogoutPage.login_with_Invalid_credentials(self, username,password))
def test_FollowOrder_valid(self, username, password): LoginLogoutPage.login_with_valid_credentials(self, username, password) self.assertEqual('Payment pending',FollowUpOrdersPage.FollowOrder(self))
def test_add(self, user, password): LoginLogoutPage.login_with_valid_credentials(self, user, password)
def test_payment(self,userName,password,productName,Category): LoginLogoutPage.login_with_valid_credentials(self,userName,password) SearchPage.search_data(self,productName,Category) self.assertIn('Confirmation of your order',PaymentPages.pay_product(self,'grey','Large','2')) self.driver.get_screenshot_as_file('screenshot_PayConfirm.jpg')
def test_search(self,username,password,scen,productName,Category,result): LoginLogoutPage.login_with_valid_credentials(self, username, password) self.assertIn(result,SearchPage.search_data(self,productName,Category))