예제 #1
0
    def setUp(self):
        self.driver = None
        action_start({'param': {}, 'type': 'new_session', 'value': None})
        try:
            self.vars = {}

            timeout = 30.0
            options = webdriver.FirefoxOptions()
            profile = webdriver.FirefoxProfile()
            profile.set_preference('webdriver.log.file',
                                   '/somewhere/webdriver.log')
            options.set_capability('unhandledPromptBehavior', 'ignore')
            self.driver = webdriver.Firefox(profile, options=options)
            self.driver.implicitly_wait(timeout)
            apiritif.put_into_thread_store(
                timeout=timeout,
                func_mode=False,
                driver=self.driver,
                windows={},
                scenario_name='blazedemo_test-Selenium')
        except Exception:
            (ex_type, ex, tb) = sys.exc_info()
            action_end({
                'message':
                str(traceback.format_exception(ex_type, ex, tb)),
                'param': {},
                'type':
                'new_session'
            })
            apiritif.log.error(str(traceback.format_exception(ex_type, ex,
                                                              tb)))
            raise
        action_end({'param': {}, 'type': 'new_session'})
예제 #2
0
    def setUp(self):
        self.vars = {}

        timeout = 30.0
        options = webdriver.ChromeOptions()
        options.add_argument('--no-sandbox')
        options.add_argument('--disable-dev-shm-usage')
        options.add_argument('--disable-gpu')
        options.set_capability('unhandledPromptBehavior', 'ignore')
        options.ignore_local_proxy_environment_variables()
        options.add_argument('one')
        options.add_argument('two')
        options.add_experimental_option('key1', 'value1')
        options.add_experimental_option('key2', {'key22': 'value22'})
        options.set_capability('browserName', 'chrome')
        options.set_capability('cap1', 'val1')
        options.set_capability('cap2', 'val2')
        self.driver = webdriver.Remote(
            command_executor=
            'http://*****:*****@remote_web_driver_host:port/wd/hub',
            options=options)
        self.driver.implicitly_wait(timeout)
        add_flow_markers()
        apiritif.put_into_thread_store(timeout=timeout,
                                       func_mode=False,
                                       driver=self.driver,
                                       windows={},
                                       scenario_name='loc_sc_remote')
예제 #3
0
    def setUp(self):
        self.vars = {}

        timeout = 3.5
        self.driver = None
        options = webdriver.FirefoxOptions()
        self.driver = webdriver.Remote(
            command_executor=
            'http://*****:*****@remote_web_driver_host:port/wd/hub',
            desired_capabilities={
                'app': '',
                'browserName': 'firefox',
                'deviceName': '',
                'javascriptEnabled': 'True',
                'platformName': 'linux',
                'platformVersion': '',
                'seleniumVersion': '',
                'version': '54.0'
            },
            options=options)
        self.driver.implicitly_wait(timeout)
        add_flow_markers()
        apiritif.put_into_thread_store(timeout=timeout,
                                       func_mode=False,
                                       driver=self.driver,
                                       windows={},
                                       scenario_name='loc_sc_remote')
    def test_get_locator_timeout(self):
        content = [{'css': 'existed_css'}]
        timeout = 30
        driver = MockWebDriver(content=content, timeout=timeout)

        put_into_thread_store(driver=driver, timeout=timeout, func_mode=False)

        # exception should be raised when raise_exception is True
        missing_locators = [{'css': 'missing_css'}, {'xpath': 'missing_xpath'}]
        self.assertRaises(NoSuchElementException, get_locator,
                          missing_locators, None, False, True)
        self.assertEqual(30, driver.waiting_time)

        # exception should not be raised when raise_exception is False
        driver.waiting_time = 0
        locators = get_locator(missing_locators,
                               parent_el=None,
                               ignore_implicit_wait=True,
                               raise_exception=False)
        self.assertEqual(locators, (BYS['css'], 'missing_css'))
        # actual waiting time is 0 when setting ignore_implicit_wait to True
        self.assertEqual(0, driver.waiting_time)

        driver.waiting_time = 0
        existed_locators = [{'css': 'existed_css'}]
        get_locator(existed_locators)
        self.assertEqual(30, driver.waiting_time)
