Exemplo n.º 1
0
def test_hidewhenCreated():
    client = WindmillTestClient(__name__)

    client.click(link=u'Contents')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(
        xpath=u"//a[contains(@href, 'testform/hidewhen1')]", timeout=u'8000')
Exemplo n.º 2
0
def test_logout():
    client = WindmillTestClient('logout')

    client.open(url='/admin/logout')
    client.waits.forPageLoad(timeout='8000')
    client.asserts.assertNode(xpath="//table[@id='login-table']/tbody/tr[1]/th[1]/label")
    client.asserts.assertNode(link='Forget your password?')   
Exemplo n.º 3
0
def setup_module(module):
    "Add items. Also test suggestion box."
    client = WindmillTestClient(__name__)

    def enter_item_text(text, ctrl=False):
        if ctrl:
            options = u'13,false,true,false,false,false'
        else:
            options = u'13,false,false,false,false,false'
        client.waits.forElement(xpath=u"//input[@class='additem']",
                                timeout=u'20000')
        client.type(xpath=u"//input[@class='additem']", text=text)
        client.keyUp(xpath=u"//input[@class='additem']", options=options)
        if not ctrl:
            client.waits.forNotElement(xpath=u"//input[@class='additem']",
                                       timeout=u'20000')

    client.asserts.assertNotNode(xpath=u"//input[@class='additem']")

    # 1st item to test list 1 (from list's additem button)
    client.asserts.assertNotNode(id=u'item_1')
    client.click(id=u'additem_list_1')
    enter_item_text('test item 1')
    client.waits.forElement(id=u"item_1", timeout=u'20000')

    # 2nd item to test list 1 (from item1's additem button)
    client.asserts.assertNotNode(id=u'item_2')
    client.click(xpath=u"//li[@id='item_1']/a[@title='Add item']")
    enter_item_text('test item 2')
    client.waits.forElement(id=u"item_2", timeout=u'20000')

    # 3rd item to test list 1 (from item1's additem button with ctrl)
    client.asserts.assertNotNode(id=u'item_3')
    client.click(xpath=u"//li[@id='item_1']/a[@title='Add item']")
    enter_item_text('test item 3', ctrl=True)
    client.waits.forElement(id=u"item_3", timeout=u'20000')

    # 4th item to test list 1 (with residual additem field from last one)
    client.asserts.assertNotNode(id=u'item_4')
    enter_item_text('test item 4')
    client.waits.forElement(id=u"item_4", timeout=u'20000')

    # 5th item to test list 2
    client.asserts.assertNotNode(id=u'item_5')
    client.click(id=u'additem_list_2')
    client.waits.sleep(milliseconds=u'50')
    client.asserts.assertJS(js=u"$('#suggestion_box').is(':hidden')")
    enter_item_text('test item 5')
    client.waits.forElement(id=u"item_5", timeout=u'20000')

    client.asserts.assertJS(
        js=u"$('#subscription_1 .item:nth(0)').attr('id') == 'item_1'")
    client.asserts.assertJS(
        js=u"$('#subscription_1 .item:nth(1)').attr('id') == 'item_4'")
    client.asserts.assertJS(
        js=u"$('#subscription_1 .item:nth(2)').attr('id') == 'item_3'")
    client.asserts.assertJS(
        js=u"$('#subscription_1 .item:nth(3)').attr('id') == 'item_2'")
    client.asserts.assertJS(
        js=u"$('#subscription_2 .item:nth(0)').attr('id') == 'item_5'")
Exemplo n.º 4
0
def test_ide_asserts():
    client = WindmillTestClient(__name__, assertions=False)

    assert client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html')['result']
    assert client.waits.forPageLoad(timeout=u'8000')['result']
    assert client.asserts.assertImageLoaded(id=u'headerImg')['result']
    assert client.asserts.assertNotImageLoaded(id=u'imgNotLoaded')['result']
    assert not client.asserts.assertImageLoaded(id=u'imgNotLoaded')['result']
    assert not client.asserts.assertNotImageLoaded(id=u'headerImg')['result']
    assert client.asserts.assertElemJS(js=u'element.name == "animal"', id=u'cougar')['result']
    assert client.asserts.assertProperty(validator=u'style.width|200px', id=u'clickme')['result']
    assert client.asserts.assertText(validator=u'Stuff in here', id=u'stuffInside')['result']
    assert client.asserts.assertTextIn(validator=u'Stuff', id=u'stuffInside')['result']
    assert not client.asserts.assertText(validator=u'crap', id=u'stuffInside')['result']
    assert client.asserts.assertValue(validator=u'assert this value', id=u'assertVal')['result']
    assert client.asserts.assertValueIn(validator=u'this', id=u'assertVal')['result']
    assert client.asserts.assertNotValue(validator=u'asd', id=u'assertVal')['result']
    assert client.asserts.assertNotValueIn(validator=u'asd', id=u'assertVal')['result']
    assert not client.asserts.assertValue(validator=u'wrong assert', id=u'assertVal')['result']
    assert client.asserts.assertNotValue(validator=u'aasdasd', id=u'assertVal')['result']
    assert client.asserts.assertChecked(id=u'boxchecked')['result']
    assert not client.asserts.assertChecked(id=u'boxnotchecked')['result']
    assert client.asserts.assertNotChecked(id=u'boxnotchecked')['result']
    assert not client.asserts.assertNotChecked(id=u'boxchecked')['result']
    assert client.asserts.assertSelected(validator=u'Rock', id=u'assertSelected')['result']
    assert not client.asserts.assertSelected(validator=u'boom', id=u'assertSelected')['result']
Exemplo n.º 5
0
def test_frontend_enabled():
    client = WindmillTestClient('frontend_enabled')

    client.open(url='/admin/logout')
    client.waits.forPageLoad(timeout='8000')
    client.asserts.assertNode(
        xpath="//table[@id='login-table']/tbody/tr[1]/th[1]/label")
Exemplo n.º 6
0
def test_post_submit():
    client = WindmillTestClient(__name__)
    client.open(url='/windmill-unittests/static/frames.html')
    client.waits.forPageLoad(timeout=20000)
    client.click(link="Open page in bottom frame")
    client.asserts.assertText(validator='Success', id='result')
    client.asserts.assertText(validator='Should still be here', id='control')
Exemplo n.º 7
0
def test_foreign_open():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://www.asdf.com')
    client.waits.forPageLoad(timeout=u'2000')
    client.asserts.assertJS(js=u"windmill.testWin().document.title == 'asdf'")
    
