Skip to content

Commit

Permalink
Update login.py
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaa05 authored Aug 26, 2024
1 parent b68ac5e commit ed760f5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions gen3-integration-tests/pages/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ def __init__(self):
)
self.LOGOUT_NORMALIZE_SPACE = "//a[normalize-space()='Logout']"

def go_to(self, page: Page, url=None):
def go_to(self, page: Page):
"""Goes to the login page"""
if url:
page.goto(url)
screenshot(page, "UrlPage")
else:
page.goto(self.BASE_URL)
page.wait_for_selector(self.READY_CUE, state="visible")
screenshot(page, "LoginPage")
page.goto(self.BASE_URL)
page.wait_for_selector(self.READY_CUE, state="visible")
screenshot(page, "LoginPage")

def login(
self,
Expand Down Expand Up @@ -127,24 +123,25 @@ def orcid_login(self, page: Page):
screenshot(page, "BeforeORCIDLogin")
orcid_login_button.click()

def ras_login(
self,
page: Page,
username=os.environ["CI_TEST_RAS_USERID"],
password=os.environ["CI_TEST_RAS_PASSWORD"],
):
def ras_login(self, page: Page, username: str, password: str):
# Perform RAS Login
ras_login_button = page.locator(self.RAS_LOGIN_BUTTON)
expect(ras_login_button).to_be_visible(timeout=5000)
screenshot(page, "RASLoginPage")
# ras_login_button = page.locator(self.RAS_LOGIN_BUTTON)
# expect(ras_login_button).to_be_visible(timeout=5000)
page.locator(self.RAS_USERNAME_INPUT).fill(username)
page.locator(self.RAS_PASSWORD_INPUT).fill(password)
screenshot(page, "BeforeRASLogin")
ras_login_button.click()
ras_signin_button = page.locator(self.RAS_SIGN_IN_BUTTON)
ras_signin_button.click()
screenshot(page, "RASAfterLogging")
# Handle the Grant access button
if page.locator(self.RAS_GRANT_BUTTON).is_enabled(timeout=5000):
if page.locator(self.RAS_GRANT_BUTTON).is_visible(timeout=5000):
logger.info("Clicking on Grant button")
page.locator(self.RAS_GRANT_BUTTON).click()
screenshot(page, "AfterRASLogin")
if page.locator(self.RAS_ACCEPT_AUTHORIZATION_BUTTON).is_visible(timeout=5000):
logger.info("Clicking on Authorization button")
page.locator(self.RAS_ACCEPT_AUTHORIZATION_BUTTON).click()
time.sleep(5)
screenshot(page, "RASAfterClickingAuthorizationButton")

def logout(self, page: Page):
"""Logs out and wait for Login button on nav bar"""
Expand Down

0 comments on commit ed760f5

Please sign in to comment.