Skip to content

Commit

Permalink
adding steps for plotting a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Muryanto authored and Muryanto committed Oct 3, 2018
1 parent 1dd0130 commit 73bfabf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
13 changes: 13 additions & 0 deletions frontend/tests/lib/MainPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
from BasePage import InvalidPageException
from selenium.common.exceptions import NoSuchElementException

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

class MainPage(BasePage):

_alert_locator = '//div[@role="alert"]'

_var_delete_locator = "//li[@class='action-remove-button']"

_variable_plot_locator = "//div[@class='plotter-plots']//div[@id='plot000']"

def __init__(self, driver):
super(MainPage, self).__init__(driver)

Expand Down Expand Up @@ -53,4 +58,12 @@ def delete_variable(self, var):
var_delete_element = self.driver.find_element_by_xpath(self._var_delete_locator)
var_delete_element.click()

def plot_variable(self, var):
print("...click on the variable {v} on main page".format(v=var))
var_element = self.find_variable(var)

plot_area_element = self.driver.find_element_by_xpath(self._variable_plot_locator)
print("...drag the variable to the plot area...")
ActionChains(self.driver).drag_and_drop(var_element, plot_area_element).perform()
print("...sleep for 20 seconds...")
time.sleep(20)
16 changes: 15 additions & 1 deletion frontend/tests/testcases/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _remove_variable(self, main_page, var_name):
print("...sleep for 5 seconds...")
time.sleep(5)

def testAddVariable(self):
def COMMENTOUTtestAddVariable(self):
# click on the Variable + button on main page
main_page = MainPage(self.driver)

Expand All @@ -78,6 +78,20 @@ def testAddVariable(self):
var_name = 'clt'
self._remove_variable(main_page, var_name)


def testPlotVariable(self):
# click on the Variable + button on main page
main_page = MainPage(self.driver)

# TEMPORARY hard code
data_file = "/Users/muryanto1/work/vcdat/miniconda2/envs/vcdat/share/uvcdat/sample_data/clt.nc"
self._add_variable(main_page, data_file)

# TEMPORARY
var_name = 'clt'
main_page.plot_variable(var_name)


if __name__ == '__main__':
unittest.main(verbosity=2)

0 comments on commit 73bfabf

Please sign in to comment.