Exemplo n.º 8
0
def test_cancel_add_item():
    client = WindmillTestClient(__name__)

    client.click(id=u'additem_list_1')
    client.asserts.assertNode(id=u'add_to_begin_of_list_1')
    client.click(xpath=u"//li[@id='subscription_1']/ul/li/a[@title='cancel']")
    client.waits.forNotElement(timeout=u'20000', id=u'add_to_begin_of_list_1')
Exemplo n.º 9
0
def test_fold():
    client = WindmillTestClient(__name__)
    signup(client)
    client.click(id=u'play-now-button')
    client.waits.forElement(classname=u'jpoker_table')
    for i in range(100):
        client.click(classname=u'jpoker_ptable_fold')
        client.waits.sleep(milliseconds=5000)
Exemplo n.º 10
0
def test_admin_home_page():
    client = WindmillTestClient('test_admin_home_page')

    client.open(url='/admin/')
    client.waits.forPageLoad(timeout='8000')
    client.asserts.assertText(
        xpath='/html/body/table/tbody/tr[1]/td[2]/div[2]/h1',
        validator='Admin Home')
Exemplo n.º 11
0
def test_601():
    client = WindmillTestClient(__name__)

    client.waits.forElement(timeout=u'30000', id=u'ext-gen96')
    client.click(id=u'ext-gen96')
    client.waits.forElement(timeout=u'30000', id=u'ext-gen167')
    client.check(xpath=u"//ul[@id='ext-gen167']/div/li[2]/div/input")
    client.check(xpath=u"//ul[@id='ext-gen167']/div/li[2]/div/input")
    client.asserts.assertText(validator=u'Communes', id=u'ext-comp-1090')
Exemplo n.º 12
0
def test_drag_list():
    client = WindmillTestClient(__name__)

    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(0)').attr('id') == 'subscription_1'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(1)').attr('id') == 'subscription_2'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(2)').attr('id') == 'subscription_3'")

    client.dragDropElemToElem(optid=u'subscription_1', id=u'subscription_2')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(0)').attr('id') == 'subscription_2'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(1)').attr('id') == 'subscription_1'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(2)').attr('id') == 'subscription_3'")

    client.dragDropElemToElem(optid=u'subscription_2', id=u'subscription_3')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(0)').attr('id') == 'subscription_3'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(1)').attr('id') == 'subscription_2'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(2)').attr('id') == 'subscription_1'")

    client.dragDropElemToElem(optxpath=u"//li[@id='subscription_1']/ul", id=u'subscription_3')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(0)').attr('id') == 'subscription_2'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(1)').attr('id') == 'subscription_1'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(2)').attr('id') == 'subscription_3'")

    client.dragDropElemToElem(optxpath=u"//li[@id='subscription_1']/ul", id=u'subscription_2')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(0)').attr('id') == 'subscription_1'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(1)').attr('id') == 'subscription_2'")
    client.asserts.assertJS(js=u"$('#listlist > .subscription:nth(2)').attr('id') == 'subscription_3'")
Exemplo n.º 13
0
	def __init__(self,url):
		client = WindmillTestClient(__name__)
		client.open(url=url)
		client.waits.sleep(milliseconds=u'5000')
		time.sleep(5)
		client.waits.forElement(id="id-handle",timeout="5000")
		self.soup = BeautifulSoup.BeautifulSoup(client.commands.getPageText()['result'])

		#username
		self.username = self.soup.find("div",{"id":"id-handle"}).string
		print self.username
Exemplo n.º 14
0
class TestViewsWithWindmill(TestCase):
    def setUp(self):
        app.testing = True
        self.client = WindmillTestClient(__name__)
        self._ctx = app.test_request_context()
        self._ctx.push()

    def tearDown(self):
        self._ctx.pop()

    def test_index(self):
        self.client.open()
Exemplo n.º 15
0
def test_tourney_join_fold():
    client = WindmillTestClient(__name__)
    username = functest.registry.get('username')
    password = functest.registry.get('password', username)
    login(client, username, password)
    #client.click(classname=u'close')
    client.waits.forElement(jquery=u'(".notify-text a")[0]')
    client.click(jquery=u'(".notify-text a")[0]')
    client.waits.forElement(classname=u'jpoker_table')
    for i in range(100):
        client.click(classname=u'jpoker_ptable_fold')
        client.waits.sleep(milliseconds=5000)
Exemplo n.º 16
0
class TestViewsWithWindmill(TestCase):

    def setUp(self):
        app.testing = True
        self.client = WindmillTestClient(__name__)
        self._ctx = app.test_request_context()
        self._ctx.push()

    def tearDown(self):
        self._ctx.pop()

    def test_index(self):
        self.client.open()
Exemplo n.º 17
0
def test_scrape_iotd_gallery():
    client = WindmillTestClient(__name__)
    # init URL
    next_url = "http://www.joao-viegas.com/Eventos-e-Reportagens/CRISMAS-2013/i-TbNRhxj"
    while True:
        print "next page: " + str(next_url)
        client.open(url=next_url)
        # Wait for loading
        client.waits.forElement(xpath=u"//ul[@class='sm-tiles-list']", timeout=60000)
        next_url = get_image_info(client)
        if next_url == "" or next_url == "#" or next_url is None:
            break
    print "DONE!!!"
Exemplo n.º 18
0
def test_login():
    """Some parameters must be modified (user, password, Plone URL).
    """
    client = WindmillTestClient(__name__)

    client.click(link=u'View your Plone site.')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'__ac_name')
    client.type(
        text=u'admin',
        id=u'__ac_name')  # To replace with the corrects username and password
    client.type(text=u'password', id=u'__ac_password')
    client.click(name=u'submit')
    client.waits.forPageLoad(timeout=u'20000')
Exemplo n.º 19
0
def test_scrape_iotd_gallery():
    client = WindmillTestClient(__name__)
    #init URL
    next_url = "http://www.joao-viegas.com/Eventos-e-Reportagens/CRISMAS-2013/i-TbNRhxj"
    while True:
        print "next page: " + str(next_url)
        client.open(url=next_url)
        #Wait for loading
        client.waits.forElement(xpath=u"//ul[@class='sm-tiles-list']",
                                timeout=60000)
        next_url = get_image_info(client)
        if next_url == '' or next_url == '#' or next_url is None:
            break
    print "DONE!!!"
