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

Rework the logic and the tests of the graph visualization type checkboxes. #2193

Merged
merged 2 commits into from
Aug 25, 2017
Merged
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
4 changes: 3 additions & 1 deletion luigi/static/visualiser/js/visualiserApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function visualiserApp(luigi) {
*/
function updateVisType(newVisType) {
$('#toggleVisButtons label').removeClass('active');
$('#toggleVisButtons input[value="' + newVisType + '"]').parent().addClass('active');
var visTypeInput = $('#toggleVisButtons input[value="' + newVisType + '"]');
visTypeInput.parent().addClass('active');
visTypeInput.prop('checked', true);
}

function loadTemplates() {
Expand Down
21 changes: 9 additions & 12 deletions test/visualiser/visualiser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def test(self):

# tasks tab tests.
def test_keeps_entries_after_page_refresh(self):

port = self.get_http_port()
driver = webdriver.PhantomJS()

Expand Down Expand Up @@ -121,7 +120,6 @@ def test_keeps_entries_after_page_refresh(self):
assert len(driver.find_elements_by_css_selector('#taskTable tbody tr')) == 50

def test_keeps_table_filter_after_page_refresh(self):

port = self.get_http_port()
driver = webdriver.PhantomJS()

Expand All @@ -147,7 +145,6 @@ def test_keeps_table_filter_after_page_refresh(self):
assert len(driver.find_elements_by_css_selector('#taskTable tbody tr')) == 1

def test_keeps_order_after_page_refresh(self):

port = self.get_http_port()
driver = webdriver.PhantomJS()

Expand Down Expand Up @@ -235,7 +232,6 @@ def test_keeps_invert_after_page_refresh(self):
assert invert_checkbox.is_selected()

def test_keeps_task_id_after_page_refresh(self):

port = self.get_http_port()
driver = webdriver.PhantomJS()

Expand Down Expand Up @@ -276,25 +272,26 @@ def test_keeps_hide_done_after_page_refresh(self):
hide_done_checkbox = driver.find_element_by_css_selector('#hideDoneCheckbox')
assert hide_done_checkbox.is_selected()

def test_keeps_svg_visualisation_after_page_refresh(self):
def test_keeps_visualisation_type_after_page_refresh(self):
port = self.get_http_port()
driver = webdriver.PhantomJS()

driver.get('http://localhost:{}/static/visualiser/index.html#tab=graph'.format(port))

# Check initial state.
svg_radio = driver.find_element_by_css_selector('input[value=svg]')
assert svg_radio.is_selected() is False
assert svg_radio.is_selected()

# Change invert checkbox by clicking on label.
svg_radio.find_element_by_xpath('..').click()
# Change vistype to d3 by clicking on its label.
d3_radio = driver.find_element_by_css_selector('input[value=d3]')
d3_radio.find_element_by_xpath('..').click()

# Now refresh page and check. Invert checkbox shoud be checked.
# Now refresh page and check. D3 checkbox shoud be checked.
driver.refresh()

# Once page refreshed we have to find all selectors again.
svg_radio = driver.find_element_by_css_selector('input[value=svg]')
assert svg_radio.is_selected()
d3_radio = driver.find_element_by_css_selector('input[value=d3]')
assert d3_radio.is_selected()

def test_synchronizes_fields_on_graph_tab(self):
# Check fields population if tasks tab was opened by direct link.
Expand Down Expand Up @@ -353,7 +350,7 @@ class UberTask(luigi.Task):
"""
_done = False

base_task = luigi.Parameter()
base_task = luigi.TaskParameter()
x = luigi.Parameter()
copies = luigi.IntParameter()

Expand Down