Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Donot Merge - Test Only #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions gen3-integration-tests/pages/gwas.py
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")
27 changes: 27 additions & 0 deletions gen3-integration-tests/tests/test_argo_wrapper.py
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)
Loading