Exemplo n.º 20
0
def test_minimize_list():
    client = WindmillTestClient(__name__)

    client.asserts.assertJS(js=u"$('#subscription_1 > .itemlist').is(':visible')")
    client.asserts.assertJS(js=u"$('#itemcount_subscription_1').is(':hidden')")
    client.click(id=u'minmax_subscription_1')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#subscription_1 > .itemlist').is(':hidden')")
    client.asserts.assertJS(js=u"$('#itemcount_subscription_1').is(':visible')")
    client.asserts.assertJS(js=u'$(\'#itemcount_subscription_1 > .count\').html() == "0"')
    client.click(id=u'minmax_subscription_1')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(js=u"$('#subscription_1 > .itemlist').is(':visible')")
    client.asserts.assertJS(js=u"$('#itemcount_subscription_1').is(':hidden')")
Exemplo n.º 21
0
def test_get_submit():
    client = WindmillTestClient(__name__)
    client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/domain_switcher.html')
    client.type(text=u'simpletest', name=u'q')
    client.click(name=u'btnG')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(link=u'SimpleTest - Unit Testing for PHP', timeout=u'8000')
Exemplo n.º 22
0
def test_post_submit():
    client = WindmillTestClient(__name__)
    client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/domain_switcher.html')
    client.type(text=u'simpletest', name=u'search_theme_form')
    client.click(name=u'op')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='squeeze']/h1", timeout=8000)
    client.asserts.assertJS(js=u"windmill.testWin().document.title == 'Search | drupal.org'")
Exemplo n.º 23
0
def test_register():
    client = WindmillTestClient(__name__)
    username = functest.registry.get('username')
    password = functest.registry.get('password', username)
    login(client, username, password)
    client.click(xpath=u"//li[@id='lobby_regular']/a")
    client.waits.forElement(classname=u'jpoker_tourney_state_registering')
    client.click(classname=u'jpoker_tourney_state_registering')
    client.waits.sleep(milliseconds=u'1000')
    client.click(id=u"lobby_join_table")
    client.waits.forElement(value=u'Register')
    client.click(value=u'Register')
Exemplo n.º 24
0
def test_login():
    """Some parameters must be modified (user, password, Plone URL).
    """
    client = WindmillTestClient(__name__)

    client.click(link=u'View your Plone site.')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'__ac_name')
    client.type(text=u'admin', id=u'__ac_name') # To replace with the corrects username and password
    client.type(text=u'password', id=u'__ac_password')
    client.click(name=u'submit')
    client.waits.forPageLoad(timeout=u'20000')
Exemplo n.º 25
0
def setup_module(module):
    "Add items. Also test suggestion box."
    client = WindmillTestClient(__name__)

    def enter_item_text(text, ctrl=False):
        if ctrl:
            options = u'13,false,true,false,false,false'
        else:
            options = u'13,false,false,false,false,false'
        client.waits.forElement(xpath=u"//input[@class='additem']", timeout=u'20000')
        client.type(xpath=u"//input[@class='additem']", text=text)
        client.keyUp(xpath=u"//input[@class='additem']", options=options)
        if not ctrl:
            client.waits.forNotElement(xpath=u"//input[@class='additem']", timeout=u'20000')

    client.asserts.assertNotNode(xpath=u"//input[@class='additem']")

    # 1st item to test list 1 (from list's additem button)
    client.asserts.assertNotNode(id=u'item_1')
    client.click(id=u'additem_list_1')
    enter_item_text('test item 1')
    client.waits.forElement(id=u"item_1", timeout=u'20000')

    # 2nd item to test list 1 (from item1's additem button)
    client.asserts.assertNotNode(id=u'item_2')
    client.click(xpath=u"//li[@id='item_1']/a[@title='Add item']")
    enter_item_text('test item 2')
    client.waits.forElement(id=u"item_2", timeout=u'20000')

    # 3rd item to test list 1 (from item1's additem button with ctrl)
    client.asserts.assertNotNode(id=u'item_3')
    client.click(xpath=u"//li[@id='item_1']/a[@title='Add item']")
    enter_item_text('test item 3', ctrl=True)
    client.waits.forElement(id=u"item_3", timeout=u'20000')

    # 4th item to test list 1 (with residual additem field from last one)
    client.asserts.assertNotNode(id=u'item_4')
    enter_item_text('test item 4')
    client.waits.forElement(id=u"item_4", timeout=u'20000')

    # 5th item to test list 2
    client.asserts.assertNotNode(id=u'item_5')
    client.click(id=u'additem_list_2')
    client.waits.sleep(milliseconds=u'50')
    client.asserts.assertJS(js=u"$('#suggestion_box').is(':hidden')")
    enter_item_text('test item 5')
    client.waits.forElement(id=u"item_5", timeout=u'20000')

    client.asserts.assertJS(js=u"$('#subscription_1 .item:nth(0)').attr('id') == 'item_1'")
    client.asserts.assertJS(js=u"$('#subscription_1 .item:nth(1)').attr('id') == 'item_4'")
    client.asserts.assertJS(js=u"$('#subscription_1 .item:nth(2)').attr('id') == 'item_3'")
    client.asserts.assertJS(js=u"$('#subscription_1 .item:nth(3)').attr('id') == 'item_2'")
    client.asserts.assertJS(js=u"$('#subscription_2 .item:nth(0)').attr('id') == 'item_5'")
Exemplo n.º 26
0
def setup_module(module):
    client = WindmillTestClient(__name__)

    client.open(url=u'http://zc.qq.com/')
    client.waits.forPageLoad(timeout=10)
    client.waits.forElement(xpath=u"//img[@id='code_img']", timeout=10)

    client.click(xpath=u"//input[@id='nick']")
    client.type(xpath=u"//input[@id='nick']", text=u'pylon2888')
    client.click(xpath=u"//input[@id='password']")
    client.type(xpath=u"//input[@id='password']", text=u'123456qq')
    client.click(xpath=u"//input[@id='password_again']")
    client.type(xpath=u"//input[@id='password_again']", text=u'123456qq')
    client.click(xpath=u"//a[@id='sex_1']")

    client.click(xpath=u"//a[@id='birthday_type_value']")
    client.click(xpath=u"//li[@id='birthday_0']")

    client.click(xpath=u"//input[@id='year_value']")
    #year_0 ~99
    #client.click(xpath=u"//li[@id='birthday_0']")

    client.click(xpath=u"//input[@id='month_value']")
    #month_0 ~11(1-12)
    #client.click(xpath=u"//li[@id='birthday_0']")

    client.click(xpath=u"//input[@id='day_value']")
    #day_0 ~30 (1-31)
    #client.click(xpath=u"//li[@id='birthday_0']")

    #code = get_code_info(client)
    code = 'aaaa'
    client.click(xpath=u"//input[@id='code']")
    client.type(xpath=u"//input[@id='code']", text=code)
    client.click(xpath=u"//input[@id='submit']")
