def test_launch_about_app(): """ launches the about app """ client = logged_in_client() client.click(jquery='("img.hue-swoosh")[0]') client.waits.forElement(classname='Hue-ABOUT', timeout='2000')
def test_launch_about_app(): """ launches the about app """ client = logged_in_client() client.click(jquery='("img.ccs-swoosh")[0]') client.waits.forElement(classname='CCS-ABOUT', timeout='2000')
def test_flash_messaging(): client = logged_in_client() launch_jframe_gallery(client) time.sleep(3.0) # Give time for the launching growl to disappear client.click(id="flash") client.waits.forElement(jquery='(".growl")') client.asserts.assertJS(js="$$('.growl').length == 3") client.asserts.assertJS(js="$$('.growl')[0].get('html') == 'just a test'")
def test_flash_messaging(): client = logged_in_client() launch_jframe_gallery(client) time.sleep(3.0) # Give time for the launching growl to disappear client.click(id='flash') client.waits.forElement(jquery='(".growl")') client.asserts.assertJS(js="$$('.growl').length == 3") client.asserts.assertJS(js="$$('.growl')[0].get('html') == 'just a test'")
def test_forwarding(): client = logged_in_client() launch_jframe_gallery(client) client.click(id="forwarding") client.waits.forElement(jquery='(".test_letter")') client.asserts.assertJS(js="$('test_letter').innerHTML == 'X'") client.click(jquery="('.refresh')[0]") client.asserts.assertJS(js="$('test_letter').innerHTML == 'Y'")
def test_frame_tips(): """ logs the user in, launches the jframe tests, and then tests the frame_tips feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id="frame-tips") client.mouseOver(jquery='(".Hue-JFRAMEGALLERY .frame_tip")[1]') client.asserts.assertJS(js="document.getElement('div.Hue-JFRAMEGALLERY .footer-text').get('html') == \"link #2\"")
def test_forwarding(): client = logged_in_client() launch_jframe_gallery(client) client.click(id='forwarding') client.waits.forElement(jquery='(".test_letter")') client.asserts.assertJS(js="$('test_letter').innerHTML == 'X'") client.click(jquery="('.refresh')[0]") client.asserts.assertJS(js="$('test_letter').innerHTML == 'Y'")
def test_frame_tips(): """ logs the user in, launches the jframe tests, and then tests the frame_tips feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='frame-tips') client.mouseOver(jquery='(".CCS-JFRAMEGALLERY .frame_tip")[1]') client.asserts.assertJS(js='document.getElement(\'div.CCS-JFRAMEGALLERY .footer-text\').get(\'html\') == "link #2"')
def test_errors(): client = logged_in_client() launch_jframe_gallery(client) client.click(id="errors") for i in range(1, 9): id = "e_" + str(i) client.waits.forElement(id=id) client.click(id=id) client.waits.forElement(jquery='(".closeWin")[0]') client.click(jquery='(".closeWin")[0]')
def test_errors(): client = logged_in_client() launch_jframe_gallery(client) client.click(id='errors') for i in range(1, 9): id = "e_" + str(i) client.waits.forElement(id=id) client.click(id=id) client.waits.forElement(jquery='(".closeWin")[0]') client.click(jquery='(".closeWin")[0]')
def test_collapser(): client = logged_in_client() launch_jframe_gallery(client) client.click(id="collapser") client.asserts.assertJS(js="$('data_one').isDisplayed()") client.waits.forElement(id="collapser_one") client.click(id="collapser_one") time.sleep(0.5) # Give time for the transition client.asserts.assertJS(js="$('data_one').isDisplayed() == false") client.click(id="collapser_one") time.sleep(0.5) client.asserts.assertJS(js="$('data_one').isDisplayed()")
def test_frame_tips(): """ logs the user in, launches the jframe tests, and then tests the frame_tips feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='frame-tips') client.mouseOver(jquery='(".Hue-JFRAMEGALLERY .frame_tip")[1]') client.asserts.assertJS( js= 'document.getElement(\'div.Hue-JFRAMEGALLERY .footer-text\').get(\'html\') == "link #2"' )
def test_collapser(): client = logged_in_client() launch_jframe_gallery(client) client.click(id='collapser') client.asserts.assertJS(js="$('data_one').isDisplayed()") client.waits.forElement(id='collapser_one') client.click(id='collapser_one') time.sleep(0.5) # Give time for the transition client.asserts.assertJS(js="$('data_one').isDisplayed() == false") client.click(id='collapser_one') time.sleep(0.5) client.asserts.assertJS(js="$('data_one').isDisplayed()")
def test_split_view(): """ tests the split view interface, including the ability to resize the panes """ client = logged_in_client() launch_jframe_gallery(client) client.click(id="splitview") client.waits.forElement(jquery="('.Hue-JFRAMEGALLERY [data-filters*=SplitView]')[0]") client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .art-splitview-left')[0].getStyle('width') == '200px'") client.dragDropElem(jquery="('.Hue-JFRAMEGALLERY .art-splitview-splitter')[0]", pixels="-100,0") client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .art-splitview-left')[0].getStyle('width') == '101px'")
def test_user_creation(): client = logged_in_client() # launch useradmin client.click(id='hue-useradmin-menu') client.waits.forElement(jquery='(".useradmin")[0]', timeout='2000') # click add user and add "windmill_joe" user client.click(jquery="('.useradmin_add_user')[0]") client.type(text='windmill_joe', id='id_username') client.type(text='windmill', id='id_password1') client.type(text='windmill', id='id_password2') client.click(value='Save') # verify user is in list client.waits.forElement(classname='useradmin_userlist', timeout='2000') client.asserts.assertTextIn(classname='useradmin_userlist', validator='windmill_joe') # log in as windmill_joe logout(client) client = logged_in_client(user='******', passwd='windmill') logout(client) client = logged_in_client() # launch useradmin client.click(id='hue-useradmin-menu') client.waits.forElement(jquery='(".useradmin")[0]', timeout='2000') # delete the user client.click(jquery="('tr:contains(windmill_joe) .delete:last')[0]") client.click(jquery="('.useradmin .closeWin')[1]") # verify user is NOT in list client.waits.forElement(classname='useradmin_userlist', timeout='2000') client.asserts.assertNotTextIn(classname='useradmin_userlist', validator='windmill_joe')
def test_dblclick_delegates(): """ logs the user in, launches the jframe tests, and then tests the double click delegation feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='double-click-delegator') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .dblme")[0]') client.doubleClick(classname='dblme') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .mask').length") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .closeWin').length")
def test_dblclick_delegates(): """ logs the user in, launches the jframe tests, and then tests the double click delegation feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id="double-click-delegator") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .dblme")[0]') client.doubleClick(classname="dblme") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .mask').length") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .closeWin').length")
def test_context_menu(): """ logs the user in, launches the jframe tests, and then tests the context menu (right click) feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='context-menu') client.waits.forElement(jquery='(".CCS-JFRAMEGALLERY .show-options")[0]') #simulating right click, as windmill doesn't provide a mechanism for doing so #and it's regular (left) click event doesn't include page location information. client.execJS(js="$$('.context-menu-delegate')[0].fireEvent('contextmenu', new Event({type: 'click', page: {x: 20, y: 20}}))") client.asserts.assertJS(js='document.getElement(\'div.CCS-JFRAMEGALLERY .cm-one\').isVisible()') client.click(jquery='(".CCS-JFRAMEGALLERY")[0]') client.asserts.assertJS(js='!document.getElement(\'div.CCS-JFRAMEGALLERY .cm-one\').isVisible()')
def test_user_creation(): client = logged_in_client() # launch useradmin client.click(id='ccs-useradmin-menu') client.waits.forElement(jquery='(".useradmin")[0]', timeout='2000') # click add user and add "windmill_joe" user client.click(jquery="('.useradmin_add_user')[0]") client.type(text='windmill_joe', id='id_username') client.type(text='windmill', id='id_password1') client.type(text='windmill', id='id_password2') client.click(value='Save') # verify user is in list client.waits.forElement(classname='useradmin_userlist', timeout='2000') client.asserts.assertTextIn(classname='useradmin_userlist', validator='windmill_joe') # log in as windmill_joe logout(client) client = logged_in_client(user='******', passwd='windmill') logout(client) client = logged_in_client() # launch useradmin client.click(id='ccs-useradmin-menu') client.waits.forElement(jquery='(".useradmin")[0]', timeout='2000') # delete the user client.click(jquery="('tr:contains(windmill_joe) .delete:last')[0]") client.click(jquery="('.useradmin .closeWin')[1]") # verify user is NOT in list client.waits.forElement(classname='useradmin_userlist', timeout='2000') client.asserts.assertNotTextIn(classname='useradmin_userlist', validator='windmill_joe')
def test_post_load_prompt(): """ tests the prompt popup scooped from the response """ client = logged_in_client() launch_jframe_gallery(client) client.click(id="post-load-prompt-popup") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .confirm")[0]') client.click(name="prompt_value") client.type(text="blah", name="prompt_value") client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[1]") client.waits.forElement(jquery="('.Hue-JFRAMEGALLERY .jframe_padded ul li')[0]") client.asserts.assertTextIn(jquery="('.Hue-JFRAMEGALLERY .jframe_padded ul li')[0]", validator="blah")
def test_post_load_alert(): """ tests the alert popup scooped from the response. """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='post-load-alert-popup') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .mask').length") client.click(jquery="('.Hue-JFRAMEGALLERY .mask')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .mask').length") client.click(id='post-load-alert-popup') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .closeWin').length")
def test_post_load_alert(): """ tests the alert popup scooped from the response. """ client = logged_in_client() launch_jframe_gallery(client) client.click(id="post-load-alert-popup") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.asserts.assertJS(js="$$('.Hue-JFRAMEGALLERY .mask').length") client.click(jquery="('.Hue-JFRAMEGALLERY .mask')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .mask').length") client.click(id="post-load-alert-popup") client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .alert")[0]') client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[0]") client.asserts.assertJS(js="!$$('.Hue-JFRAMEGALLERY .closeWin').length")
def test_post_load_prompt(): """ tests the prompt popup scooped from the response """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='post-load-prompt-popup') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .confirm")[0]') client.click(name='prompt_value') client.type(text='blah', name='prompt_value') client.click(jquery="('.Hue-JFRAMEGALLERY .closeWin')[1]") client.waits.forElement( jquery="('.Hue-JFRAMEGALLERY .jframe_padded ul li')[0]") client.asserts.assertTextIn( jquery="('.Hue-JFRAMEGALLERY .jframe_padded ul li')[0]", validator='blah')
def test_context_menu(): """ logs the user in, launches the jframe tests, and then tests the context menu (right click) feature """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='context-menu') client.waits.forElement(jquery='(".Hue-JFRAMEGALLERY .show-options")[0]') #simulating right click, as windmill doesn't provide a mechanism for doing so #and it's regular (left) click event doesn't include page location information. client.execJS( js= "$$('[data-filters*=ContextMenu]')[0].fireEvent('contextmenu', new Event({type: 'click', page: {x: 20, y: 20}}))" ) client.asserts.assertJS( js='document.getElement(\'div.Hue-JFRAMEGALLERY .cm-one\').isVisible()' ) client.click(jquery='(".Hue-JFRAMEGALLERY")[0]') client.asserts.assertJS( js='!document.getElement(\'div.Hue-JFRAMEGALLERY .cm-one\').isVisible()' )
def test_split_view(): """ tests the split view interface, including the ability to resize the panes """ client = logged_in_client() launch_jframe_gallery(client) client.click(id='splitview') client.waits.forElement( jquery="('.Hue-JFRAMEGALLERY [data-filters*=SplitView]')[0]") client.asserts.assertJS( js= "$$('.Hue-JFRAMEGALLERY .art-splitview-left')[0].getStyle('width') == '200px'" ) client.dragDropElem( jquery="('.Hue-JFRAMEGALLERY .art-splitview-splitter')[0]", pixels='-100,0') client.asserts.assertJS( js= "$$('.Hue-JFRAMEGALLERY .art-splitview-left')[0].getStyle('width') == '101px'" )
# Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from desktop.lib.windmill_util import logged_in_client def test_${app_name}(): """ launches the default view for ${app_name} """ client = logged_in_client() client.click(id='hue-${app_name}-menu') client.waits.forElement(classname='Hue-${app_name.upper()}', timeout='2000')
def test_hbexplorer(): """ launches the default view for hbexplorer """ client = logged_in_client() client.click(id='ccs-hbexplorer-menu') client.waits.forElement(classname='CCS-HBEXPLORER', timeout='2000')
def test_login_and_logout(): client = logged_in_client() # TODO: there's some race condition here :( time.sleep(2.5) logout(client)
def test_zkui(): """ launches the default view for zkui """ client = logged_in_client() client.click(id='ccs-zkui-menu') client.waits.forElement(classname='CCS-ZKUI', timeout='2000')
def test_launch(): """ Simply opens and closes JobBrowser. """ client = logged_in_client() client.click(id='hue-jobbrowser-menu') client.waits.forElement(jquery='(".close")[0]', timeout='300') client.click(jquery='(".close")[0]')
def test_shell(): """ launches the default view for shell """ client = logged_in_client() client.click(id="hue-shell-menu") client.waits.forElement(classname="Hue-SHELL", timeout="2000")
def test_login_logout(): """ actually runs the login and log out tests """ client = logged_in_client()
def test_zookeeper(): """ launches the default view for zookeeper """ client = logged_in_client() client.click(id="ccs-zookeeper-menu") client.waits.forElement(classname="CCS-zookeeper", timeout="2000")
def test_zookeeper(): """ launches the default view for zookeeper """ client = logged_in_client() client.click(id='ccs-zookeeper-menu') client.waits.forElement(classname='CCS-zookeeper', timeout='2000')
def test_shell(): """ launches the default view for shell """ client = logged_in_client() client.click(id='hue-shell-menu') client.waits.forElement(classname='Hue-SHELL', timeout='2000')