예제 #5
0
 def setUp(self):
     self.driver = None
     action_start({'param': {}, 'type': 'new_session', 'value': None})
     try:
         self.vars = {}
         timeout = 30.0
         options = webdriver.ChromeOptions()
         options.add_argument('--no-sandbox')
         options.add_argument('--disable-dev-shm-usage')
         options.add_argument('--disable-gpu')
         options.set_capability('unhandledPromptBehavior', 'ignore')
         self.driver = webdriver.Chrome(
             service_log_path='/somewhere/webdriver.log', options=options)
         self.driver.implicitly_wait(timeout)
         apiritif.put_into_thread_store(timeout=timeout,
                                        func_mode=False,
                                        driver=self.driver,
                                        windows={},
                                        scenario_name='sample')
     except Exception:
         (ex_type, ex, tb) = sys.exc_info()
         action_end({
             'message':
             str(traceback.format_exception(ex_type, ex, tb)),
             'param': {},
             'type':
             'new_session'
         })
         apiritif.log.error(str(traceback.format_exception(ex_type, ex,
                                                           tb)))
         raise
     action_end({'param': {}, 'type': 'new_session'})
    def setUp(self):
        self.vars = {}

        timeout = 30.0
        apiritif.put_into_thread_store(
            timeout=timeout,
            func_mode=False,
            scenario_name='autogenerated_87f1619977')
예제 #7
0
def setUpModule():  # setup_module
    target = str(get_index())

    vars = {'name': 'nobody', 'age': 'a'}
    reader_1.read_vars()
    vars.update(reader_1.get_vars())

    apiritif.put_into_thread_store(vars, target)
def setup():
    options = webdriver.ChromeOptions()
    driver = webdriver.Chrome(service_log_path='<somewhere>webdriver.log',
                              chrome_options=options)
    driver.implicitly_wait(3.5)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {}
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #9
0
 def test_external_handler(self):
     plugins = ActionHandlerFactory.create_all()
     apiritif.put_into_thread_store(action_handlers=plugins)
     apiritif.external_handler('session_id',
                               BaseActionHandler.YAML_ACTION_START, 'data')
     plugin = plugins.pop(0)
     self.assertEquals(
         ('session_id', BaseActionHandler.YAML_ACTION_START, 'data'),
         plugin.actions.pop())
예제 #10
0
    def test_shadow_element_actions(self):
        content = [{'css': 'lightning_card'}]
        timeout = 30
        driver = MockWebDriver(content=content, timeout=timeout)

        put_into_thread_store(driver=driver, timeout=timeout, func_mode=False)
        el = find_element_by_shadow('lightning_card')
        el.click()
        self.assertEqual('arguments[0].click();', driver.executed_script)
    def setUp(self):
        self.driver = None
        options = webdriver.ChromeOptions()
        self.driver = webdriver.Chrome(service_log_path='<somewhere>webdriver.log', chrome_options=options)
        self.driver.implicitly_wait(3.5)
        self.vars = {

        }
        add_flow_markers()
        apiritif.put_into_thread_store(driver=self.driver, func_mode=False)
예제 #12
0
 def setUp(self):
     self.target = apiritif.http.target(
         'https://jsonplaceholder.typicode.com')
     self.target.keep_alive(True)
     self.target.auto_assert_ok(True)
     self.target.use_cookies(True)
     self.target.allow_redirects(True)
     self.target.timeout(5.0)
     self.vars = {}
     apiritif.put_into_thread_store(func_mode=False)
예제 #13
0
 def setUp(self):
     self.target = apiritif.http.target('http://localhost:8000/')
     self.target.keep_alive(True)
     self.target.auto_assert_ok(True)
     self.target.use_cookies(True)
     self.target.allow_redirects(True)
     self.vars = {
         'an': 'av',
     }
     apiritif.put_into_thread_store(func_mode=False)
예제 #14
0
def setup():
    target = apiritif.http.target('https://jsonplaceholder.typicode.com')
    target.keep_alive(True)
    target.auto_assert_ok(True)
    target.use_cookies(True)
    target.allow_redirects(True)
    target.timeout(5.0)

    vars = {}

    apiritif.put_into_thread_store(vars, target)
예제 #15
0
    def setUp(self):
        self.driver = None
        self.driver = Driver()
        add_dummy_handlers()
        self.vars = {

        }

        apiritif.put_into_thread_store(
            driver=self.driver,
            func_mode=False)  # don't stop after failed test case
 def setUp(self):
     self.vars = {'city_select_name': 'fromPort', 'input_name_id': 'inputName'}
     self.driver = None
     options = webdriver.ChromeOptions()
     options.add_argument('--no-sandbox')
     options.add_argument('--disable-dev-shm-usage')
     self.driver = webdriver.Chrome(service_log_path='/somewhere/webdriver.log', chrome_options=options)
     self.driver.implicitly_wait(3.5)
     self.loc_mng = LocatorsManager(self.driver, 3.5)
     self.dlg_mng = DialogsManager(self.driver, False)
     apiritif.put_into_thread_store(func_mode=False, driver=self.driver, scenario_name='loc_sc')