Exemplo n.º 27
0
def test_unsubscribe():
    client = WindmillTestClient(__name__)

    client.click(id=u"lists_button")  # show list menu
    client.waits.sleep(milliseconds=u'500')

    #unsubscribe
    client.asserts.assertNode(id=u"subscription_2")
    client.asserts.assertNode(id=u"unsubscribe_list_2")
    client.click(id=u"unsubscribe_list_2")
    client.waits.forNotElement(id=u"subscription_2", timeout=u'20000')

    #subscribe
    client.waits.forElement(id=u"subscribe_list_2", timeout=u'20000')
    client.click(id=u"subscribe_list_2")
    client.waits.forElement(id=u"subscription_2", timeout=u'20000')
    client.click(id=u"lists_button")  # hide list menu
Exemplo n.º 28
0
def test_recordingSuite0():
    '''windmill >> '/requests/' requests page test
    '''
    client = WindmillTestClient(__name__)

    client.waits.sleep(milliseconds=2000)
    client.click(link=u'requests')
    client.waits.forPageLoad(timeout=u'20000')

    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[1]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[2]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[3]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[4]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[5]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[6]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[7]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[8]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[9]",
                                validator=u'127.0.0.1')
    client.asserts.assertTextIn(xpath=u"//div[@id='content']/p[10]",
                                validator=u'127.0.0.1')
    client.click(link=u'main page')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'requests', timeout=u'8000')
    client.click(link=u'requests')
    client.waits.forPageLoad(timeout=u'20000')
Exemplo n.º 29
0
def test_ViewsWithoutLogin():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://127.0.0.1:8000/admin/logout/')
    client.waits.forPageLoad(timeout=u'8000')
    client.open(url=u'http://127.0.0.1:8000/pki/download/ca/1/')
    client.waits.forPageLoad(timeout=u'8000')
    client.asserts.assertNode(xpath=u"//form[@id='login-form']/div[4]")
    client.open(url=u'http://127.0.0.1:8000/pki/download/cert/1/')
    client.waits.forPageLoad(timeout=u'8000')
    client.asserts.assertNode(xpath=u"//form[@id='login-form']/div[4]")
Exemplo n.º 30
0
def test_recordingSuite0():
    client = WindmillTestClient(__name__, assertions=False)

    assert client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html')['result']
    assert client.waits.forPageLoad(timeout=u'8000')['result']
    assert client.click(value=u'lookupByValue')['result']
    assert client.click(classname=u'lookupByClassname')['result']
    assert client.click(name=u'lookupByName')['result']
    assert client.click(id=u'lookupById')['result']
    assert client.click(jsid=u'jsNode()')['result']
    assert client.click(tagname=u'hr')['result']
Exemplo n.º 31
0
def setup_module(module):
    client = WindmillTestClient(__name__)

    #client.open(url='http://www.qq.com/')
    client.open(url='http://zc.qq.com/')
    client.waits.forPageLoad()

    client.click(xpath="//a[@href='http://zc.qq.com/']")

    client.waits.forElement(xpath="//form[@method='post']", timeout=5)

    client.type(text='', xpath="//input[@id='nick']")

    print 'before click'
    clickResult = client.click(xpath=u"//a[@class='button'][name(..)='div']")
    print 'type(clickResult): ', type(clickResult)
Exemplo n.º 32
0
def test_ide_asserts():
    client = WindmillTestClient(__name__, assertions=False)

    assert client.open(
        url=
        u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html'
    )['result']
    assert client.waits.forPageLoad(timeout=u'8000')['result']
    assert client.asserts.assertImageLoaded(id=u'headerImg')['result']
    assert client.asserts.assertNotImageLoaded(id=u'imgNotLoaded')['result']
    assert not client.asserts.assertImageLoaded(id=u'imgNotLoaded')['result']
    assert not client.asserts.assertNotImageLoaded(id=u'headerImg')['result']
    assert client.asserts.assertElemJS(js=u'element.name == "animal"',
                                       id=u'cougar')['result']
    assert client.asserts.assertProperty(validator=u'style.width|200px',
                                         id=u'clickme')['result']
    assert client.asserts.assertText(validator=u'Stuff in here',
                                     id=u'stuffInside')['result']
    assert client.asserts.assertTextIn(validator=u'Stuff',
                                       id=u'stuffInside')['result']
    assert not client.asserts.assertText(validator=u'crap',
                                         id=u'stuffInside')['result']
    assert client.asserts.assertValue(validator=u'assert this value',
                                      id=u'assertVal')['result']
    assert client.asserts.assertValueIn(validator=u'this',
                                        id=u'assertVal')['result']
    assert client.asserts.assertNotValue(validator=u'asd',
                                         id=u'assertVal')['result']
    assert client.asserts.assertNotValueIn(validator=u'asd',
                                           id=u'assertVal')['result']
    assert not client.asserts.assertValue(validator=u'wrong assert',
                                          id=u'assertVal')['result']
    assert client.asserts.assertNotValue(validator=u'aasdasd',
                                         id=u'assertVal')['result']
    assert client.asserts.assertChecked(id=u'boxchecked')['result']
    assert not client.asserts.assertChecked(id=u'boxnotchecked')['result']
    assert client.asserts.assertNotChecked(id=u'boxnotchecked')['result']
    assert not client.asserts.assertNotChecked(id=u'boxchecked')['result']
    assert client.asserts.assertSelected(validator=u'Rock',
                                         id=u'assertSelected')['result']
    assert not client.asserts.assertSelected(validator=u'boom',
                                             id=u'assertSelected')['result']
Exemplo n.º 33
0
def test_scrape_iotd_gallery():
    """
    Scrape NASA Image of the Day Gallery
    """
    print "begin test"
    # Extra data massage for BeautifulSoup
    my_massage = get_massage()

    # Open main gallery page
    client = WindmillTestClient(__name__)
    client.open(url='http://www.nasa.gov/multimedia/imagegallery/iotd.html')

    # Page isn't completely loaded until image gallery data
    # has been updated by javascript code
    client.waits.forElement(xpath=u"//div[@id='gallery_image_area']/img",timeout=30000)

    # Scrape all images information
    images_info = []
    counter = 0
    while True:
        counter += 1
        if counter >= 8:
            break
        imageThis = get_image_info(client, my_massage)

        # Break if image has been already scrapped
        # (that means that all images have been parsed
        # since they are ordered in a circular ring)
        if (len(images_info) > 0) and (imageThis['link'] == images_info[-1]['link']):
            break

        images_info.append(imageThis)

        # Click to get the information for the next image
        client.click(xpath=u"//div[@class='btn_image_next']")

    # Print results to stdout ordered by image name
    for image in images_info:
        #print str(image)
        print "name: ", image['name']
        print "link: ", image['link']
        print "\r\n\r\n"
