class SmokeTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) #self.np = NavigationPage(self.driver) self.re = RegisterAgentPage(self.driver) @pytest.mark.run(order=1) @data(*getCSVData( "/Users/enriquealejandro.d/PycharmProjects/WKSelenium/testdata.csv")) @unpack def test_valid(self, user, password, domesticCSV, countyCSV, companyCSV, ccvCSV): self.lp.login(user, password) self.re.registerAgent(domestic=domesticCSV, county=countyCSV, companyname=companyCSV, cvv=ccvCSV) result2 = self.re.verifyOrderConfirmation() result3 = self.re.captureOrderNumber() self.re.logoutMyCT() self.ts.mark(result2, "Order Created" + str(result3)) self.ts.markFinal("test_sanity_registeredAgent", result2, "Order was placed correctly")
def onetime_setup(request,browser): print("Running one time setup") wdf=WebDriverFactory(browser) driver=wdf.getWebdriverInstance() lp = LP(driver) lp.loginsuccess('*****@*****.**', 'abcabc') if request.cls is not None: request.cls.driver=driver yield driver cp=CP(driver) cp.click_logout_CP_summed() sleep(2) driver.close()
def OneTimeSetUP(request, browser): print(" Running class level SetUp") # if browser == 'chrome': # ######### # # reCAPTCHA ISSUE WORKOROUND in Chrome webbrowser # # https://www.loom.com/share/f2a51d18919d4b70a6d837524ff0e018 # ################ # # first open chrome://version/ # # than copy profilepath from there # # here in this computer path is # # /Users/parulagarwal/Library/Application Support/Google/Chrome/Default # # paste it in opt.argument() and follow the following steps # # opt = webdriver.ChromeOptions() # opt.add_argument("user-data-dir=/Users/parulagarwal/Library/Application Support/Google/Chrome/Default") # baseUrl = "https://learn.letskodeit.com/" # driver = webdriver.Chrome(options=opt) # driver.get(baseUrl) # driver.maximize_window() # driver.implicitly_wait(10) # print("Running test on Chrome") # else: # baseUrl = "https://learn.letskodeit.com/" # driver = webdriver.Firefox() # driver.get(baseUrl) # driver.maximize_window() # driver.implicitly_wait(10) # print("Running test on Firefox") wd = WebDriverFactory(browser) driver = wd.getWebDriverInstance() # create login_page instance here and login to application lp = LoginPage(driver) lp.login('*****@*****.**', 'abcabc') # means if the class attribute we re getting request from is not None if request.cls is not None: # then this value will be avilable to complete class instance request.cls.driver = driver # this will return value to the place where this OneTimeSetUp fixture is used yield driver driver.quit() print(" Running class level Teardown")
class IncorporateTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) #self.np = NavigationPage(self.driver) self.ic = IncorCompanyPage(self.driver) @pytest.mark.run(order=1) def test_registeredagent(self): self.lp.login("*****@*****.**", "Today123") #result1 = self.lp.verifyTitle() #self.ts.mark(result1, "Title Verified") self.ic.incorpService("Connecticut", "Test", "Company_Test", "243") result2 = self.ic.verifyOrderConfirmation() result3 = self.ic.captureOrderNumber() self.ts.mark(result2, "Order Created" + str(result3)) self.ts.markFinal("test_sanity_registeredAgent", result2, "Order was placed correctly Incorporate Services")
class Test_login(): @pytest.fixture(autouse=True) def classlevelsetup(self,onetime_setup): self.lp=LP(self.driver) self.npc=NPC(self.driver) self.ts=TS(self.driver) @pytest.mark.skip def test2_validLogin(self): self.lp.loginsuccess('*****@*****.**','abcabc') @pytest.mark.run(order=1) def test1_invalid1(self): self.npc.click_log_out_Nav() sleep(3) self.lp.getLoginLink_click() self.lp.getEmailField_EnterID('*****@*****.**') self.lp.getLoginButton_click() result=self.lp.new_Assert_check(self.lp._failedloginerror,self.lp._locatorytype6) self.ts.mark_final(result,'test1_invalid1')
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetUp(self, OneTimeSetUP): self.lp = LoginPage(self.driver) self.tc = TestStatus(self.driver) @pytest.mark.run(order=2) def test_ValidLogin(self): self.driver.implicitly_wait(5) self.lp.login('*****@*****.**', 'abcabc') result1 = self.lp.verifyLoginTitle() # assert result1 == True self.tc.mark(result1, " Title is not correct") result2 = self.lp.verifyLoginSuccessful() # assert result2 == True self.tc.markFinal("test_ValidLogin", result2, " Element not present here") @pytest.mark.run(order=1) def test_invalidLogin(self): self.driver.implicitly_wait(10) # INVALID DATA OPTIONS self.lp.logout() sleep(3) self.lp.login('test.email@com', 'qwe') #self.lp.login() #self.lp.login(username='******') #self.lp.login(userpassword='******') result = self.lp.verifyLiginFailed() assert result == True
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) @pytest.mark.run(order=1) def test_validLogin(self): self.lp.login("*****@*****.**", "Today123") result1 = self.lp.verifyTitle() self.ts.mark(result1, "Title Verified") result2 = self.lp.verifyLoginSuccessful() self.ts.markFinal("test_validLogin", result2, "Login was successful") @pytest.mark.run(order=2) def test_invalidLogin(self): self.lp.login("*****@*****.**", "abcabcabc") result = self.lp.verifyLoginFailed() self.ts.markFinal("test_invalidLogin", result, "Login was unsuccessful")
class LoginTest(unittest.TestCase): baseUrl = "https://www.amazon.in/" driver = webdriver.Chrome(executable_path="C:\\Users\\Abinash\\Desktop\\DRIVER\\chrome" "\\chromedriver.exe") driver.implicitly_wait(3) driver.maximize_window() driver.get(baseUrl) lp = LoginPage(driver) def test_ValidLogin(self): #self.lp.clickAmazon() self.lp.clickLoginLink() time.sleep(2) self.lp.enterMailId("*****@*****.**") time.sleep(2) self.lp.clickContinue() self.lp.enterPassword("090093") time.sleep(2) self.lp.clickSubmit() time.sleep(2) self.lp.clickCart() self.lp.clickBuy() time.sleep(2)
def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) #self.np = NavigationPage(self.driver) self.re = RegisterAgentPage(self.driver)
def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) #self.np = NavigationPage(self.driver) self.ic = IncorCompanyPage(self.driver)
def test2_invalid(setup): lp = LP(setup) lp.loginfail1('*****@*****.**', 'password')
def test1_validlogin(setup): lp = LP(setup) lp.loginsuccess('*****@*****.**', 'abcabc')
def classlevelsetup(self,onetime_setup): self.lp=LP(self.driver) self.npc=NPC(self.driver) self.ts=TS(self.driver)
def classSetUp(self, OneTimeSetUP): self.lp = LoginPage(self.driver) self.tc = TestStatus(self.driver)
def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver)