def ui_dashboard(browser_session, ui_loginpage, ui_user): """Tool to navigate to the dashboard by logging in.""" selenium = browser_session if 'Welcome to Cloud Meter' in selenium.page_source: browser = Browser(selenium) login = None return browser, LoginView(browser) elif 'Login to Your Account' in selenium.page_source: browser, login = ui_loginpage() elif not selenium.current_url.startswith('http'): browser, login = ui_loginpage() else: browser = Browser(selenium) login = None wait = WebDriverWait(selenium, 30) if login: # Login passes with correct password login.password.fill(ui_user['password']) login.login.click() text = 'Welcome to Cloud Meter' try: wait.until(wait_for_page_text(text)) except TimeoutException as e: e.msg = f'{text} not found in page: {selenium.page_source}' return browser, login
def __init__(self, selenium, kiali_versions, plugin_class=None, logger=None, extra_objects=None): Browser.__init__(self, selenium, plugin_class=None, logger=None, extra_objects=None) self.kiali_versions = kiali_versions
def browser(selenium, request): name = request.module.__name__.split("_")[1] category = getattr(request.module, "CATEGORY", "components") url = "https://patternfly-react.surge.sh/patternfly-4/{}/{}/?shadow=false" selenium.maximize_window() selenium.get(url.format(category, name)) return Browser(selenium)
def browser(request): """Selenium instance. See README for configuration of remote browser containers. """ # Default to chrome for UI testing. driver_type = os.environ.get("SELENIUM_DRIVER", "chrome").lower() debug_mode = os.environ.get("SELENIUM_DEBUG", "false").lower() == "true" if driver_type == "chrome": chrome_options = webdriver.ChromeOptions() if not debug_mode: chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--allow-insecure-localhost") driver = webdriver.Remote( "http://127.0.0.1:4444/wd/hub", desired_capabilities=chrome_options.to_capabilities(), ) elif driver_type == "firefox": firefox_options = webdriver.firefox.options.Options() if debug_mode: firefox_options.add_argument("--headless") driver = webdriver.Remote( "http://127.0.0.1:4444/wd/hub", desired_capabilities=firefox_options.to_capabilities(), ) else: raise ValueError( f"Unsupported SELENIUM_DRIVER provided: {driver_type}") driver.get(get_qpc_url()) driver.maximize_window() yield Browser(driver) driver.close()
def browser(selenium, request): name = request.module.__name__.split("_")[1] category = getattr(request.module, "CATEGORY", "components") url = f"https://patternfly-react.surge.sh/patternfly-4/documentation/react/{category}/{name}" selenium.maximize_window() selenium.get(url) return Browser(selenium)
def browser(selenium, request): name = request.module.__name__.split("_")[1] selenium.maximize_window() category = request.module.CATEGORY if hasattr(request.module, 'CATEGORY') else "components" selenium.get( "https://www.patternfly.org/v4/documentation/react/{}/{}".format( category, name)) return Browser(selenium)
def _(): selenium.get(base_url(get_config())) assert selenium.title == 'Cloud Meter', selenium.page_source browser = Browser(selenium) login = LoginView(browser) # User is directed to the login page, not the dashboard wait = WebDriverWait(selenium, 30) wait.until(wait_for_page_text('Log In to Your Account')) return browser, login
def browser(request): # todo: replace with webdriver-kaifuku and move settings and etc to config files logger.info("openning chrome browser") chrome_options = ChromeOptions() chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--start-maximized') chrome_options.add_argument("--window-size=1920,1080") chrome_options.add_argument('--headless') driver = Chrome(options=chrome_options) logger.info('step 1. Go to https://sprintboards.io/auth/login') driver.get(APP_URL) app_browser = Browser(selenium=driver) request.addfinalizer(app_browser.close_window) yield app_browser
def ui_acct_list(browser_session, ui_loginpage, ui_user): """Tool to navigate to the account list by logging in.""" selenium = browser_session if 'Welcome to Cloud Meter' in selenium.page_source: browser = Browser(selenium) return browser, LoginView(browser) elif 'Login to Your Account' in selenium.page_source: browser, login = ui_loginpage() elif not selenium.current_url.startswith('http'): browser, login = ui_loginpage() else: browser = Browser(selenium) login = None if login: wait = WebDriverWait(selenium, 10) # Login passes with correct password login.password.fill(ui_user['password']) login.login.click() wait.until(wait_for_page_text('Accounts')) return browser, login
def browser(selenium, request): module = request.module try: page = module.SUBPAGE except AttributeError: page = name = module.__name__.split("_")[1] category = getattr(module, "CATEGORY", "components") page = f"{category}/{name}" name = request.module.__name__.split("_")[1] category = getattr(request.module, "CATEGORY", "components") if "ouia" in request.module.__file__: url = f"https://patternfly-docs-ouia.netlify.app/documentation/react/{page}" else: url = f"https://patternfly-react.surge.sh/documentation/react/{page}" selenium.maximize_window() selenium.get(url) return Browser(selenium)
def browser(selenium, request): selenium.get(request.module.TESTING_PAGE_URL) yield Browser(selenium) selenium.refresh()
def browser(selenium, request): selenium.maximize_window() selenium.get(request.module.TESTING_PAGE_URL) return Browser(selenium)
def browser(selenium, request): name = request.module.__name__.lstrip("test_") selenium.get( "http://patternfly-react.surge.sh/patternfly-4/components/{}".format( name)) return Browser(selenium)
def browser(selenium, request): name = request.module.__name__.split("_")[1] selenium.maximize_window() selenium.get("http://patternfly-react.surge.sh/patternfly-4/components/{}".format(name)) return Browser(selenium)