Exemplo n.º 34
0
def test_unsubscribe():
    client = WindmillTestClient(__name__)

    client.click(id=u"lists_button") # show list menu
    client.waits.sleep(milliseconds=u'500')

    #unsubscribe
    client.asserts.assertNode(id=u"subscription_2")
    client.asserts.assertNode(id=u"unsubscribe_list_2")
    client.click(id=u"unsubscribe_list_2")
    client.waits.forNotElement(id=u"subscription_2", timeout=u'20000')

    #subscribe
    client.waits.forElement(id=u"subscribe_list_2", timeout=u'20000')
    client.click(id=u"subscribe_list_2")
    client.waits.forElement(id=u"subscription_2", timeout=u'20000')
    client.click(id=u"lists_button") # hide list menu
Exemplo n.º 35
0
def test_post_submit():
    client = WindmillTestClient(__name__)
    client.open(url='/windmill-unittests/static/frames.html')
    client.waits.forPageLoad(timeout=20000)
    client.click(link="Open page in bottom frame")
    client.asserts.assertText(validator='Success', id='result')
    client.asserts.assertText(validator='Should still be here', id='control')
Exemplo n.º 36
0
def test_cancel_add_item():
    client = WindmillTestClient(__name__)

    client.click(id=u'additem_list_1')
    client.asserts.assertNode(id=u'add_to_begin_of_list_1')
    client.click(xpath=u"//li[@id='subscription_1']/ul/li/a[@title='cancel']")
    client.waits.forNotElement(timeout=u'20000', id=u'add_to_begin_of_list_1')
Exemplo n.º 37
0
def test_recordingSuite0():
    client = WindmillTestClient(__name__, assertions=False)

    assert client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html')['result']
    assert client.waits.forPageLoad(timeout=u'8000')['result']
    assert client.click(value=u'lookupByValue')['result']
    assert client.click(classname=u'lookupByClassname')['result']
    assert client.click(name=u'lookupByName')['result']
    assert client.click(id=u'lookupById')['result']
    assert client.click(jsid=u'jsNode()')['result']
    assert client.click(tagname=u'hr')['result']
class CenarioVisitanteSeInscreve(Cenario):

    @DadoQue('Estou na paǵina de inscrições')
    def abrir_pagina_principal(self):
        self.navegador = WindmillTestClient(__name__)
        self.navegador.open(url='/inscricoes/')

    @Quando("eu clico em 'Quero me inscrever'")
    def clicar_em_quero_me_inscrever(self):
        self.navegador.click(id='inscrever')

    @Quando("eu entro com todos os meus dados")
    def entrar_dados(self):
        pass

    @Quando("eu clico em 'Salvar'")
    def clicar_em_salvar(self):
        pass

    @Entao("a mensagem 'Participante inserido com sucesso' deverá aparecer")
    def mensagem_sucesso(self):
        pass
def test_ViewsWithoutLogin():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://127.0.0.1:8000/admin/logout/')
    client.waits.forPageLoad(timeout=u'8000')
    client.open(url=u'http://127.0.0.1:8000/pki/download/ca/1/')
    client.waits.forPageLoad(timeout=u'8000')
    client.asserts.assertNode(xpath=u"//form[@id='login-form']/div[4]")
    client.open(url=u'http://127.0.0.1:8000/pki/download/cert/1/')
    client.waits.forPageLoad(timeout=u'8000')
    client.asserts.assertNode(xpath=u"//form[@id='login-form']/div[4]")
Exemplo n.º 40
0
def test_tags_page():
    client = WindmillTestClient('test_tags_page')

    client.open(url='/textui')
    client.waits.forPageLoad(timeout='8000')
    client.click(link='Continue to the Tags Interface...')
    client.waits.forPageLoad(timeout='20000')
    client.asserts.assertNode(id='tags')
Exemplo n.º 41
0
def setup_module(module):
    client = WindmillTestClient('setup_module_login')

    client.type(text='test_admin', id='id_username')
    client.type(text='test_admin', id='id_password')
    client.click(value='Ok')
    client.waits.forPageLoad(timeout='20000')
    client.asserts.assertNode(link='Visual Map')
    client.asserts.assertNode(link='Textual')
Exemplo n.º 42
0
def test_601():
    client = WindmillTestClient(__name__)

    client.waits.forElement(timeout=u'30000', id=u'ext-gen96')
    client.click(id=u'ext-gen96')
    client.waits.forElement(timeout=u'30000', id=u'ext-gen167')
    client.check(xpath=u"//ul[@id='ext-gen167']/div/li[2]/div/input")
    client.check(xpath=u"//ul[@id='ext-gen167']/div/li[2]/div/input")
    client.asserts.assertText(validator=u'Communes', id=u'ext-comp-1090')
