def classSetup(self, oneTimeSetUp): logging.info("testing this file") logging.info("started loggin ") self.lp = LoginPage(self.driver) # self.zone = Zone(self.driver) # self.scandata = Scandata(self.driver) self.ldp = LdapServers(self.driver)
def test_validation(self): driver=self.driver lg = LoginPage(driver) lg.loginToLetsKode("*****@*****.**","abcabc") driver.back() time.sleep(1) driver.back()
class Users(unittest.TestCase): # setup_logging(__name__) @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.user = user(self.driver) self.users = users(self.driver) self.role = Roles(self.driver) @pytest.mark.run(order=1) def testa_add_logina(self): self.lp.login("admin", "admin") success = self.lp.verifyLoginSuccessful() time.sleep(2) if success == "Dashboard": print("testing successful") @data({ 'org_username': '******', 'firstname': 'test_sm', 'username': '******', 'password': '******', 'confirmpassword': '******' }) @pytest.mark.run(order=2) @unpack def testb_add_user(self, org_username, username, firstname, password, confirmpassword): self.user.click_user_icon() self.users.click_users_icon() self.users.click_add_user() time.sleep(5) self.users.click_role() # self.users.click_securitymanager() self.users.select_org() time.sleep(0.5) # self.users.enterorgname() self.users.enter_org_username(org_username) self.users.enter_firstname(firstname) self.users.enter_username(username) self.users.enter_password(password) self.users.enter_confirmpassword(confirmpassword) self.users.Submit() @data({'usernamne': 'CustomSecurityManager'}) @unpack def testc_add_role(self, usernamne): time.sleep(4) self.user.click_user_icon() self.role.clickrole() self.role.clickadd() self.role.entername(name=usernamne) self.role.checkboxcreatescan() self.role.MangerecastRule() self.users.Submit()
class RegisterCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = T_estStatus(self.driver) self.lg = LoginPage(self.driver) self.util = Util() @pytest.mark.run(order=1) @data(("JavaScript", "EG", "121212"), ("JavaS", "IR", "101010")) @unpack def test_invalidEnrollment(self, course_name, country_name, postal_code): self.lg.login("*****@*****.**", "abcabc") self.courses.clickAllCoursesButton() self.courses.enterCourseName(courseName=course_name) self.courses.clickJavaScriptCourse() self.courses.scrollToBottom() self.courses.clickEnrollButton() self.courses.scrollToBottom() self.courses.selectCountryDropDown(countryName=country_name) self.courses.enterPostalCode(code=postal_code) self.courses.clickSubmitButton() self.courses.scrollToTop() self.util.sleep(3) result1 = self.courses.verifyTextOnPage( "Sorry, there was an error completing your purchase -- please try again." ) self.ts.mark(result1, "Text verified") self.driver.back() self.courses.logOut() result2 = self.courses.verifyUserLogOut() self.ts.markFinal("test_invalidEnrollment", result2, "logout successful") self.util.sleep(2)
def oneTimeSetUp(request, browser, osType): #print("Running conftest demo one time setUp") print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login("*****@*****.**", "abcabc") # if browser == "firefox": # baseURL = "https://letskodeit.teachable.com/" # driver = webdriver.Firefox() # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(baseURL) # print("Running tests on FF") # else: # baseURL = "https://letskodeit.teachable.com/" # driver = webdriver.Chrome() # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(baseURL) # print("Running tests on Chrome") # We need to add "value" attribute, the one we created above to the test class using "request" keyword # If the class attribute from the request we are getting is not None then make the "value" guy as a class attribute # so that it can be available to all the instance, the complete class we are going to use if request.cls is not None: request.cls.driver = driver # The yield will return the value where a "fixture" is used. And "fixture" is used in "TestClassDemo" yield driver #driver.quit() #print("Running conftest demo one time tearDown") print("Running one time tearDown")
class ActiveScan(unittest.TestCase): # setup_logging(__name__) @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.active = ActiveScan(self.driver) @data({'name': 'test_sm', 'password': '******'}) @pytest.mark.run(order=1) @unpack def testa_add_logina(self, name, password): self.lp.login(email=name, password=password) success = self.lp.verifyLoginSuccessful() time.sleep(2) self.wait_page_load() if success == "Dashboard": print("testing successful") def wait_page_load(self): WebDriverWait(self.driver, 3) @data({'first': 'Centos_Nessus'}) @unpack def testb_active_scan(self, first): self.active.click_scan() self.active.click_active_scan() self.active.clickaddactivescan() self.active.EnterScanName(data=first) self.active.ClickSelectpolicy()
class Lce(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.lce = LogCorelation(self.driver) @pytest.mark.run(order=1) def testa_add_logina(self): self.lp.login("admin", "admin") success = self.lp.verifyLoginSuccessful() time.sleep(2) if success == "Dashboard": print("testing succefull") @data({ 'name': 'Lce_server_to_test', 'description': 'Automation for adding lce server', 'host': '172.26.18.62' }) @pytest.mark.run(order=3) @unpack def testb_addlce_server(self, name, description, host): self.lce.clickresources() self.lce.click_lce() self.lce.add_lce_server() time.sleep(1) self.lce.enter_lceusername(name=name) self.lce.enter_lcedescription(description=description) self.lce.enter_lcehost(host=host) self.lce.clickcheckauthintication() self.lce.submit() self.lce.click_lce_clients()
def module_set_up_level_to_test_a_class_orangehrm(request, browser): # this is One time setup print('Module setup') webdriver_factory = WebDriverFactory(browser) driver = webdriver_factory.get_webdriver_instance_hrm() login_page = LoginPage(driver) login_page.login_hrm("admin", "Bitnami.12345") # base_url = "http://localhost" # if browser == 'Firefox': # driver = webdriver.Firefox() # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(base_url) # print('Running test on FF') # else: # driver = webdriver.Chrome() # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(base_url) # print('Running test on Chrome') # to pass value to the TestClassDemo2 if class requests it!! while initializing instance if request.cls: #.cls - means class context (level) request.cls.driver = driver yield driver driver.quit() print('Module teardown')
class LoginTests(unittest.TestCase): def setUp(self): baseURL = "https://letskodeit.teachable.com/" self.driver = webdriver.Firefox() self.driver.maximize_window() self.driver.implicitly_wait(3) self.driver.get(baseURL) self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) def test_validLogin(self): self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyTitle() #assert result1 == True self.ts.mark(result1, "Title validation") result2 = self.lp.verifyLoginSuccessful() #assert result2 == True self.ts.markFinal("test_validLogin", result2, "Login Successfulness") # # def test_invalidLogin(self): # self.lp.login(password = "******") # result = self.lp.verifyLoginFailed() # self.assertTrue(result, "No se ha encontrado: 'Invalid email or password.'") def tearDown(self): self.driver.quit()
def oneTimeSetUp(request, browser, bitConfig): """ One Time Set Up :param request: :param browser: :return: """ print("Running one time setUp") cfg = ConfigParser() bitcfg = Config() cfg.read(os.path.abspath(".\\configfiles\\config.ini")) if not bitConfig: bitConfig = str(bitcfg.configBuilder()) wdf = WebDriverFactory(browser, cfg, bitConfig) driver = wdf.getWebDriverInstance() lp = LoginPage(driver, cfg) lp.login() if request.cls is not None: request.cls.driver = driver request.cls.cfg = cfg request.cls.bitConfig = bitConfig yield driver driver.quit() print("Running one time tearDown")
class TestRegisterCoursesTest(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self): self.rc = RegisterCoursesPages(self.driver) self.lp = LoginPage(self.driver) self.ts = ResultStatusTracker(self.driver) @pytest.mark.run(order=1) @data(("Selenium WebDriver With Java", "3434 343434 34343", "2345", "12345", "United States", "12345"), ("Selenium WebDriver With Java", "5555 343434 34343", "2345", "99999", "India", "88888") ) # Step 3: @data decorator should be used to pass the data @unpack # Step 4: If the above is list , tuple then use @unpack decorator to unpack them to below variables which are passed as parameter for function def test_invalidEnrollment(self, course_name, card_number, card_exp_date, card_cvc, card_country, card_postal_code): self.driver.get(self.baseUrl) self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyLoginSuccessful() self.ts.mark(result1, " login verification", testName=inspect.stack()[0][3]) self.rc.enrollCourse(course_name, card_number, card_exp_date, card_cvc, card_country, card_postal_code) result2 = self.rc.verifyEnrollFailed("The card was declined.") self.ts.markFinal(result2, " Enrollment verification", testName=inspect.stack()[0][3])
class Repo(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.isi = IndustrialSecurityInstances(self.driver) @pytest.mark.run(order=1) def testa_add_logina(self): self.lp.login("admin", "admin") success = self.lp.verifyLoginSuccessful() time.sleep(2) if success == "Dashboard": print("testing successful") def testb_add_is_instance(self): self.isi.click_Resource() self.isi.clickIsi() self.isi.IsiAdd() time.sleep(2) self.isi.isi_name(IP.Isi.name_isi) time.sleep(2) self.isi.isi_description(IP.Isi.description_isi) time.sleep(2) self.isi.host(IP.Isi.isi_host) time.sleep(5) self.isi.isi_username(IP.Isi.username_isi) self.isi.isi_password(IP.Isi.password_isi) self.isi.isi_Repositories(IP.RepoName.username_ipv4_repo) time.sleep(3) self.isi.isi_reposelect() self.isi.submit()
def loginGmailUser(self, gmailemail, gmailpswd): from pages.home.login_page import LoginPage userURL = "https://accounts.google.com/signin" + '?Email=' + gmailemail self.log.info("GMAIL URL : " + userURL) self.driver.get(userURL) self.loginpage = LoginPage(self.driver) self.loginpage.login(gmailpswd)
class LoginTests(unittest.TestCase): log = cl.customLogger(logging.DEBUG) masani = datetime.datetime.now().strftime("%Y%m%d") @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): #self.display = Display(visible=0, size=(1600, 1200)) #self.display.start() self.tstatus = tStatus(self.driver) self.loginpage = LoginPage(self.driver) # self.loginpage.indeedJobs() # self.adminpswd = userPasswordRead("ADMINPSWD#", self.masani).replace(' ','').split(',')[0] print('SETUP 1') @pytest.mark.run(order=1) def test_1IndeedJobsSearch(self): self.log.info("test_1IndeedJobsSearch started") self.loginpage.indeedJobs() #self.loginpage.loginAdvSetting(self.adminpswd) # GO TO Advanced Setting #result = self.loginpage.verifyPageTitle('advanced dns') # Test 3 #self.tstatus.mark(result, "Advanced Page's Title verified") #print("Result " + str(len(self.tstatus.resultList)) + " = " + str(result)) #result = self.loginpage.firewallBlockAll() # Test 4 #self.tstatus.mark(result, "Firewall block all selected verified") #print("Result " + str(len(self.tstatus.resultList)) + " = " + str(result)) #result = self.loginpage.verifyPageURL("http://192.168.1.254/advanced_firewall.html") # Test 5 #self.tstatus.mark(result, "URL verified") #print("Result " + str(len(self.tstatus.resultList)) + " = " + str(result)) #result = self.loginpage.verifyPageTitle('advanced firewall') # Test 6 #self.tstatus.mark(result, "Page Title verified") #print("Result " + str(len(self.tstatus.resultList)) + " = " + str(result)) #result = self.loginpage.verifyFirewallIsBlockAll() # Test 7 #print("ResultLast = " + str(result) + '\n') #self.tstatus.markFinal("test_FirewallSettingBlock was successful", result, "Firewall OFF button is selected") #@pytest.mark.run(order=2) #def test_2MonsterJobsSearch(self): # self.log.info("test_2MonsterJobsSearch started") # self.loginpage.monsterJobs() # #@pytest.mark.run(order=3) #def test_3TotalJobsSearch(self): # self.log.info("test_3TotalJobsSearch started") # self.loginpage.totalJobs() # #@pytest.mark.run(order=4) #def test_4DiceJobsSearch(self): # self.log.info("test_4DiceJobsSearch started") # self.loginpage.diceJobs() @pytest.fixture(autouse=True) def tearDown(self): # # self.driver.quit() # self.display.stop() print('TEAR DOWN 1') #ff = LoginTests() #ff.test_FirewallSettingOff()
class LoginTests(EnvironmentSetup): #@pytest.mark.run(order=1) @pytest.mark.first def test_validlogin(self): self.lp = LoginPage(self.driver) self.lp.validlogin("6471231231", "022455") self.lp.VerifyLoginSuccess() # #@pytest.mark.run(order=2) # @pytest.mark.second # def test_menutab(self): # self.mn = MenuPage(self.driver) # self.mn.VerifyMenutab() # @pytest.mark.run(order=1) # def test_Invalidlogin(self): # self.lp = LoginPage(self.driver) # self.lp.invalidlogin("") # self.lp.VerifyLoginSuccess() # self.driver.quit() # if __name__ == "__main__": # LoginTests().test_validlogin() #ff = LoginTests() #ff.test_validlogin() #ff.tearDown()
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) print("classSetup method run") @pytest.mark.run(order=2) def test_validLogin(self): # login process self.lp.login("*****@*****.**", "abcabc") allure.attach(self.driver.get_screenshot_as_png(), name="HomeScreen", attachment_type=AttachmentType.PNG) time.sleep(3) # result1 = self.lp.verifyTitle() # self.ts.mark(result1, "Title is incorrect") # result2 = self.lp.verifyLoginSuccess() # self.ts.markFinal("test_validLogin", result2, "Login was successful") @pytest.mark.run(order=1) def test_loginFailed(self): self.lp.login(email="*****@*****.**") time.sleep(3) result = self.lp.verifyLoginFailed() assert result == True allure.attach(self.driver.get_screenshot_as_png(), name="testLoginFailed", attachment_type=AttachmentType.PNG)
class LoginTests(unittest.TestCase): log = cl.customLogger(logging.DEBUG) @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) # @pytest.mark.run(order=1) # def test_t1invalidLogin(self): # self.log.info("*#" * 20) # self.log.info("test_t1invalidLogin started") # self.log.info("*#" * 20) # self.lp.logout() # self.lp.login("*****@*****.**", "abcabcabc") # result = self.lp.verifyLoginFailed() # assert result == True @pytest.mark.run(order=1) def test_t2validLogin(self): self.log.info("*#" * 20) self.log.info("test_t2validLogin started") self.log.info("*#" * 20) self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyLoginTitle() self.ts.mark(result1, "Title Verification") result2 = self.lp.verifyLoginSuccessful() print("Result1: " + str(result1)) print("Result2: " + str(result2)) self.ts.markFinal("test_t2validLogin", result2, "Login Verification")
class TestRegisterCoursesCSVDataTest(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self): self.rc = RegisterCoursesPages(self.driver) self.lp = LoginPage(self.driver) self.ts = ResultStatusTracker(self.driver) # @pytest.mark.run(order=1) # @data(*getCsvData(filename="/Users/karthikp/PycharmProjects/PythonFramework/resources/testdata.csv")) # Step 3: @data decorator should be used to pass the data # @unpack # Step 4: If the above is list , tuple then use @unpack decorator to unpack them to below variables which are passed as parameter for function # def test_invalidEnrollment(self, course_name, card_number, card_exp_date, card_cvc, card_country, card_postal_code): # self.driver.get(self.baseUrl) # self.lp.login("*****@*****.**", "abcabc") # result1 = self.lp.verifyLoginSuccessful() # self.ts.mark(result1, " login verification", testName=inspect.stack()[0][3]) # # self.rc.enrollCourse(course_name, card_number, card_exp_date, card_cvc, card_country, # card_postal_code) # result2 = self.rc.verifyEnrollFailed("The card was declined.") # self.ts.markFinal(result2, " Enrollment verification", testName=inspect.stack()[0][3]) @pytest.mark.run(order=1) @data(*getCsvData( filename= "/Users/karthikp/PycharmProjects/PythonFramework/resources/login_testdata.csv" )) @unpack def test_invalidEnrollment(self, username, password): self.driver.get(self.baseUrl) self.lp.login(username, password) self.lp.logout()
class RegisterCourseTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursePage(self.driver) self.ts = TestStatus(self.driver) self.lp = LoginPage(self.driver) self.nav = NavigationPage(self.driver) def set_up(self): self.nav.navigate_to_all_courses() @pytest.mark.run(order = 1) @data (("JavaScript for beginners", "10", "1220", "10"), ("Learn Python 3 from scratch", "20", "1220", "20")) @unpack def test_invalid_enrollment(self, courseName, ccNum, ccExp, ccCVV): self.lp.login("*****@*****.**", "abcabc") self.courses.enter_search_field(courseName) self.courses.click_search_button() self.courses.select_course() time.sleep(4) self.courses.enroll_course(num=ccNum, exp=ccExp, cvv=ccCVV) result = self.courses.verify_enroll_failed() self.ts.mark_final("test_invalid_enrollment", result, "Enrollment Verification") self.courses.click_all_courses_link()
def setUp(self): baseURL = "https://letskodeit.teachable.com/" self.driver = webdriver.Firefox() self.driver.maximize_window() self.driver.implicitly_wait(3) self.driver.get(baseURL) self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver)
def test_invalid_login(self): self.driver.get("https://letskodeit.teachable.com/") self.driver.maximize_window() log_page = LoginPage(self.driver) log_page.login("*****@*****.**", "abcabcx") time.sleep(2) result = log_page.verifyinvalidlogin() assert result == True
def test_logout(self): pytest.skip('for a reason will implement later!') self.driver.implicitly_wait(10) loginpage = LoginPage(self.driver) actions = ActionChains(self.driver) loginpage.mouse_hover_on_more(actions, time) time.sleep(5) print("Logged out Successfully....")
def objectSetup(self, oneTimeSetUp): #self.display = Display(visible=0, size=(1600, 1200)) #self.display.start() self.tstatus = tStatus(self.driver) self.loginpage = LoginPage(self.driver) # self.loginpage.indeedJobs() # self.adminpswd = userPasswordRead("ADMINPSWD#", self.masani).replace(' ','').split(',')[0] print('SETUP 1')
class Feature_Collection(unittest.TestCase): log = cl.customLogger(logging.DEBUG) @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = TestStatus(self.driver) self.dp = DashboardPage(self.driver) @pytest.mark.run(order=1) def test_Dashboard_FeatureCollection(self): self.log.info("***" * 20) self.log.info("Test Dashboard_JobsOfTheFuture Started") self.log.info("***" * 20) self.lp.clickLoginLink() time.sleep(4) self.lp.login(username, password) time.sleep(4) modal_result = self.dp.verifyTourModal() if modal_result: self.dp.clickSkipTour() time.sleep(2) self.dp.clickGotItTour() time.sleep(2) self.dp.scrollDown("1750") time.sleep(4) big_card_feature_result = self.dp.verifyBigCardFeaturedCollection() self.ts.mark(big_card_feature_result, "Big Card of Feature Collection is present?", "5796") card1_feature_result = self.dp.verifyCard1FeatureCollection() self.ts.mark(card1_feature_result, "Card 1 of Feature Collection is present?", "5796") card2_feature_result = self.dp.verifyCard2FeatureCollection() self.ts.mark(card2_feature_result, "Card 2 of Feature Collection is present?", "5796") forward_row_feature_result= self.dp.verifyForwardRowFeatureCollection() self.ts.mark(forward_row_feature_result, "Forward row of Feature Collection is present?", "5796") href_card1_feature = self.dp.obtainHrefCard1FeatureCollection() url_card1_feature = self.dp.clickCard1FeatureCollection() if dict_url[href_card1_feature] == url_card1_feature: self.ts.mark(True, "The Redirect to Card 1?", "5796") else: self.ts.mark(False, "The Redirect to Card 1?", "5796") time.sleep(4) href_card2_feature = self.dp.obtainHrefCard2FeatureCollection() url_card2_feature = self.dp.clickCard2FeatureCollection() if dict_url[href_card2_feature] == url_card2_feature: self.ts.mark(True, "The Redirect to Card 2?", "5796") else: self.ts.mark(False, "The Redirect to Card 2?", "5796") time.sleep(4) self.dp.clickForwardFeatureCollection() href_card3_feature = self.dp.obtainHrefCard3FeatureCollection() url_card3_feature = self.dp.clickCard3FeatureCollection() if dict_url[href_card3_feature] == url_card3_feature: self.ts.mark(True, "The Redirect to Card 3?", "5796") else: self.ts.mark(False, "The Redirect to Card 3?", "5796") time.sleep(4)
def classSetup(self, oneTimeSetup): """ classSetup is a custom fixture written here and not is conftest onTimeSetup and setUp fixtures will not be called first as none of them are passed as arguments for classSetup function it is just a fixture which will act as a constructor and initializes the class whichever we want and makes it available to all the functions :return: """ print("inside classsetuppp") self.lp = LoginPage(self.driver) self.ts = ResultStatusTracker(self.driver)
class LoginTests(unittest.TestCase): """ create a fixture method inside the class definition with auto use=True to setup another instance object to be used throughout your test class. """ @pytest.fixture(autouse=True) def build_classSetup(self,oneTimeSetUp):# <-- oneTimeSetup reference here # Now we will use the LoginPage instance(because we only need it now) with the fixture,thats why #we use the fixture inside the class definition self.loginpage = LoginPage(self.driver)# pages object for our test class # To use the TestStatus class now we should create an object and instantiate with driver object self.test_status = TestStatus(self.driver) @pytest.mark.run(order=2) def test_validLogin(self): self.loginpage.clearLoginFields() self.loginpage.login("*****@*****.**","abcabc") # Now call the mark method of Teststatus Class with parameter result and resultmessage result_1 = self.loginpage.verifyLoginTitle() self.test_status.mark(result_1,"Title Verification") result_2 = self.loginpage.verifyLoginSuccessful() self.test_status.markFinal("test_lets kode it",result_2,"Login Verification") @pytest.mark.run(order=1) def test_invalidLogin(self): self.loginpage.login("*****@*****.**","abc") result = self.loginpage.verifyLoginFailed() assert result == True
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = VerifyStatus(self.driver) # Need to verify 2 verification points # 1 fails, code will not go to the next verification point # If assert fails, it stops current test execution and # moves to the next test method @pytest.mark.run(order=2) def test_validLogin(self): self.lp.login(email="*****@*****.**", password="******") result1 = self.lp.verifyLoginTitle() self.ts.mark(result1, "Title verification") result2 = self.lp.verifyLoginSuccessful() self.ts.markFinal("test_validLogin", result2, resultMessage="Successful login verification") @pytest.mark.run(order=1) def test_invalidLogin(self): self.lp.logout() self.lp.login(email="*****@*****.**", password="******") result = self.lp.verifyLoginFailed() assert result == True
class LoginTests(unittest.TestCase): # For run test from KETask # py.test tests\home\test_login.py --browser chrome/firefox # pytest --alluredir /Users/ryani/Automation/KETask/Reports @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.mp = MainPage(self.driver) # @pytest.mark.run(order=1) def test_1change_language(self): self.mp.clickUaLang() result = self.mp.verifyLangUa() assert result == True #@pytest.mark.run(order=4) def test_2validLogin(self): self.lp.login('*****@*****.**', 'Qwerty123') result = self.lp.verifyLoginSuccessful() assert result == True sleep(5) #@pytest.mark.run(order=2) def test_3search_existing(self): self.mp.clickSearchField() self.mp.Search('Xiaomi') result = self.mp.verifySearchSuccessful() assert result == True #@pytest.mark.run(order=3) def test_4search_absent(self): self.mp.closeSocialPopUp() self.mp.clickLogo() self.mp.Search('fksdhfgsdjhfsldh') result = self.mp.verifySearchEmpty() assert result == True def test_5validLogin(self): self.mp.clickProfile() self.mp.clickExit() Logout_result = self.mp.verifyLogOut() assert Logout_result == True
def test_invalidLogin(self): baseurl = "https://letskodeit.teachable.com/" driver = webdriver.Chrome( executable_path= "C:\\Users\\Dusan\\Desktop\\Udemy\\Drivers\\chromedriver.exe") # driver = webdriver.Firefox() driver.maximize_window() # driver.execute_script("window.location = 'https://letskodeit.teachable.com/p/practice';") driver.get(baseurl) driver.implicitly_wait(5) loginpazh = LoginPage( driver) # loginpazh je dobio klasu LoginPage iz login_page.py loginpazh.login("*****@*****.**", "abcabc123") loginpazh.takeScreenShot() # moj kod sleep(3) searchPlace = loginpazh.verifyLoginFailed() assert searchPlace == True loginpazh.takeScreenShot() # moj kod sleep(3) driver.quit() # DelBoy vise ne treba kad se importuje unittest # DelBoy= loginTests() # DelBoy.test_validLogin()
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self,oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=2) def test_validlogin(self): #print("######## execution of correct login") self.lp.login('portalaviation1', 'Welcome01') result1 = self.lp.verifyPageTitle("Global Portal") self.ts.mark(result1,'Title is correct') #self.lp.login('*****@*****.**','abcabc') result2 = self.lp.verifyLoginSuccessful() self.ts.mark(result2,"Login was successful") self.ts.markFinal("Validating Login",result2,"Login was successful") @pytest.mark.run(order = 1) def test_invalidlogin(self): # The class Setup fixture will open the URL the first time #print("********** Execution of wrong login") self.lp.logout() self.lp.login('portalaviation1','wrong') #result1 = self.lp.checkLoginError("Sorry, we were not able to identify your information in our system. Please try again, or if you recently changed your username or email address, please call 1 888 939 4852 for assistance.") result = self.lp.verifyLoginFailure() self.ts.mark(result,"Checking Error Msg")
class LoginTest(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self,oneTimeSetUp): self.lp = LoginPage(self.driver) @pytest.fixture(autouse=True) def test_invalid_login(self,oneTimeSetUp): print("enter invalif fucny") self.lp.login("automt1","test123") result = self.lp.verify_login_failed() print (result) assert result == True print("Error message verified") def test__valid_login(self,oneTimeSetUp): self.lp.login("auto_mt1", "test$123") self.lp.verify_login_Success("Welcome to SurveyMonkey!")
def class_setup(self,oneTimeSetUp): self.lp = LoginPage(self.driver)