Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Update util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
swim-mer committed May 1, 2020
1 parent 367f91b commit 548170c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions includes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import unittest
from contextlib import redirect_stdout
from io import StringIO
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC


def run_test(classname, data, modulename):
Expand Down Expand Up @@ -42,3 +45,22 @@ def parse_results(buffer):
return 'FAIL'
else:
return 'Test failed to execute'

def login(workspace, username, password, driver):
''' Function to log user in to workspace.
'''
# Select and submit workspace
driver.find_element_by_id('display_select_input').click()
driver.find_element_by_link_text(workspace).click()
driver.find_element_by_id('sentworkspace').click()

# Wait for login page to load
wait = WebDriverWait(driver, 30)
wait.until(EC.element_to_be_clickable((By.ID, 'form[BSUBMIT]')))

# Login
driver.find_element_by_id('form[USR_USERNAME]').send_keys(username)
driver.find_element_by_id('form[USR_PASSWORD_MASK]').send_keys(password)
driver.find_element_by_id('form[BSUBMIT]').click()

return driver

0 comments on commit 548170c

Please sign in to comment.