class sendEmailTestCases(BaseTestCase): @data(*ReadExcel.get_sheet('../Utilities/Data.xlsx', 'Admin')) @unpack def test_add(self, user, password): LoginLogoutPage.login(self, user, password) @data(*ReadExcel.get_sheet('../Utilities/Data.xlsx', 'SendEmail')) @unpack def test_send_email_successfully(self, SenderName, SenderEmail, RecName, RecEmails, comment): ProductDetailsPage.get_product_details(self, 'trouser') ProductDetailsPage.send_email(self) conformation_Msg = SendEmailClass.send_Email_successfully( self, SenderName, SenderEmail, RecName, RecEmails, comment) self.assertTrue('Your message has been sent.', conformation_Msg) SendEmailClass.back_to_product_Page(self) def test_send_empty_data(self): ProductDetailsPage.send_email(self) errorMessage = 'The form content is invalid (unvalid email ou missing data). Please click "back" and fill the forms with correct answers.' self.assertTrue(errorMessage, SendEmailClass.send_Email_empty_data(self)) def test_Open_Outlook(self): SendEmailClass.open_outlook(self, '*****@*****.**', 'Gaso3113')
class FollowUpOrder(BaseTestCase): @data(*ReadExcel.get_sheet('../Utilities/Data.xlsx', 'Admin')) @unpack def test_FollowOrder_valid(self, username, password): LoginLogoutPage.login_with_valid_credentials(self, username, password) self.assertEqual('Payment pending', FollowUpOrdersPage.FollowOrder(self))
class MangeBilling(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'ShppingAddress'])) @unpack 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)
class AddPromotionCode(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Coupon'])) @unpack def test_Add_Promotion(self, username, password, name, start, end, amount): self.assertIn( '×\nThe coupon code {} has been created.'.format(name.upper()), AddPromotionCodePage.AddCoupon(self, username, password, name, start, end, amount))
class Category(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Categories'])) @unpack def test_add_category(self, name, password, categoryname, parent): self.assertTrue( CategoryPage.add_category(self, name, password, categoryname, parent)) @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Categories'])) @unpack def test_delete_category(self, username, password, categoryname, parent): self.assertIn( 'The category {} has been deleted'.format(categoryname), CategoryPage.delete_category(self, username, password, categoryname))
class Search(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Search'])) @unpack def test_search(self, username, password, scen, productName, Category, result): LoginLogoutPage.login(self, username, password) self.assertIn(result, SearchPage.search_data(self, productName, Category))
class Payment(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx',['Admin','Products'])) @unpack 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')
class ProductDetails(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Products'])) @unpack def test_product_details(self, username, password, productName, Category): LoginLogoutPage.login(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)
class Product(BaseTestCase): """@data(*ReadExcel.get_sheets('../Utilities/Data.xlsx',['Admin','Clothes'])) @unpack def test_Add_Product(self,username,password,position,reference,code,price,name,short,description): self.assertIn(name,ProductsModule.AddProduct(self,username,password,int(position),reference,code,int(price),name,short,description)) @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx',['Admin','Clothes'])) @unpack def test_pdelete(self,username,password,position,reference,code,price,name,short,description): ProductsModule.delete_product(self,username,password,name)""" @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Product instructions'])) @unpack def test_edit_product(self, username, password, name, tab1, tab2): ProductsModule.uppload_image(self, username, password, name) ProductsModule.edit_product(self, username, password, name, tab1, tab2)
class FlashSale(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'flash'])) @unpack def test_Add_flash_sale(self, username, password, amount, start, end, product_name): self.assertIn( '×\nChanges to product {} have been taken into account.'.format( product_name), FlashSalePage.add_flash_sale_to_product(self, username, password, amount, start, end, product_name)) self.assertEqual( amount, FlashSalePage.verify_flash_sale_price(self, username, password, product_name)) self.assertTrue( True, FlashSalePage.verify_remaining_time_to_end_sale( self, username, password, product_name, end))
class OpenAccount(BaseTestCase): @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Admin'])) @unpack def test_OpenAccount(self, admin, adminpass, 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, password, firstName, surname, company, capacity, dateofbirth, phone, mobile, address, zipcode, town, country, how_do_you_know_our_website)) self.assertTrue(RegistrationPage.mail, RegistrationPage.verify_user_at_DB(self)) self.assertIn( RegistrationPage.mail, ManageUserPage.edit_user(self, admin, adminpass, RegistrationPage.mail))
class Smoke(BaseTestCase): @unpack @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Admin', 'Registration'])) def test_smoke_testcase1(self, admin, adminpass, 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, password, firstName, surname, company, capacity, dateofbirth, phone, mobile, address, zipcode, town, country, how_do_you_know_our_website)) self.assertTrue(RegistrationPage.mail, RegistrationPage.verify_user_at_DB(self)) self.assertIn( RegistrationPage.mail, ManageUserPage.edit_user(self, admin, adminpass, RegistrationPage.mail)) LoginLogoutPage.logout(self) self.assertEqual( RegistrationPage.mail, LoginLogoutPage.login(self, RegistrationPage.username, password)) @unpack @data(*ReadExcel.get_sheets('../Utilities/Data.xlsx', ['Products', 'ShppingAddress'])) def test_smoke_testcase2(self, productName, Category, surAddress, surName, firstName, email, company, address, zipCode, town, country, phone): 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) 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') self.assertEqual('Payment pending', FollowUpOrdersPage.FollowOrder(self))