def step(context): context.base.enter_month('07') context.base.enter_day('07') context.base.enter_year('1970') context.base.enter_income('70000') context.base.get_estimate() Utils().zzz(1)
def before_all(context): setup_config(context) setup_logger(context) if context.browser == 'Sauce': context.logger.info("Using Sauce Labs") desired_capabilities = { 'name': os.getenv('SELENIUM_NAME', 'OAH browser tests ') + str(datetime.now()), 'platform': os.getenv('SELENIUM_PLATFORM', 'WINDOWS 7'), 'browserName': os.getenv('SELENIUM_BROWSER', 'chrome'), 'version': int(os.getenv('SELENIUM_VERSION', 33)), 'max-duration': 7200, 'record-video': os.getenv('SELENIUM_VIDEO', True), 'video-upload-on-pass': os.getenv('SELENIUM_VIDEO_UPLOAD_ON_PASS', True), 'record-screenshots': os.getenv('SELENIUM_SCREENSHOTS', False), 'command-timeout': int(os.getenv('SELENIUM_CMD_TIMEOUT', 30)), 'idle-timeout': int(os.getenv('SELENIUM_IDLE_TIMEOUT', 10)), 'tunnel-identifier': os.getenv('SELENIUM_TUNNEL'), } context.logger.info("Running Sauce with capabilities: %s" % desired_capabilities) sauce_config = {"username": os.getenv('SAUCE_USER'), "access-key": os.getenv("SAUCE_KEY")} context.sauce_config = sauce_config driver = webdriver.Remote( desired_capabilities=desired_capabilities, command_executor="http://%s:%[email protected]:80/wd/hub" % (sauce_config['username'], sauce_config['access-key']) ) else: driver = webdriver.Chrome(context.chromedriver_path) context.base = Base(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.home = Home(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.loan_comparison = LoanComparison(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.loan_options = LoanOptions(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.rate_checker = RateChecker(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.navigation = Navigation(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.screenshot = Screenshot(context.base, context.take_screenshots) context.utils = Utils(context.base) context.logger.info('TEST ENVIRONMENT = %s' % context.base_url)
def before_all(context): setup_config(context) setup_logger(context) context.query = QueryHelper(context.logger, context.base_url) context.utils = Utils(context.query) context.logger.info('TEST ENVIRONMENT = %s' % context.base_url)
class TestSearch: data = Utils.from_file("../datas/test_search.yaml") def setup_class(self): self.app = App() self.app.start() def teardown_class(self): self.app.stop() def setup(self): pass def teardown(self): self.app.goto_main().goto_search().back() @pytest.mark.parametrize(data['keys'], data['values']) def test_search(self, keyword): self.app.goto_main().goto_search().search(keyword)
def before_all(context): fast_fail = os.getenv('FAST_FAIL', False) setup_config(context) setup_logger(context) if (fast_fail): connection = httplib.HTTPConnection("fake.ghe.domain", timeout=10) connection.request("GET", "/") page_response = connection.getresponse() if page_response.status != 200: eMessage = str(page_response.status) + " " + page_response.reason raise Exception(eMessage) if context.browser == 'Sauce': context.logger.info("Using Sauce Labs") desired_capabilities = { 'name': os.getenv('SELENIUM_NAME', 'CKAN browser tests') + str(datetime.now()), 'platform': os.getenv('SELENIUM_PLATFORM', 'WINDOWS 7'), 'browserName': os.getenv('SELENIUM_BROWSER', 'chrome'), 'version': int(os.getenv('SELENIUM_VERSION', 33)), 'max-duration': 7200, 'record-video': os.getenv('SELENIUM_VIDEO', True), 'video-upload-on-pass': os.getenv('SELENIUM_VIDEO_UPLOAD_ON_PASS', True), 'record-screenshots': os.getenv('SELENIUM_SCREENSHOTS', False), 'command-timeout': int(os.getenv('SELENIUM_CMD_TIMEOUT', 30)), 'idle-timeout': int(os.getenv('SELENIUM_IDLE_TIMEOUT', 10)), 'tunnel-identifier': os.getenv('SELENIUM_TUNNEL'), 'selenium-version': os.getenv('SELENIUM_LIB', '2.45.0'), 'screen-resolution': os.getenv('SELENIUM_RESOLUTION', '1024x768') } context.logger.info("Running Sauce with capabilities: %s" % desired_capabilities) sauce_config = { "username": os.getenv('SAUCE_USER'), "access-key": os.getenv("SAUCE_KEY") } context.sauce_config = sauce_config driver = webdriver.Remote( desired_capabilities=desired_capabilities, command_executor="http://%s:%[email protected]:80/wd/hub" % (sauce_config['username'], sauce_config['access-key'])) else: driver = webdriver.Chrome(context.chromedriver_path) context.base = Base(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.home = Home(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.navigation = Navigation(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.datasets = Datasets(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.organizations = Organizations(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.groups = Groups(context.logger, context.directory, context.base_url, driver, 10, context.delay_secs) context.screenshot = Screenshot(context.base, context.take_screenshots) context.utils = Utils(context.base)
def step(context, link_name): context.base.click_link(link_name) Utils().zzz(2)