@then('no functionality issues for "{dataset}" have been flagged by the users') def step_impl(context, dataset): if CONFIG_DICT.get("known_gssutils_issues", None): if dataset in CONFIG_DICT.get("known_gssutils_issues"): raise UserDefinedError( f'Known gssutils issue: "{CONFIG_DICT["known_gssutils_issues"][dataset]}". \n' 'When said issue has been resolved please update config.yaml to reflect this.' ) @then('the scraper contains at least one valid distribution') def step_impl(context): err_msg = 'Content fault. The scrape does not appear to contain a distribution' try: try: assert len(context.scrape.distributions) > 0, err_msg except: found = False for dataset in context.scrape.catalog.dataset: if len(dataset.distribution) > 0: found = True if not found: raise err_msg except Exception as err: raise Exception(err_msg + '\n' + json.dumps( parse_scrape_to_json(context.scrape), indent=2)) from err allure_report("./allure-report")
def before_all(context): context.browser = Browser() context.home_page = HomePage() context.manage_your_money_page = ManageYourMoneyPage() context.login_page = LoginPage() allure_report("path/to/result/dir")
from behave import * from selenium import webdriver from webdriver_manager.firefox import GeckoDriverManager from pop_selenium.pages.home_page import HomePage from pop_selenium.pages.search_page import SearchPage from pop_selenium.pages.summary_page import SummaryPage from allure_behave.hooks import allure_report allure_report("result") def before_all(context): option = webdriver.FirefoxOptions() context.driver = webdriver.Firefox( options=option, executable_path=GeckoDriverManager().install()) context.driver.maximize_window() context.driver.get("http://automationpractice.com/") context.home_page = HomePage(context.driver) context.search_page = SearchPage(context.driver) context.summary_page = SummaryPage(context.driver) def after_all(context): context.driver.quit()
from behave import use_fixture from base.fixtures import user from allure_behave.hooks import allure_report """turn on fixture for each feature""" def before_feature(context, feature): context.bot = feature.tags use_fixture(user, context) """create allure reports""" allure_report("reports/")
from context.driver import driver from allure_behave.hooks import allure_report def after_all(context): driver.stop_instance() def before_scenario(context, scenario): driver.clear_cookies() allure_report('reports')
from webdrivermanager import GeckoDriverManager, ChromeDriverManager from configparser import ConfigParser from selenium import webdriver import os from allure_behave.hooks import allure_report import random import string ROOT_DIR = os.path.dirname( os.path.abspath(__file__) ) # serves to reference root path of the project for use in the fw SETTINGS_PATH = os.path.join(ROOT_DIR, 'settings.ini') allure_report(os.path.join(ROOT_DIR, 'reports/')) cfg = ConfigParser() cfg.read(SETTINGS_PATH) def get_driver(): """ Handles download and installation of a required webdriver according to parameters set in settings.ini """ browser = cfg['meta']['Browser'] if browser.lower() == 'firefox': driver = webdriver.Firefox( executable_path=GeckoDriverManager().download_and_install()[0]) elif browser.lower() == 'chrome': driver = webdriver.Chrome( executable_path=ChromeDriverManager().download_and_install()[0]) return driver
from browser import Browser from allure_behave.hooks import allure_report allure_report("path/to/result/dir") def before_all(context): context.browser = Browser() def after_all(context): context.browser.browser_quit() def after_scenario(context, scenario): context.browser.browser_clear()
chrome_options = Options() # chrome_options.add_argument("--headless") context.driver = webdriver.Chrome(options=chrome_options) context.driver.maximize_window() context.driver.implicitly_wait(5) time.sleep(2) @when('open orange hrm homepage') def test_OpenHomepage(context): context.driver.get("https://opensource-demo.orangehrmlive.com") time.sleep(2) @then('verify that the logo present on page') def test_verifylogo(context): status_page = context.driver.find_element_by_xpath( "//div[@id='divLogo']//img").is_displayed() time.sleep(2) assert status_page is True @then('Close browser') def test_closebrowser(context): time.sleep(2) context.driver.close() allure_report( "C:/Users/elsys/Documents/pycharm_robot/udemy_selenium/features/reports")
def before_scenario(ctx: Context, scenario: Scenario): # start browser ctx.proxy.reset() desired_capabilities = { "platformName": "Android", "deviceName": "Pixel_API_28", "automationName": "UiAutomator2", "appPackage": "com.example.car.warehouse", "appActivity": "com.example.car.warehouse.ui.CarsList", "noReset": "noReset" in scenario.tags, "app": "warehouse.apk", "forceEspressoRebuild": "true" } driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities) ctx.browser = driver setattr(ctx, "appium_utils", AndroidUiAutomator2Utils(ctx.browser)) ctx.browser.implicitly_wait(10) def after_scenario(ctx: Context, scenario: Scenario): ctx.browser.quit() ctx.proxy.reset() allure_report("./reports")
def after_all(context): print("inside after all") allure_report('../reports')