Skip to content

Commit

Permalink
Merge pull request #218 from ricardobranco777/master
Browse files Browse the repository at this point in the history
Adapt hawk_test code to support testing for 12-SP2
  • Loading branch information
MalloZup authored Aug 25, 2020
2 parents 50ea9e1 + 8ac86fe commit eb08117
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
12 changes: 7 additions & 5 deletions e2e_test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ RUN zypper -n install -y --no-recommends \
xorg-x11-server-Xvfb && \
zypper -n clean -a

RUN zypper -n install -y --no-recommends wget tar gzip
RUN zypper -n clean -a
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
RUN tar xvf geckodriver-v0.26.0-linux64.tar.gz
RUN mv geckodriver /usr/local/bin
RUN zypper -n install -y --no-recommends \
gzip \
tar \
wget && \
zypper -n clean -a && \
wget -O- https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz | tar xf - -C /usr/local/bin/

RUN chmod +x /usr/local/bin/*

RUN useradd -l -m -d /test test
Expand Down
34 changes: 25 additions & 9 deletions e2e_test/hawk_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def find_element(self, bywhat, texto, tout=60):
return elem

def verify_success(self):
elem = self.find_element(By.CLASS_NAME, 'alert-success', 60)
elem = self.find_element(By.CLASS_NAME, 'alert-success', 60 * self.timeout_scale)
if not elem:
elem = self.find_element(By.PARTIAL_LINK_TEXT, 'Rename', 5)
if not elem:
Expand Down Expand Up @@ -323,11 +323,12 @@ def test_remove_cluster(self, cluster_name):
print("TEST: test_remove_cluster")
self.click_on('Dashboard')
self.check_and_click_by_xpath("Click on Dashboard", [Xpath.HREF_DASHBOARD])
elem = self.find_element(By.PARTIAL_LINK_TEXT, cluster_name)
if not elem:
print("ERROR: Couldn't find cluster [%s]. Cannot remove" % cluster_name)
return False
elem.click()
if Version(self.test_version) >= Version('12-SP3'):
elem = self.find_element(By.PARTIAL_LINK_TEXT, cluster_name)
if not elem:
print("ERROR: Couldn't find cluster [%s]. Cannot remove" % cluster_name)
return False
elem.click()
time.sleep(2 * self.timeout_scale)
elem = self.find_element(By.CLASS_NAME, 'close')
if not elem:
Expand All @@ -352,6 +353,13 @@ def test_remove_cluster(self, cluster_name):
if self.verify_success():
print("INFO: Successfully removed cluster: [%s]" % cluster_name)
return True
# HAWK2 version in 12-SP2 doesn't provide AJAX feedback for removal of cluster
if Version(self.test_version) < Version('12-SP3'):
self.click_on('Dashboard')
elem = self.find_element(By.PARTIAL_LINK_TEXT, cluster_name)
if not elem:
print("INFO: Successfully removed cluster: [%s]" % cluster_name)
return True
print("ERROR: Could not remove cluster [%s]" % cluster_name)
return False

Expand Down Expand Up @@ -533,9 +541,17 @@ def test_click_around_edit_conf(self):
print("TEST: test_click_around_edit_conf")
print("TEST: Will click on Constraints, Nodes, Tags, Alerts and Fencing")
self.check_edit_conf()
self.check_and_click_by_xpath("while checking around edit configuration",
[Xpath.HREF_CONSTRAINTS, Xpath.HREF_NODES, Xpath.HREF_TAGS,
Xpath.HREF_ALERTS, Xpath.HREF_FENCING])

click_list = [
Xpath.HREF_CONSTRAINTS, Xpath.HREF_NODES, Xpath.HREF_TAGS,
Xpath.HREF_ALERTS, Xpath.HREF_FENCING
]

# HAWK version below 12-SP3 does not provide link to fencing
if Version(self.test_version) < Version("12-SP3"):
click_list.remove(Xpath.HREF_FENCING)

self.check_and_click_by_xpath("while checking around edit configuration", click_list)
return self.test_status

def test_add_virtual_ip(self, virtual_ip):
Expand Down

0 comments on commit eb08117

Please sign in to comment.