def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) wdf.getWebDriverInstance() if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login('*****@*****.**', 'abcabc') # if browser == 'firefox': # base_url = 'https://learn.letskodeit.com/' # driver = webdriver.Firefox('C:\\chromedriver_win32\\chromedriver.exe') # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(base_url) # else: # print("Running tests on chrome") # base_url = 'https://learn.letskodeit.com/' # driver = webdriver.Chrome('C:\\chromedriver_win32\\chromedriver.exe') # driver.maximize_window() # driver.implicitly_wait(3) # driver.get(base_url) if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser): print("I amd gonna once before every module") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() # lp = LoginPage(driver) # lp.Login("*****@*****.**", "Ind@@143") # if browser == 'Firefox': # baseurl = 'https://www.gucci.com/us/en/' # driver = webdriver.Firefox() # driver.maximize_window() # driver.implicitly_wait(50) # driver.get(baseurl) # print('Running tests on Firefox') # else: # baseurl = 'https://www.gucci.com/us/en/' # driver = webdriver.Chrome() # driver.get(baseurl) # print('Running tests on Chrome') if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one Time teardown")
def oneTimeSetUp(request, browser): print("Running conftest demo one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = Login(driver) lp.login("*****@*****.**", "abcabc") # if browser == 'firefox': # print('Running tests on chrome') # baseURL = 'https://letskodeit.com/' # driver = webdriver.Firefox() # driver.maximize_window() # driver.implicitly_wait(5) # driver.get(baseURL) # # If i don't provide the browser time it will run by default on Chrome # else: # baseURL = "https://letskodeit.com/" # driver = webdriver.Chrome() # driver.get(baseURL) # print('Running tests on Chrome') if request is not None: request.driver = driver yield driver driver.quit() print("Running conftest demo one time tearDown")
def oneTimeSetUp(request, browser): print("Running one time setUp") wbf = WebDriverFactory(browser) driver = wbf.getWebDriverInstance() lp = LoginPage(driver) lp.login("*****@*****.**", "qwerty123") # 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") if request.cls is not None: request.cls.driver = driver yield driver #driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser, osType): log.info("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() # login_page_obj = LoginPage(driver) # login_page_obj.login("*****@*****.**", "abcabc") if browser == 'firefox': log.info("Running tests on <<<<<< FireFox >>>>>>") log.info("<<<<< Tests running in {} OS Platform >>>>>".format(osType)) elif browser == 'chrome': log.info("Running tests on <<<<<< Chrome >>>>>>") log.info("<<<<< Tests running in {} OS Platform >>>>>".format(osType)) elif browser == 'iexplorer': log.info("Running tests on <<<<<< Internet Explorer >>>>>>") log.info("<<<<< Tests running in {} OS Platform >>>>>".format(osType)) else: log.info("Running tests on <<<<<< Chrome >>>>>>") log.info("<<<<< Tests running in {} OS Platform >>>>>".format(osType)) if request.cls is not None: request.cls.driver = driver yield driver driver.quit() log.info("Running one time tearDown") log.info( "End--------------------------------------------------------------------------------------------" )
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")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() # 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/" # chromedriver = "/Users/ct/Documents/devTools/chromedriver" # os.environ["webdriver.chrome.driver"] = chromedriver # driver = webdriver.Chrome(chromedriver) # driver.get(baseURL) # print("Running tests on chrome") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
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")
def setUp(request, browser, headless): wdf = WebDriverFactory(browser, headless) driver = wdf.getWebDriverInstance() if request.cls is not None: request.cls.driver = driver yield driver.quit()
def oneTimeDriverSetup(request, browser): print("Running DRIVER SETUP") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running DRIVER QUIT")
def oneTimeSetUp(request, browser): wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() if request.cls: request.cls.driver = driver yield driver driver.quit()
def test_login(self): wd = WebDriverFactory(browser="chrome.driver") driver = wd.getWebDriverInstance() lt = LoginPage(driver) # Click and verify account lt.account() element = driver.find_element_by_xpath( "//button[@id='header-account-menu']") if element.is_enabled(): print("Test case TC001: Pass") else: print("Test Case TC001: Fail") # Click and verify Sign in lt.signIn() element = driver.find_element_by_xpath("//a[@id='account-signin']") if element.is_enabled(): print("Test Case Tc002: Pass") else: print("Test Case TC002: Fail") # Send email and verify email lt.email("*****@*****.**") email = driver.find_element_by_xpath("//input[@id='gss-signin-email']") if email.is_enabled(): print("Test Case Tc003: Pass") else: print("Test Case TC003: Fail") # # Click and verify 'Forgot Password Button' # lt.forgotPassword() # heading = driver.find_element_by_xpath("//h2[@id='gss-forgot-password-heading']") # print(heading.text) # if heading.text=="Reset your password": # print("Test Case TC004: Pass") # else: # print("Test Case TC004: Fail ") # Send Password and Verify lt.password("Ej12345679*") password = driver.find_element_by_xpath( "//input[@id='gss-signin-password']") if password.is_enabled(): print("Test Case TC004: Pass") else: print("Test Case TC004: Fail") # Click and verify Sign In Button lt.signInBtn() header_account = driver.find_element_by_xpath( "//button[@id='header-account-menu-signed-in']") if header_account.is_enabled(): print("Test Case TC005: Pass") else: print("Test Case TC005: Fail")
def TC005(self): wd = WebDriverFactory(browser="firefox") driver = wd.getWebDriverInstance() wd = WebDriverFactory(browser="firefox") driver = wd.getWebDriverInstance() htl = HotelPage(driver) htl.hoteltab() htl.checkouttab() htl.checkoutdate() htl.adulttab() htl.adultadd() htl.closeadulttab() element = driver.find_element_by_xpath( "//*[@id='traveler-selector-hp-hotel']/div/ul/li/button") if element.is_enabled(): print("Test Case Tc005: Pass") else: print("Test case Tc005: Fail")
def OnetimesetUp(request, browser, baseurl): wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() # lp = LoginClass(driver) # lp.Login("*****@*****.**","abcabc") print("*" * 20 + "One time modular set up " + "*" * 20) if request.cls is not None: # if the class value is not none then return the value from one time setup to # to the test class request.cls.driver = driver yield driver
def oneTimeSetUp(request, browser, osType): print("Running one time setup") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.Login("IvyAdmin", "password") if request.cls is not None: request.cls.driver = driver yield driver driver.quit()
def oneTimeSetUp(request, browser): print("Running one time setup") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Driver is closed as part of tear down")
def oneTimeSetUp(request, browser, url): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() driver.get(url) driver.implicitly_wait(10) if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser): print("\nSetup begin to run test case") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login("*****@*****.**", "abcabc") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("\nTearDown end when run all test case")
def universalSetUp(browser): print("Running universalSetUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() driver.set_page_load_timeout(30) driver.get(URL) lp = LoginPage(driver) lp.login(USERNAME, PASSWORD) yield driver driver.quit() print("Running universalSetUp")
def test003(self): wd = WebDriverFactory(browser="firefox") driver = wd.getWebDriverInstance() """Enter valid user name and invalid password then click login button""" lp = LoginPage(driver) lp.login("*****@*****.**", "mert1234") if driver.find_element_by_xpath("//div[@class='alert alert-danger']").text=="Invalid email or password.": print("Test case TC003: Pass") else: print("Test case TC003: Fail")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() #flp = FlightPage(driver) #flp.flight("*****@*****.**", "abcabc") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser): print("*Running one time method level SetUp*") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.logging("*****@*****.**", "kappakappa") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("*Running one time method level TearDown*")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login("*****@*****.**", correct_password) if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def test(self): wd = WebDriverFactory(browser="firefox") driver = wd.getWebDriverInstance() # baseUrl = "https://www.expedia.com/" # driver = webdriver.Firefox() # driver.maximize_window() # driver.get(baseUrl) # driver.implicitly_wait(5) fp = FlightPage(driver) fp.flight("Boston", "New York")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() #lp = LoginPage(driver) #lp.login("mngr263185", "mUjezAd") if request.cls is not None: request.cls.driver = driver yield driver # driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request): print("Running class setUp") wdf = WebDriverFactory() driver = wdf.getWebDriverInstance() if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running class tearDown")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login("*****@*****.**", "12345678") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def oneTimeSetUp(request, browser): print("Running one time setUp") wdf = WebDriverFactory(browser) driver = wdf.getWebDriverInstance() lp = LoginPage(driver) lp.login_flow("*****@*****.**", "testme123") if request.cls is not None: request.cls.driver = driver yield driver driver.quit() print("Running one time tearDown")
def test004(self): wd = WebDriverFactory(browser="firefox") driver = wd.getWebDriverInstance() """Enter valid password and click login button""" lp = LoginPage(driver) lp.login("", "mert1991") if driver.find_element_by_xpath("//div[@class='alert alert-danger']").text == "Invalid email or password.": print("Test case TC004: Pass") else: print("Test case TC004: Fail")