Skip to content

Add Selenium test case for rerunning analysis feature in GobView #1113

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

Closed
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
32 changes: 31 additions & 1 deletion scripts/test-gobview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from threading import Thread
import http.server
Expand All @@ -28,7 +29,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
class Server(socketserver.TCPServer):
allow_reuse_address = True # avoids that during a consecutive run the server cannot connect due to an 'Adress already in use' os error
allow_reuse_address = True # avoids that during a consecutive run the server cannot connect due to an 'Address already in use' os error

httpd = Server((IP, PORT), Handler)
print("serving at port", PORT)
Expand Down Expand Up @@ -62,6 +63,35 @@ class Server(socketserver.TCPServer):
panel = browser.find_element(By.CLASS_NAME, "panel")
print("found DOM elements main, sidebar-left, sidebar-right, content and panel")

# simulate work flow for analysis rerun
parameterViewTab = browser.find_element(By.ID, "nav-item-2")
parameterViewTab.click()
parameterView = browser.find_element(By.ID, "parameterview")
print("found DOM element parameterview")
inputBar = browser.find_element(By.CLASS_NAME, "input")
inputBar.clear()
invalidFeedback = browser.find_element(By.XPATH, '//div[@class="invalid-tooltip"]')

feedback = invalidFeedback.text
assert(feedback == "At least one parameter has to be entered")
print("found the feedback", feedback)

parameter = '--incremental.force-reanalyze.funs ["main"]'
inputBar.send_keys(parameter)
inputBar.send_keys(Keys.ENTER)

# wait for ten seconds to let the analysis finish
browser.implicitly_wait(10)

parameterChip = browser.find_element(By.XPATH, '//span[@class="m-1 badge rounded-pill bg-secondary text"]')
textFromParameterChip = parameterChip.text
assert(textFromParameterChip == parameter)
print("found the parameter chip in history", textFromParameterChip)

# search for first tick symbol in history
executedSvg = browser.find_element(By.XPATH, '//svg[@class="bi bi-check2"]')
print("found tick symbol in history indicating successful reanalysis")

cleanup(browser, httpd, thread)

except Exception as e:
Expand Down