Exemplo n.º 43
0
38	def test_scrape_iotd_gallery():
39	    """
40	    Scrape NASA Image of the Day Gallery
41	    """
42	    # Extra data massage for BeautifulSoup
43	    my_massage = get_massage()
44	
45	    # Open main gallery page
46	    client = WindmillTestClient(__name__)
47	    client.open(url='https://www.surveymonkey.com/s/KLCBNM5')
48	
49	    # Page isn't completely loaded until image gallery data
50	    # has been updated by javascript code
51	    client.waits.forElement(xpath=u"//div[@id='gallery_image_area']/img",
52	                            timeout=30000)
53	
54	    # Scrape all images information
55	    images_info = {}
56	    while True:
57	        image_info = get_image_info(client, my_massage)
58	
59	        # Break if image has been already scrapped
60	        # (that means that all images have been parsed
61	        # since they are ordered in a circular ring)
62	        if image_info['link'] in images_info:
63	            break
64	
65	        images_info[image_info['link']] = image_info
66	
67	        # Click to get the information for the next image
68	        client.click(xpath=u"//div[@class='btn_image_next']")
69	
70	    # Print results to stdout ordered by image name
71	    for image_info in sorted(images_info.values(),
72	                             key=lambda image_info: image_info['name']):
73	        print ("Name: %(name)sn"
Exemplo n.º 44
0
def setup_module(module):
    client = WindmillTestClient(__name__)
    
    #client.open(url='http://www.qq.com/')
    client.open(url='http://zc.qq.com/')
    client.waits.forPageLoad()

    client.click(xpath="//a[@href='http://zc.qq.com/']")
        
    client.waits.forElement(xpath="//form[@method='post']",timeout=5)

    client.type(text='', xpath="//input[@id='nick']")
    
    
    print 'before click'
    clickResult = client.click(xpath=u"//a[@class='button'][name(..)='div']")
    print 'type(clickResult): ', type(clickResult)
Exemplo n.º 45
0
    def __call__(self, result=None):
        self.windmill = WindmillTestClient(__name__)
        old_opener = self.windmill.open

        def opener(url, *args, **kwargs):
            if url.startswith('http'):
                return old_opener(url=url)

            if not url.startswith('/'):
                path = urlresolvers.reverse(url, args=args, kwargs=kwargs)
            else:
                path = url

            return old_opener(url=self.base_url + path)

        self.windmill.open = opener

        return super(TestCase, self).__call__(result=result)
Exemplo n.º 46
0
def test_scrape_iotd_gallery():
    """
    Scrape NASA Image of the Day Gallery
    """
    print "begin test"
    # Extra data massage for BeautifulSoup
    my_massage = get_massage()

    # Open main gallery page
    client = WindmillTestClient(__name__)
    client.open(url='http://www.nasa.gov/multimedia/imagegallery/iotd.html')

    # Page isn't completely loaded until image gallery data
    # has been updated by javascript code
    client.waits.forElement(xpath=u"//div[@id='gallery_image_area']/img",
                            timeout=30000)

    # Scrape all images information
    images_info = []
    counter = 0
    while True:
        counter += 1
        if counter >= 8:
            break
        imageThis = get_image_info(client, my_massage)

        # Break if image has been already scrapped
        # (that means that all images have been parsed
        # since they are ordered in a circular ring)
        if (len(images_info) > 0) and (imageThis['link']
                                       == images_info[-1]['link']):
            break

        images_info.append(imageThis)

        # Click to get the information for the next image
        client.click(xpath=u"//div[@class='btn_image_next']")

    # Print results to stdout ordered by image name
    for image in images_info:
        #print str(image)
        print "name: ", image['name']
        print "link: ", image['link']
        print "\r\n\r\n"
Exemplo n.º 47
0
def test_minimize_list():
    client = WindmillTestClient(__name__)

    client.asserts.assertJS(
        js=u"$('#subscription_1 > .itemlist').is(':visible')")
    client.asserts.assertJS(js=u"$('#itemcount_subscription_1').is(':hidden')")
    client.click(id=u'minmax_subscription_1')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(
        js=u"$('#subscription_1 > .itemlist').is(':hidden')")
    client.asserts.assertJS(
        js=u"$('#itemcount_subscription_1').is(':visible')")
    client.asserts.assertJS(
        js=u'$(\'#itemcount_subscription_1 > .count\').html() == "0"')
    client.click(id=u'minmax_subscription_1')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertJS(
        js=u"$('#subscription_1 > .itemlist').is(':visible')")
    client.asserts.assertJS(js=u"$('#itemcount_subscription_1').is(':hidden')")
Exemplo n.º 48
0
def test_scrape_iotd_gallery():
    """
    Scrape NASA Image of the Day Gallery
    """
    # Extra data massage for BeautifulSoup
    my_massage = get_massage()

    # Open main gallery page
    client = WindmillTestClient(__name__)
    # client = WindmillTestClient
    client.open(url='http://www.nasa.gov/multimedia/imagegallery/iotd.html')

    # Page isn't completely loaded until image gallery data
    # has been updated by javascript code
    client.waits.forElement(xpath=u"//div[@id='gallery_image_area']/img",
                            timeout=30000)

    # Scrape all images information
    images_info = {}
    while True:
        image_info = get_image_info(client, my_massage)

        # Break if image has been already scrapped
        # (that means that all images have been parsed
        # since they are ordered in a circular ring)
        if image_info['link'] in images_info:
            break

    images_info[image_info['link']] = image_info

    # Click to get the information for the next image
    client.click(xpath=u"//div[@class='btn_image_next']")

    # Print results to stdout ordered by image name
    for image_info in sorted(images_info.values(),
                             key=lambda image_info: image_info['name']):
        print ("Name: %(name)sn"
               "Link: %(link)sn" % image_info)
Exemplo n.º 49
0
def test_manage_setting_of_price_calculator():
    client = WindmillTestClient(__name__)
    client.open(url="/product/chocolate")
    client.waits.forPageLoad(timeout=u'20000')

    # check that product includes vat
    client.asserts.assertText(xpath=u"//form[@id='product-form']/div[5][@class='prices']/div[2][@class='price-disclaimer']", validator=u'*inc. VAT')

    # open the manage interface
    client.open(url="/manage/")
    client.waits.forPageLoad(timeout=u'20000')
    client.type(text=u'admin', id=u'id_username')
    client.type(text=u'admin', id=u'id_password')
    client.click(xpath=u"//div[@id='content']/div/div[1]/form/button")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'Products', timeout=u'8000')
    client.click(link=u'Products')
    client.waits.forPageLoad(timeout=u'20000')
    client.click(link="Chocolate")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_price_calculator')
    client.click(id=u'id_price_calculator')
    client.select(option=u'Price excludes tax', id=u'id_price_calculator')
    client.click(xpath=u"//form[@id='product-data-form']/fieldset[4]/div[4]/div[2]")
    client.click(value=u'Save Data')

    # Check that price excludes vat now
    client.open(url="/product/chocolate")
    client.waits.forPageLoad(timeout=u'20000')

    # check that product includes vat
    client.asserts.assertText(xpath=u"//form[@id='product-form']/div[5][@class='prices']/div[2][@class='price-disclaimer']", validator=u'*exc. VAT')
Exemplo n.º 50
0
def test_edit_list_name():
    client = WindmillTestClient(__name__)

    client.asserts.assertNode(id=u'item_1_text')
    client.asserts.assertText(validator=u'test item 1', id=u'item_1_text')
    client.click(id=u'item_1_text')
    client.type(text=u'pim pom', name=u'text')
    client.keyPress(options=u'13,false,false,false,false,false', name=u'text')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertText(validator=u'pim pom', id=u'item_1_text')
    client.click(id=u'item_1_text')
    client.type(text=u'test item 1', name=u'text')
    client.keyPress(options=u'13,false,false,false,false,false', name=u'text')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertText(validator=u'test item 1', id=u'item_1_text')
