Skip to content

Commit

Permalink
Add upload/download test
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Sep 15, 2024
1 parent e8803de commit ce0bc65
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions page_perf_timer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import argparse
import functools
import hashlib
import os
import sys
import time
import uuid

import requests

# Generated by Selenium IDE
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
Expand Down Expand Up @@ -162,6 +165,44 @@ def login_to_galaxy_homepage(self):
)
)

@clock_action("dummy_file_upload")
def upload_dummy_file(self):
upload_activity = self.driver.find_element(By.ID, "activity-upload")
upload_activity.click()
# paste/fetch data
paste_button = self.driver.find_element(By.ID, "btn-new")
paste_button.click()
# paste/fetch data
upload_row = self.driver.find_element(By.XPATH, "//div[@id='upload-row-0']//textarea")
upload_row.send_keys("https://zenodo.org/records/13711466/files/(Galaxy%20History)%20Selenium_test_1_Input_data.rocrate.zip?download=1")
# start
start_button = self.driver.find_element(By.ID, "btn-start")
start_button.click()
# close
close_button = self.driver.find_element(By.ID, "btn-close")
close_button.click()
# wait for history item to appear
self.wait.until(
expected_conditions.presence_of_element_located(
(
By.XPATH,
"//div[@data-index='0']//div[@data-state='running' and contains(., 'Selenium_test_1_Input_data')]",
)
)
)

@clock_action("dummy_file_download")
def download_dummy_file(self):
open_download_link = self.driver.find_element(By.XPATH, "//div[@data-index='0']//div[@data-state='running' and contains(., 'Selenium_test_1_Input_data')]")
open_download_link.click()
with SeleniumCustomWait(self.driver, 1200):
download_link = self.driver.find_element(By.XPATH, "//div[@data-index='0']//div[@data-state='ok' and contains(., 'Selenium_test_1_Input_data')]//a[@title='Download']")
r = requests.get(download_link.get_attribute("href"), stream=True)
sig = hashlib.md5()
for line in r.iter_lines():
sig.update(line)
assert sig.hexdigest() == "a62aaaefa04bdc7acd3b29a127bba3e6"

@clock_action("tool_search_load")
def search_for_tool(self):
# Select tool search box
Expand Down Expand Up @@ -402,6 +443,8 @@ def run_test_sequence(self):
self.load_workflow_list()
self.load_workflow_run_form()
self.run_workflow()
self.upload_dummy_file()
self.download_dummy_file()

def measure_timings(self):
self.timings = {}
Expand Down

0 comments on commit ce0bc65

Please sign in to comment.