예제 #17
0
 def setUp(self):
     self.vars = {
         'an': 'av',
     }
     self.target = apiritif.http.target('http://localhost:8000/')
     self.target.keep_alive(True)
     self.target.auto_assert_ok(True)
     self.target.use_cookies(True)
     self.target.allow_redirects(True)
     apiritif.put_into_thread_store(
         func_mode=False, scenario_name='autogenerated_f575f2755b')
예제 #18
0
def setup():
    options = webdriver.ChromeOptions()
    driver = webdriver.Chrome(
        service_log_path=
        '/Users/lee/Documents/SDET_Master/Blazemeter/2019-12-04_23-04-37.103359/webdriver.log',
        chrome_options=options)
    driver.implicitly_wait(60.0)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {}
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #19
0
    def setUp(self):
        self.vars = {}
        timeout = 2.0
        self.graceful_flag = os.environ.get('GRACEFUL')
        apiritif.put_into_thread_store(test_result=[])
        if self.graceful_flag and os.path.exists(self.graceful_flag):
            os.remove(self.graceful_flag)

        apiritif.put_into_thread_store(timeout=timeout,
                                       func_mode=True,
                                       scenario_name='sc1')
예제 #20
0
    def setUp(self):
        self.vars = {'my_xpath_locator': '/html/body/div[3]', 'name': 'Name', 'red_pill': 'take_it,'}

        timeout = 3.5
        options = webdriver.FirefoxOptions()
        profile = webdriver.FirefoxProfile()
        profile.set_preference('webdriver.log.file', '/somewhere/webdriver.log')
        options.set_capability('unhandledPromptBehavior', 'ignore')
        self.driver = webdriver.Firefox(profile, options=options)
        self.driver.implicitly_wait(timeout)
        apiritif.put_into_thread_store(timeout=timeout, func_mode=False, driver=self.driver, windows={},
                                       scenario_name='loc_sc')
예제 #21
0
 def setUp(self):
     self.target = apiritif.http.target('http://localhost:8000/')
     self.target.keep_alive(True)
     self.target.auto_assert_ok(True)
     self.target.use_cookies(True)
     self.target.allow_redirects(True)
     self.vars = {'cn': 'cv'}
     reader_1.read_vars()
     reader_2.read_vars()
     self.vars.update(reader_1.get_vars())
     self.vars.update(reader_2.get_vars())
     apiritif.put_into_thread_store(func_mode=False)
예제 #22
0
def setup():
    target = apiritif.http.target('http://localhost:8000/')
    target.keep_alive(True)
    target.auto_assert_ok(True)
    target.use_cookies(True)
    target.allow_redirects(True)

    vars = {
        'an': 'av',
    }

    apiritif.put_into_thread_store(vars, target)
예제 #23
0
파일: test_vars.py 프로젝트: andy7i/taurus
def setup():
    target = apiritif.http.target('http://localhost:8000/')
    target.keep_alive(True)
    target.auto_assert_ok(True)
    target.use_cookies(True)
    target.allow_redirects(True)
    
    vars = {
        'an': 'av',
    }
    
    apiritif.put_into_thread_store(vars, target)
예제 #24
0
    def setUp(self):
        self.vars = {'city_select_name': 'fromPort', 'input_name_id': 'inputName'}

        timeout = 3.5
        self.driver = None
        options = webdriver.ChromeOptions()
        options.add_argument('--no-sandbox')
        options.add_argument('--disable-dev-shm-usage')
        self.driver = webdriver.Chrome(service_log_path='/somewhere/webdriver.log', options=options)
        self.driver.implicitly_wait(timeout)
        apiritif.put_into_thread_store(timeout=timeout, func_mode=False, driver=self.driver, windows={},
                                       scenario_name='loc_sc')
예제 #25
0
def setup():
    driver = webdriver.Remote(command_executor='http://localhost:4723/wd/hub',
                              desired_capabilities={
                                  'browserName': 'chrome',
                                  'deviceName': '',
                                  'platformName': 'android',
                              })
    driver.implicitly_wait(3.5)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {}
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #26
0
    def setUp(self):
        self.vars = {'end': 20, 'start': 10, 'step': 1}

        timeout = 30.0
        self.driver = None
        options = webdriver.FirefoxOptions()
        profile = webdriver.FirefoxProfile()
        profile.set_preference('webdriver.log.file', '/somewhere/webdriver.log')
        self.driver = webdriver.Firefox(profile, options=options)
        self.driver.implicitly_wait(timeout)
        apiritif.put_into_thread_store(timeout=timeout, func_mode=False, driver=self.driver, windows={},
                                       scenario_name='loc_sc')