Exemplo n.º 51
0
def test_wmunti1():
    client = WindmillTestClient(__name__, assertions=False)

    assert client.open(
        url=
        u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html'
    )['result']
    assert client.click(id=u'subBtn')['result']

    # Tests that sleeps actually wait for long enough
    start = datetime.now()
    assert client.waits.sleep(milliseconds=u'3000')['result']
    end = datetime.now()
    print(end - start)
    assert (end - start).seconds >= 3
    assert client.asserts.assertText(validator=u'', id=u'sleeper')['result']

    # Tests that an 8 second sleep actually waits long enough
    start = datetime.now()
    assert client.waits.sleep(milliseconds=u'8000')['result']
    end = datetime.now()
    print(end - start)
    assert (end - start).seconds >= 8

    #execIDEJS and storeURL test
    assert client.storeURL(link='AwesomeLink')
    assert client.execIDEJS(
        js=
        'windmill.varRegistry.items["{$AwesomeLink}"] = windmill.varRegistry.items["{$AwesomeLink}"].replace(\'http\', \'abcd\');'
    )
    assert client.asserts.assertJS(
        js="'{$AwesomeLink}' == 'abcd://www.awesome.com/';")
    #unit tests for select by value
    assert client.select(val='d', id='flavor')['result']
    assert client.asserts.assertSelected(validator='d', id='flavor')['result']

    assert client.asserts.assertText(validator=u'Slept',
                                     id=u'sleeper')['result']
    assert client.type(text=u'my test text', id=u'junkfield')['result']
    assert client.asserts.assertValue(validator=u'my test text',
                                      id=u'junkfield')['result']
    assert client.radio(id=u'cougar')['result']
    assert client.asserts.assertChecked(id=u'cougar')['result']
    assert client.radio(id=u'duck')['result']
    assert client.asserts.assertChecked(id=u'duck')['result']
    assert client.check(id=u'Smallpox')['result']
    assert client.asserts.assertChecked(id=u'Smallpox')['result']
    assert not client.asserts.assertChecked(id=u'Mumps')['result']
    assert not client.asserts.assertChecked(id=u'Dizziness')['result']
    assert client.check(id=u'Mumps')['result']
    assert client.asserts.assertChecked(id=u'Mumps')['result']
    assert not client.asserts.assertChecked(id=u'Dizziness')['result']
    assert client.check(id=u'Dizziness')['result']
    assert client.asserts.assertChecked(id=u'Dizziness')['result']
    assert client.type(text=u'The text area tester', name=u'story')['result']
    assert client.asserts.assertValue(validator=u'The text area tester',
                                      id=u'story')['result']
    assert client.select(option=u'Strawberry', id=u'flavor')['result']
    assert client.asserts.assertSelected(validator=u'b',
                                         id=u'flavor')['result']
    assert client.select(option=u'Rum and Raisin', id=u'flavor')['result']
    assert client.asserts.assertSelected(validator=u'c',
                                         id=u'flavor')['result']
    assert not client.asserts.assertSelected(validator=u'd',
                                             id=u'flavor')['result']
    assert client.select(option=u'Peach and Orange', id=u'flavor')['result']
    assert client.asserts.assertSelected(validator=u'd',
                                         id=u'flavor')['result']
    assert client.click(id=u'clickme')['result']
    assert client.asserts.assertText(validator=u'Clicked',
                                     id=u'clickme')['result']
    assert client.doubleClick(id=u'dblclickme')['result']
    assert client.asserts.assertText(validator=u'Double Clicked',
                                     id=u'dblclickme')['result']
    assert client.mouseDown(id=u'mousedownme')['result']
    assert client.asserts.assertText(validator=u'mouse downed',
                                     id=u'mousedownme')['result']
    assert client.mouseUp(id=u'mouseupme')['result']
    assert client.mouseOver(id=u'mouseoverme')['result']
    assert client.asserts.assertText(validator=u'mouse overred',
                                     id=u'mouseoverme')['result']
    assert client.mouseOut(id=u'mouseoverme')['result']
    assert client.asserts.assertText(validator=u'mouseouted',
                                     id=u'mouseoverme')['result']
    assert client.asserts.assertText(validator=u'mouse upped',
                                     id=u'mouseupme')['result']
    assert client.asserts.assertNode(id=u'amIhere')['result']
    assert client.asserts.assertProperty(validator=u'style.height|50px',
                                         id=u'amIhere')['result']
    assert not client.asserts.assertNode(id=u'doesntExist')['result']
    assert not client.asserts.assertNode(id=u'created')['result']
    assert client.click(id=u'wfeBtn')['result']
    assert client.waits.forElement(id=u'created', timeout=u'40000')['result']
    assert client.asserts.assertNode(id=u'created')['result']
    assert client.asserts.assertJS(
        js=u'window.document.title == "windmill_js_unit"')
    assert client.asserts.assertIDEJS(
        js=u'window.document.title == "Windmill IDE"')
    assert client.execJS(js=u'window.awesome = true;')
    assert client.asserts.assertJS(js=u'window.awesome == true;')
    assert client.execIDEJS(js=u'window.awesome = false;')
    assert client.asserts.assertIDEJS(js=u'window.awesome == false;')
Exemplo n.º 52
0
def test_edit_ajaxform():
    client = WindmillTestClient(__name__)

    client.click(link=u"Edit user's info")
    client.waits.forPageLoad(timeout=u'20000')
    client.type(text=AUTH_USERNAME, id='id_username')
    client.type(text=AUTH_PASSWORD, id=u'id_password')
    client.click(value=u'ok')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_last_name')
    client.click(id=u'id_last_name')
    client.type(text=u'', id=u'id_last_name')
    client.click(name=u'submit')
    client.asserts.assertTextIn(validator=u'Fix errors and submit again:',
                                id=u'form-output')
    client.asserts.assertTextIn(
                        validator=u'"last_name": This field is required.',
                        id=u'form-output')
    client.click(id=u'id_last_name')
    client.type(text=u'eeeeeeeeeee', id=u'id_last_name')
    client.click(name=u'submit')
    client.asserts.assertText(validator=u'Form saved.', id=u'form-output')
