2010-04-07 02:48:00 +02:00
|
|
|
from windmill.authoring import WindmillTestClient
|
|
|
|
|
|
|
|
def test_gridworks():
|
|
|
|
client = WindmillTestClient(__name__)
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# food.csv tests
|
|
|
|
client.click(link=u'Food')
|
2010-04-07 02:48:00 +02:00
|
|
|
client.waits.forPageLoad(timeout=u'20000')
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# create text facet from 1st word of Short Description
|
2010-04-07 02:48:00 +02:00
|
|
|
filter_column(client, 'Shrt_Desc')
|
|
|
|
client.click(jquery=u'(".menu-item:contains(\'Custom Text Facet\')")[0]')
|
|
|
|
client.type(jquery=u'(".expression-preview-code")[0]', text=u"value.split(',')[0]")
|
|
|
|
client.click(jquery=u'("button:contains(\'OK\')")[0]')
|
|
|
|
client.click(jquery=u'("a:contains(\'re-sort by count\')")[0]')
|
|
|
|
assert_expected_top_value(client, 'BEEF')
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# Filter down to BEEF. Result == 457 rows
|
2010-04-07 02:48:00 +02:00
|
|
|
client.click(jquery=u'("a.facet-choice-label:contains(\'BEEF\')")[0]')
|
|
|
|
client.asserts.assertText(jquery=u'("span.viewPanel-summary-row-count")[0]', validator=u'457')
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# create numeric filter from Water column
|
|
|
|
# assert that there's NOT a facet panel named 'Water' yet
|
2010-04-07 02:48:00 +02:00
|
|
|
assert client.execJS(js=u'$(".facet-panel span:contains(\'Water\')").length')['output'] == 0
|
|
|
|
filter_column(client, 'Water')
|
|
|
|
client.click(jquery=u'(".menu-item:contains(\'Numeric Facet\')")[0]')
|
2010-04-07 10:28:53 +02:00
|
|
|
# assert that there's a facet panel named 'Water'
|
2010-04-07 02:48:00 +02:00
|
|
|
assert client.execJS(js=u'$(".facet-panel span:contains(\'Water\')").length')['output'] > 0
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# drag to filter down set. Result == 10 rows
|
2010-04-07 02:48:00 +02:00
|
|
|
client.dragDropElem(jquery=u'("a.ui-slider-handle")[0]', pixels=u'150, 0')
|
|
|
|
client.asserts.assertText(jquery=u'("span.viewPanel-summary-row-count")[0]', validator=u'457')
|
|
|
|
|
2010-04-07 10:28:53 +02:00
|
|
|
# Next TODO
|
|
|
|
# lowercase the Shrt_Desc
|
|
|
|
# TitleCase the Shrt_Desc
|
2010-04-07 02:48:00 +02:00
|
|
|
|
|
|
|
'''
|
2010-04-07 10:28:53 +02:00
|
|
|
# history test -- in progress
|
2010-04-07 02:48:00 +02:00
|
|
|
client.mouseOver(classname=u'history-panel-body-collapsed')
|
|
|
|
client.waits.forElement(link=u"Create new column Desc, split based on column Shrt_Desc by filling 0 rows with gel:split(value , ',')", timeout=u'8000')
|
|
|
|
client.click(jquery=u'(".history-future .history-entry")[0]')
|
|
|
|
client.click(jquery=u'(".history-past .history-entry")[0]')
|
|
|
|
'''
|
|
|
|
|
|
|
|
def assert_row_count(client, count):
|
|
|
|
client.asserts.assertText(jquery=u'("span.viewPanel-summary-row-count")[0]', validator=u'{0}'.format(count))
|
|
|
|
|
|
|
|
|
|
|
|
def filter_column(client, column):
|
|
|
|
client.click(jquery=u'(".column-header-layout tr:contains({0}) .column-header-menu")[0]'.format(column))
|
|
|
|
client.mouseOver(jquery=u'("td:contains(\'Filter\')")[0]')
|
|
|
|
|
|
|
|
|
|
|
|
def assert_expected_top_value(client, expected_value):
|
|
|
|
actual_value = client.execJS(js=u'$("a.facet-choice-label")[0].text')['output'].strip()
|
2010-04-07 10:28:53 +02:00
|
|
|
assert actual_value == expected_value, "Expected actual_value to be '{0}'. Got '{1}'".format(expected_value, actual_value)
|