예제 #27
0
 def setUp(self):
     self.driver = None
     options = webdriver.ChromeOptions()
     options.add_argument('--no-sandbox')
     options.add_argument('--disable-dev-shm-usage')
     self.driver = webdriver.Chrome(
         service_log_path='<somewhere>webdriver.log',
         chrome_options=options)
     self.driver.implicitly_wait(3.5)
     self.loc_mng = LocatorsManager(self.driver)
     self.vars = {}
     add_flow_markers()
     apiritif.put_into_thread_store(func_mode=False, driver=self.driver)
예제 #28
0
def setup():
    target = apiritif.http.target('https://jsonplaceholder.typicode.com')
    target.keep_alive(True)
    target.auto_assert_ok(True)
    target.use_cookies(True)
    target.allow_redirects(True)
    target.timeout(5.0)

    vars = {

    }

    apiritif.put_into_thread_store(vars, target)
예제 #29
0
    def setUp(self):
        self.vars = {'my_xpath_locator': '/html/body/div[3]', 'name': 'Name', 'red_pill': 'take_it,'}

        timeout = 3.5
        self.driver = None
        options = webdriver.FirefoxOptions()
        options.set_preference('network.proxy.type', 4)
        profile = webdriver.FirefoxProfile()
        profile.set_preference('webdriver.log.file', '/somewhere/webdriver.log')
        self.driver = webdriver.Firefox(profile, options=options)
        self.driver.implicitly_wait(timeout)
        apiritif.put_into_thread_store(timeout=timeout, func_mode=False, driver=self.driver, windows=OrderedDict(),
                                       scenario_name='loc_sc')
def setup():
    driver = webdriver.Remote(command_executor='http://localhost:4723/wd/hub', desired_capabilities={
        'browserName': 'chrome',
        'deviceName': '',
        'platformName': 'android',
    })
    driver.implicitly_wait(3.5)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {
        
    }
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #31
0
 def setUp(self):
     self.driver = None
     self.driver = webdriver.Remote(
         command_executor='http://localhost:4723/wd/hub',
         desired_capabilities={
             'browserName': 'chrome',
             'deviceName': '',
             'platformName': 'android',
         })
     self.driver.implicitly_wait(3.5)
     self.loc_mng = LocatorsManager(self.driver, 3.5)
     self.vars = {}
     apiritif.put_into_thread_store(func_mode=False, driver=self.driver)
    def setUp(self):
        self.vars = {'my_xpath_locator': '/html/body/div[3]', 'name': 'Name', 'red_pill': 'take_it,'}

        timeout = 3.5
        self.driver = None
        options = webdriver.FirefoxOptions()
        profile = webdriver.FirefoxProfile()
        profile.set_preference('webdriver.log.file', '/somewhere/webdriver.log')
        self.driver = webdriver.Firefox(profile, firefox_options=options)
        self.driver.implicitly_wait(timeout)
        self.wnd_mng = WindowManager()
        self.frm_mng = FrameManager()
        apiritif.put_into_thread_store(func_mode=False, scenario_name='loc_sc', driver=self.driver, timeout=timeout)
예제 #33
0
def setup():
    options = webdriver.FirefoxOptions()
    profile = webdriver.FirefoxProfile()
    profile.set_preference('webdriver.log.file', '<somewhere>webdriver.log')
    driver = webdriver.Firefox(profile, firefox_options=options)
    driver.implicitly_wait(3.5)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {
        'name': 'Name',
        'red_pill': 'take_it',
    }
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #34
0
def setup():
    target = apiritif.http.target('http://localhost:8000/')
    target.keep_alive(True)
    target.auto_assert_ok(True)
    target.use_cookies(True)
    target.allow_redirects(True)

    vars = {
        'cn': 'cv',
    }
    reader_1.read_vars()
    reader_2.read_vars()
    vars.update(reader_1.get_vars())
    vars.update(reader_2.get_vars())

    apiritif.put_into_thread_store(vars, target)
def setup():
    driver = webdriver.Remote(command_executor='http://*****:*****@remote_web_driver_host:port/wd/hub',
                                   desired_capabilities={
                                       'app': '',
                                       'browserName': 'firefox',
                                       'deviceName': '',
                                       'javascriptEnabled': 'True',
                                       'platformName': 'linux',
                                       'platformVersion': '',
                                       'seleniumVersion': '',
                                       'version': '54.0',
                                   })
    driver.implicitly_wait(3.5)
    wnd_mng = WindowManager(driver)
    frm_mng = FrameManager(driver)
    vars = {

    }
    apiritif.put_into_thread_store(vars, driver, wnd_mng, frm_mng)
예제 #36
0
def setup():
    vars = {

    }

    apiritif.put_into_thread_store(vars)