-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
706f37c
commit cdaaca8
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import os | ||
import pytest | ||
|
||
from utils import logger | ||
from playwright.sync_api import Page, expect | ||
|
||
from utils.test_execution import screenshot | ||
from utils.gen3_admin_tasks import get_portal_config | ||
|
||
|
||
class GWASPage(object): | ||
def __init__(self): | ||
self.BASE_URL = f"{pytest.root_url_portal}" | ||
# Endpoints | ||
self.ANALYSIS_ENDPOINT = f"{self.BASE_URL}/analysis" | ||
self.GWAS_UI_APP_ENDPOINT = f"{self.ANALYSIS_ENDPOINT}/GWASUIApp" | ||
# Locators | ||
self.ACCEPT_PRE_LOGIN_BUTTON = "//button[normalize-space()='Accept']" | ||
self.LOGIN_BUTTON = "//button[normalize-space()='InCommon Login']" | ||
self.PROJECT_SELECTOR_BOX = "//span[@role='button']//*[name()='svg']" | ||
self.PROJECT_SELECTOR_DROPDOWN = "//span[@class='ant-select-selection-item']" | ||
self.PROJECT_SUBMISSION = "//span[normalize-space()='Submit']" | ||
|
||
def login( | ||
self, | ||
page: Page, | ||
user, | ||
): | ||
""" | ||
Sets up Dev Cookie for main Account and logs in with Google | ||
Also checks if the access_token exists after login | ||
""" | ||
expect(page.locator(self.LOGIN_BUTTON)).to_be_visible(timeout=10000) | ||
page.locator(self.ACCEPT_PRE_LOGIN_BUTTON).click() | ||
try: | ||
button = page.locator(self.LOGIN_BUTTON) | ||
if button.is_enabled(timeout=5000): | ||
button.click() | ||
logger.info(f"Clicked on login button : {self.LOGIN_BUTTON}") | ||
except Exception: | ||
logger.info(f"Login Button {self.LOGIN_BUTTON} not found or not enabled") | ||
screenshot(page, "AfterClickingLoginButton") | ||
expect(page.locator(f'//div[contains(text(), "{user}")]')).to_be_visible( | ||
timeout=10000 | ||
) | ||
screenshot(page, "AfterLogin") | ||
self.handle_popup(page) | ||
access_token_cookie = next( | ||
( | ||
cookie | ||
for cookie in page.context.cookies() | ||
if cookie["name"] == "access_token" | ||
), | ||
None, | ||
) | ||
assert ( | ||
access_token_cookie is not None | ||
), "Access token cookie not found after login" | ||
|
||
def goto_analysis_page(self, page: Page): | ||
page.goto(self.ANALYSIS_ENDPOINT) | ||
screenshot(page, "GWASAnalysisPage") | ||
|
||
def goto_gwas_ui_app_page(self, page: Page): | ||
page.goto(self.GWAS_UI_APP_ENDPOINT) | ||
screenshot(page, "GWASUIAppPage") | ||
|
||
def select_team_project(self, page: Page, project_name): | ||
logger.info("Clicking on Project selector box") | ||
project_selector_box = page.locator(self.PROJECT_SELECTOR_BOX) | ||
expect(project_selector_box).to_be_visible(timeout=5000) | ||
project_selector_box.click() | ||
|
||
logger.info("Clicking on Project selector dropdown") | ||
project_selector_dropdown = page.locator(self.PROJECT_SELECTOR_DROPDOWN) | ||
expect(project_selector_dropdown).to_be_visible(timeout=5000) | ||
project_selector_dropdown.click() | ||
|
||
logger.info("Clicking on the project") | ||
self.PROJECT_NAME = f"//div[@title='/gwas_projects/{project_name}']" | ||
project_name_locator = page.locator(self.PROJECT_NAME) | ||
expect(project_name_locator).to_be_visible(timeout=5000) | ||
project_name_locator.click() | ||
|
||
page.locator(self.PROJECT_SUBMISSION).click() | ||
|
||
screenshot(page, "AfterSelectingProject") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
from utils import logger | ||
|
||
from pages.login import LoginPage | ||
from pages.gwas import GWASPage | ||
|
||
|
||
@pytest.mark.argo_wrapper | ||
class TestArgoWrapper(object): | ||
login_page = LoginPage() | ||
gwas_page = GWASPage() | ||
|
||
def test_submit_workflow_1(self, page): | ||
""" | ||
Scenario: Submit workflow Continuous Outcome - Continuous Covariate Phenotype | ||
Steps: | ||
1. | ||
""" | ||
# Login with main_account | ||
self.login_page.go_to(page) | ||
self.gwas_page.login(page, user="krishnaa@uchicago.edu") | ||
|
||
# Perform operations on GWAS Page | ||
self.gwas_page.goto_analysis_page(page) | ||
self.gwas_page.select_team_project(page, project_name="project2") | ||
self.gwas_page.goto_gwas_ui_app_page(page) |