Exemplo n.º 53
0
def test_cart_prices():
    client = WindmillTestClient(__name__)
    client.open(url="/product/chocolate")
    client.waits.forPageLoad(timeout=u'20000')

    # check that product includes vat
    client.asserts.assertText(
        xpath=
        u"//form[@id='product-form']/div[5][@class='prices']/div[2][@class='price-disclaimer']",
        validator=u'*inc. VAT')

    client.waits.forElement(timeout=u'8000', name=u'add-to-cart')
    client.click(name=u'add-to-cart')
    client.waits.forPageLoad(timeout=u'20000')
    client.open(url="/product/apple")
    client.waits.forPageLoad(timeout=u'20000')

    # check that product excludes vat
    client.asserts.assertText(
        xpath=
        u"//form[@id='product-form']/div[5][@class='prices']/div[2][@class='price-disclaimer']",
        validator=u'*exc. VAT')

    client.waits.forElement(timeout=u'8000', name=u'add-to-cart')
    client.click(name=u'add-to-cart')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'Checkout', timeout=u'8000')
    client.click(link=u'Checkout')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'Checkout', timeout=u'8000')
    client.click(link=u'Checkout')
    client.waits.forPageLoad(timeout=u'20000')

    # check net price of chocolate
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[2]/td[4][@class='number']",
        validator=u'61,67 €')

    # check vat on chocolate
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[2]/td[5][@class='number']",
        validator=u'(8,33 €)')

    # check total on chocolate
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[2]/td[6][@class='number']",
        validator=u'70,00 €')

    # check net price of apple
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[3]/td[4][@class='number']",
        validator=u'80,00 €')

    # check vat on apple
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[3]/td[5][@class='number']",
        validator=u'(16,80 €)')

    # check total on apple
    client.asserts.assertText(
        xpath=
        u"//div[@id='cart-inline']/table[@class='lfs-default cart']/tbody/tr[3]/td[6][@class='number']",
        validator=u'96,80 €')
Exemplo n.º 54
0
def setup_module(module):
    client = WindmillTestClient(__name__)

    client.type(text=u'cms/tests/CMSMainTest.yml', id=u'fixture-file')
    client.click(id=u'start-session')

    client.waits.forPageLoad(timeout=u'20000')
    client.click(id=u'admin-link')
    client.waits.forPageLoad(timeout=u'20000')

    client.type(text=u'*****@*****.**', id=u'MemberLoginForm_LoginForm_Email')
    client.type(text=u'ZXXlkwecxz2390232233', id=u'MemberLoginForm_LoginForm_Password')
    client.click(id=u'MemberLoginForm_LoginForm_action_dologin')
    client.waits.forPageLoad(timeout=u'300000')
Exemplo n.º 55
0
def test_dragdropunit():
    client = WindmillTestClient(__name__)

    client.open(
        url=
        u'http://tutorial.getwindmill.com/windmill-unittests/jqueryui152/demos/functional/index.html'
    )
    client.waits.forPageLoad(timeout=u'40000')
    client.waits.forElement(link=u'Draggable', timeout=u'40000')
    #test the draggable widgets
    client.click(link=u'Draggable')
    client.dragDropElem(pixels=u'(200,0)', id=u'dragImage')
    client.waits.sleep(milliseconds=u'500')
    client.dragDropElem(pixels=u'(300,0)', id=u'divDrag')
    #client.asserts.assertProperty(validator=u'style.left|289px', id=u'divDrag')
    client.dragDropElem(xpath="//div[@id='draggable-handle-div']/div[1]",
                        pixels='(257,0)')
    #client.asserts.assertProperty(validator=u'style.left|246px', id=u'draggable-handle-div')
    client.dragDropElem(link=u'Drag me', pixels=u'(420,0)')
    #client.asserts.assertProperty(validator=u'style.left|409px', id=u'draggable-dragPrevention')
    #test the droppable widgets
    client.click(link=u'Droppable')
    client.click(link=u'Droppable')
    client.waits.sleep(milliseconds=u'500')
    client.dragDropElem(xpath="//div[@id='droppablePhotos']/ul/li[2]/img",
                        pixels='(310,0)')
    client.waits.sleep(milliseconds=u'1200')
    client.asserts.assertProperty(
        xpath="//div[@id='droppablePhotos']/div/img",
        validator='src|templates/images/P1010039.JPG')
    client.dragDropElemToElem(xpath="//div[@id='droppablePhotos']/ul/li/img",
                              optxpath="//div[@id='droppablePhotos']/div/img")
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertProperty(xpath="//div[@id='droppablePhotos']/div/img",
                                  validator='src|P1010020.JPG')
    client.dragDropElemToElem(xpath="//div[@id='ui-gen-7']/div[3]/div[1]",
                              optxpath="//div/div[3]/div[4]")
    client.waits.sleep(milliseconds=u'500')
    client.dragDropElemToElem(xpath="//div/div[3]/div[2]",
                              optxpath="//div/div[3]/div[4]")
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertElemJS(
        xpath="//div/div[3]/div[4]",
        js=u"element.innerHTML.indexOf('Dropped!') != -1")
    client.dragDropElem(xpath="//div/div[3]/div[2]", pixels='(0,200)')
    client.waits.sleep(milliseconds=u'500')
    client.asserts.assertElemJS(
        xpath="//div/div[3]/div[4]",
        js=u"element.innerHTML.indexOf('Dropped! Dropped!') != -1")
    #test the sortable widgets
    client.click(link=u'Sortable')
    client.click(link=u'Sortable')
    client.waits.sleep(milliseconds=u'500')
    client.storeVarFromJS(
        options=
        "before|document.getElementById('user_Susan').parentNode.childNodes.length"
    )
    client.dragDropElem(pixels='(160,0)', id='user_Susan')
    client.storeVarFromJS(
        options=
        "after|document.getElementById('user_Susan').parentNode.childNodes.length"
    )
    client.execIDEJS(
        js=
        "windmill.varRegistry.items['before'] != windmill.varRegistry.items['After'];"
    )
    #test the dialog widgets
    client.click(link=u'Dialog')
    client.click(link=u'Dialog')
    client.dragDropElem(
        xpath="//body[@id='functional_demos']/div[3]/div[1]/div[1]",
        pixels='(150,0)')
    #test the slider widgets
    client.click(link=u'Slider')
    client.click(link=u'Slider')
    client.waits.sleep(milliseconds=u'500')
    client.dragDropElem(xpath="//div[@id='slider3']/a/div", pixels='(80,0)')
    client.dragDropElem(xpath="//div[@id='slider1']/a[1]/div", pixels='(50,0)')
    client.waits.sleep(milliseconds=u'500')
    client.dragDropElem(xpath="//div[@id='slider1']/a[2]/div",
                        pixels='(-20,0)')
    client.click(link=u'Draggable')