Exemplo n.º 1
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.º 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 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.º 4
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.º 5
0
def test_AddRootCA():
    client = WindmillTestClient(__name__)

    client.open(url='http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout='8000')
    client.type(text='admin', id='id_username')
    client.type(text='admin', id='id_password')
    client.click(value='Log in')
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(xpath="//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a", timeout='8000')
    client.click(xpath="//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a")
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(timeout='8000', id='id_description')
    client.click(id='id_description')
    client.type(text='Windmill RootCA', id='id_description')
    client.click(id='id_common_name')
    client.type(text='Root CA', id='id_common_name')
    client.click(id='id_state')
    client.type(text='Bavaria', id='id_state')
    client.type(text='Munich', id='id_locality')
    client.click(id='id_organization')
    client.type(text='My Company', id='id_organization')
    client.click(id='id_email')
    client.type(text='*****@*****.**', id='id_email')
    client.click(id='id_valid_days')
    client.type(text='365', id='id_valid_days')
    client.click(id='id_passphrase')
    client.type(text='1234567890', id='id_passphrase')
    client.check(id='id_der_encoded')
    client.check(id='id_subcas_allowed')
    client.click(xpath="//form[@id='certificateauthority_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout='20000')
    client.asserts.assertTextIn(xpath="//div[@id='container']/ul/li", validator='The certificate authority "Root CA" was added successfully.')
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_recordingSuite1():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout=u'8000')
    client.waits.forElement(
        xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a",
        timeout=u'8000')
    client.click(
        xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_description')
    client.click(id=u'id_description')
    client.type(text=u'SubCA', id=u'id_description')
    client.type(text=u'SubCA', id=u'id_common_name')
    client.type(text=u'Bavaria', id=u'id_state')
    client.type(text=u'Munich', id=u'id_locality')
    client.type(text=u'My Company', id=u'id_organization')
    client.type(text=u'BackEnd', id=u'id_OU')
    client.type(text=u'*****@*****.**', id=u'id_email')
    client.type(text=u'122', id=u'id_valid_days')
    client.type(text=u'1234567890', id=u'id_passphrase')
    client.click(id=u'id_parent')
    client.select(option=u'', id=u'id_parent')
    client.click(value=u'1')
    client.click(id=u'id_parent_passphrase')
    client.type(text=u'1234567890', id=u'id_parent_passphrase')
    client.click(
        xpath=u"//form[@id='certificateauthority_form']/div[2]/div[2]/input[1]"
    )
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertTextIn(
        xpath=u"//div[@id='container']/ul/li",
        validator=u'The certificate authority "SubCA" was added successfully.')
Exemplo n.º 8
0
def test_recordingSuite1():
    client = WindmillTestClient(__name__)

    client.open(url='http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout='8000')
    client.waits.forElement(xpath="//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a", timeout='8000')
    client.click(xpath="//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a")
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(timeout='8000', id='id_description')
    client.click(id='id_description')
    client.type(text='SubCA', id='id_description')
    client.type(text='SubCA', id='id_common_name')
    client.type(text='Bavaria', id='id_state')
    client.type(text='Munich', id='id_locality')
    client.type(text='My Company', id='id_organization')
    client.type(text='BackEnd', id='id_OU')
    client.type(text='*****@*****.**', id='id_email')
    client.type(text='122', id='id_valid_days')
    client.type(text='1234567890', id='id_passphrase')
    client.click(id='id_parent')
    client.select(option='', id='id_parent')
    client.click(value='1')
    client.click(id='id_parent_passphrase')
    client.type(text='1234567890', id='id_parent_passphrase')
    client.click(xpath="//form[@id='certificateauthority_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout='20000')
    client.asserts.assertTextIn(xpath="//div[@id='container']/ul/li", validator='The certificate authority "SubCA" was added successfully.')
Exemplo n.º 9
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.º 10
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.º 11
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.º 12
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.º 13
0
def test_RecolteTotale():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://declaration.dev.vinsdalsace.fr/civa_dev.php/')
    client.waits.forPageLoad(timeout=u'8000')
    client.click(id=u'recoltant_cvi')
    client.type(text=u'6823700100', id=u'recoltant_cvi')
    client.click(name=u'boutons[valider]')
    client.waits.forPageLoad(timeout=u'8000')
    client.click(link=u'Ann\xe9es pr\xe9c\xe9dentes')
    client.click(
        xpath=
        u"//div[@id='precedentes_declarations']/div/ul/li[2]/ul/li/ul/li/a")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'R\xe9colte totale', timeout=u'8000')
    client.click(link=u'R\xe9colte totale')
    client.click(xpath=u"//div[@id='appelations']/table/tbody/tr[4]/td[1]")
    client.asserts.assertText(
        xpath=u"//div[@id='appelations']/table/thead/tr/th[2]/span",
        validator=u'AOC')
    client.open(url=u'http://declaration.dev.vinsdalsace.fr/civa_dev.php/')
    client.waits.forPageLoad(timeout=u'8000')
    client.click(name=u'boutons[next]')
    client.click(xpath=u"//div[@id='presentation_infos']/div/a/img")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(name=u'boutons[next]', timeout=u'8000')
    client.click(xpath=u"//div[@id='presentation_infos']/div/a/img")
    client.waits.forElement(
        timeout=u'8000', xpath=u"//div[@id='modification_infos']/div[7]/input")
    client.click(xpath=u"//div[@id='modification_infos']/div[7]/input")
    client.waits.forPageLoad(timeout=u'80000')
    client.waits.forElement(timeout=u'8000', name=u'boutons[next]')
    client.click(name=u'boutons[next]')
    client.waits.forElement(timeout=u'8000', name=u'boutons[next]')
    client.click(name=u'boutons[next]')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'exploitation_autres_lies')
    client.click(id=u'exploitation_autres_lies')
    client.type(text=u'18', id=u'exploitation_autres_lies')
    client.type(text=u'99', id=u'exploitation_autres_jeunes_vignes')
    client.click(name=u'boutons[next]')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', name=u'boutons[next]')
    client.click(name=u'boutons[next]')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', name=u'boutons[next]')
    client.click(name=u'boutons[next]')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(
        xpath=u"//div[@id='confirmation_fin_declaration']/h2", timeout=u'8000')
    client.click(xpath=u"//div[@id='confirmation_fin_declaration']/h2")
    client.asserts.assertText(
        xpath=u"//div[@id='confirmation_fin_declaration']/h2",
        validator=u'Confirmation')
    client.click(link=u'Deconnexion')
    client.asserts.assertText(validator=u'Connexion', link=u'Connexion')
Exemplo n.º 14
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.º 15
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.º 16
0
def test_google_switch_to_yahoo():
    client = WindmillTestClient(__name__)
    client.open(url=u'http://www.google.com/intl/en/')
    client.waits.forElement(timeout=u'', name=u'q')
    client.click(name=u'q')
    client.type(text=u'wikipedia', name=u'q')
    client.click(name=u'btnG')
    client.waits.forElement(link=u'Wikipedia', timeout=u'8000')
    client.click(link=u'Wikipedia')
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertJS(
        js=u"windmill.testWin().document.title == 'Wikipedia'")
Exemplo n.º 17
0
def test_google_switch_to_yahoo():
    client = WindmillTestClient(__name__)
    client.open(url=u'http://www.google.com/intl/en/')
    client.waits.forElement(timeout=u'', name=u'q')
    client.click(name=u'q')
    client.type(text=u'wikipedia', name=u'q')
    client.click(name=u'btnG')
    client.waits.forElement(link=u'Wikipedia', timeout=u'8000')
    client.click(link=u'Wikipedia')
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertJS(js=u"windmill.testWin().document.title == 'Wikipedia'")
    
Exemplo n.º 18
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.º 19
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.º 20
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!!!"
def test_create_certificate():
    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/admin/")
    client.waits.forPageLoad(timeout=u"8000")
    client.waits.forElement(timeout=u"8000", id=u"id_username")
    client.click(id=u"id_username")
    client.type(text=u"admin", id=u"id_username")
    client.type(text=u"admin", id=u"id_password")
    client.click(value=u"Log in")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(link=u"Certificates", timeout=u"8000")
    client.click(link=u"Certificates")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(link=u"              Add certificate             ", timeout=u"8000")
    client.click(link=u"              Add certificate             ")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(timeout=u"8000", id=u"id_description")
    client.click(id=u"id_description")
    client.type(text=u"srv1", id=u"id_description")
    client.type(text=u"srv1.mycompany.com", id=u"id_common_name")
    client.click(id=u"id_state")
    client.type(text=u"Bavaria", id=u"id_state")
    client.type(text=u"Munich", id=u"id_locality")
    client.type(text=u"My Company", id=u"id_organization")
    client.type(text=u"Datacenter", id=u"id_OU")
    client.click(id=u"id_email")
    client.type(text=u"*****@*****.**", id=u"id_email")
    client.click(id=u"id_subjaltname")
    client.type(text=u"DNS:*.mycompany.com", id=u"id_subjaltname")
    client.click(id=u"id_key_length")
    client.select(option=u"", id=u"id_key_length")
    client.click(value=u"1024")
    client.click(id=u"id_cert_extension")
    client.select(option=u"", id=u"id_cert_extension")
    client.click(value=u"v3_server_cert")
    client.click(id=u"id_valid_days")
    client.type(text=u"365", id=u"id_valid_days")
    client.click(id=u"id_parent")
    client.select(option=u"", id=u"id_parent")
    client.click(value=u"2")
    client.click(id=u"id_parent_passphrase")
    client.type(text=u"1234567890", id=u"id_parent_passphrase")
    client.click(xpath=u"//form[@id='certificate_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout=u"20000")
    client.asserts.assertTextIn(
        xpath=u"//div[@id='container']/ul/li", validator=u'The certificate "srv1.mycompany.com" was added successfully.'
    )
Exemplo n.º 22
0
def logged_in_client(test_url='http://localhost:5001/login', username=u'shon', passwd=u'x', client=None):

    if client is None:
        client = WindmillTestClient(__name__)
    
    client.open(url=test_url)
    client.click(id=u'username')
    client.type(text=username, id=u'username')
    # client.type(text=functest.registry['username'], id=u'username')
    client.click(id=u'password')
    client.type(text=passwd, id=u'password')
    # client.type(text=functest.registry['passwd'], id=u'password')
    client.click(id=u'login-btn')

    return client
def test_create_certificate():
    client = WindmillTestClient(__name__)

    client.open(url='http://127.0.0.1:8000/admin/logout/')
    client.waits.forPageLoad(timeout='8000')
    client.open(url='http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout='8000')
    client.waits.forElement(timeout='8000', id='id_username')
    client.click(id='id_username')
    client.type(text='admin', id='id_username')
    client.type(text='admin', id='id_password')
    client.click(value='Log in')
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(link='Certificates', timeout='8000')
    client.click(link='Certificates')
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(link='              Add certificate             ', timeout='8000')
    client.click(link='              Add certificate             ')
    client.waits.forPageLoad(timeout='20000')
    client.waits.forElement(timeout='8000', id='id_description')
    client.click(id='id_description')
    client.type(text='srv1', id='id_description')
    client.type(text='srv1.mycompany.com', id='id_common_name')
    client.click(id='id_state')
    client.type(text='Bavaria', id='id_state')
    client.type(text='Munich', id='id_locality')
    client.type(text='My Company', id='id_organization')
    client.type(text='Datacenter', id='id_OU')
    client.click(id='id_email')
    client.type(text='*****@*****.**', id='id_email')
    client.click(id='id_subjaltname')
    client.type(text='DNS:*.mycompany.com', id='id_subjaltname')
    client.click(id='id_key_length')
    client.select(option='', id='id_key_length')
    client.click(value='1024')
    client.click(id='id_cert_extension')
    client.select(option='', id='id_cert_extension')
    client.click(value='v3_server_cert')
    client.click(id='id_valid_days')
    client.type(text='365', id='id_valid_days')
    client.click(id='id_parent')
    client.select(option='', id='id_parent')
    client.click(value='2')
    client.click(id='id_parent_passphrase')
    client.type(text='1234567890', id='id_parent_passphrase')
    client.click(xpath="//form[@id='certificate_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout='20000')
    client.asserts.assertTextIn(xpath="//div[@id='container']/ul/li", validator='The certificate "srv1.mycompany.com" was added successfully.')
def test_create_certificate():
    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/admin/')
    client.waits.forPageLoad(timeout=u'8000')
    client.waits.forElement(timeout=u'8000', id=u'id_username')
    client.click(id=u'id_username')
    client.type(text=u'admin', id=u'id_username')
    client.type(text=u'admin', id=u'id_password')
    client.click(value=u'Log in')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'Certificates', timeout=u'8000')
    client.click(link=u'Certificates')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(link=u'              Add certificate             ', timeout=u'8000')
    client.click(link=u'              Add certificate             ')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_description')
    client.click(id=u'id_description')
    client.type(text=u'srv1', id=u'id_description')
    client.type(text=u'srv1.mycompany.com', id=u'id_common_name')
    client.click(id=u'id_state')
    client.type(text=u'Bavaria', id=u'id_state')
    client.type(text=u'Munich', id=u'id_locality')
    client.type(text=u'My Company', id=u'id_organization')
    client.type(text=u'Datacenter', id=u'id_OU')
    client.click(id=u'id_email')
    client.type(text=u'*****@*****.**', id=u'id_email')
    client.click(id=u'id_subjaltname')
    client.type(text=u'DNS:*.mycompany.com', id=u'id_subjaltname')
    client.click(id=u'id_key_length')
    client.select(option=u'', id=u'id_key_length')
    client.click(value=u'1024')
    client.click(id=u'id_cert_extension')
    client.select(option=u'', id=u'id_cert_extension')
    client.click(value=u'v3_server_cert')
    client.click(id=u'id_valid_days')
    client.type(text=u'365', id=u'id_valid_days')
    client.click(id=u'id_parent')
    client.select(option=u'', id=u'id_parent')
    client.click(value=u'2')
    client.click(id=u'id_parent_passphrase')
    client.type(text=u'1234567890', id=u'id_parent_passphrase')
    client.click(xpath=u"//form[@id='certificate_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertTextIn(xpath=u"//div[@id='container']/ul/li", validator=u'The certificate "srv1.mycompany.com" was added successfully.')
Exemplo n.º 25
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.º 26
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.º 27
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.º 28
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.º 29
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.º 30
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.º 31
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.º 32
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.º 33
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.º 34
0
def test_AddRootCA():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout=u'8000')
    client.type(text=u'admin', id=u'id_username')
    client.type(text=u'admin', id=u'id_password')
    client.click(value=u'Log in')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(
        xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a",
        timeout=u'8000')
    client.click(
        xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_description')
    client.click(id=u'id_description')
    client.type(text=u'Windmill RootCA', id=u'id_description')
    client.click(id=u'id_common_name')
    client.type(text=u'Root CA', id=u'id_common_name')
    client.click(id=u'id_state')
    client.type(text=u'Bavaria', id=u'id_state')
    client.type(text=u'Munich', id=u'id_locality')
    client.click(id=u'id_organization')
    client.type(text=u'My Company', id=u'id_organization')
    client.click(id=u'id_email')
    client.type(text=u'*****@*****.**', id=u'id_email')
    client.click(id=u'id_valid_days')
    client.type(text=u'365', id=u'id_valid_days')
    client.click(id=u'id_passphrase')
    client.type(text=u'1234567890', id=u'id_passphrase')
    client.check(id=u'id_der_encoded')
    client.check(id=u'id_subcas_allowed')
    client.click(
        xpath=u"//form[@id='certificateauthority_form']/div[2]/div[2]/input[1]"
    )
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertTextIn(
        xpath=u"//div[@id='container']/ul/li",
        validator=u'The certificate authority "Root CA" was added successfully.'
    )
Exemplo n.º 35
0
def logged_in_client(user='******', passwd='test', client=None):
  """
  Opens up the root URL.  If user is not logged in, logs him in.
  """
  if client is None:
    client = WindmillTestClient(__name__)
  client.open(url=windmill.settings['TEST_URL'] + '?clearSession=true')
  client.waits.forPageLoad()
  client.waits.forElement(classname='hue-loaded')
  if client.execJS(js="!!$('hue-login')")["output"]:
    client.waits.forElement(classname='hue-username')
    client.click(jquery='(".hue-username")[0]')
    client.type(classname='hue-username', text=user)
    client.click(classname='hue-password')
    client.type(classname='hue-password', text=passwd)
    client.click(classname='hue-continue')
  # Health dashboard launches at login; ideally we'd have a 
  # better "ready" notification.
  time.sleep(2.0) # TODO: Hacky sleep!
  client.waits.forElement(classname='loggedIn', timeout='20000')
  return client
Exemplo n.º 36
0
def logged_in_client(user='******', passwd='test', client=None):
    """
  Opens up the root URL.  If user is not logged in, logs him in.
  """
    if client is None:
        client = WindmillTestClient(__name__)
    client.open(url=windmill.settings['TEST_URL'] + '?clearSession=true')
    client.waits.forPageLoad()
    client.waits.forElement(classname='hue-loaded')
    if client.execJS(js="!!$('hue-login')")["output"]:
        client.waits.forElement(classname='hue-username')
        client.click(jquery='(".hue-username")[0]')
        client.type(classname='hue-username', text=user)
        client.click(classname='hue-password')
        client.type(classname='hue-password', text=passwd)
        client.click(classname='hue-continue')
    # Health dashboard launches at login; ideally we'd have a
    # better "ready" notification.
    time.sleep(2.0)  # TODO: Hacky sleep!
    client.waits.forElement(classname='loggedIn', timeout='20000')
    return client
Exemplo n.º 37
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.º 38
0
def activate_items():
  client = WindmillTestClient(__name__)
  #Names of items to buy and activate
  itemNames = ['Water', 'Coffee', 'Beer', 'Hot milk', 'Coffee to-go']
  login(client, 'root', 'root')
  #Store base URL
  client.storeVarFromJS(options=u"BaseUrl|window.location.href.replace(window.location.search, '')")
  #Go to Shop
  client.storeURL(link=u'Shop')
  client.open(url=u'{$Shop}')
  client.waits.forElement(id=u'items')
  #Buy items
  for itemName in itemNames:
    client.click(jquery=(u"('a[title=%s]')[0]" % itemName))
    client.click(jquery=u"('.poker_submit[onclick*=subtarget]')[0]")
  #Go to medium profile to extract item IDs
  client.open(url=u'{$BaseUrl}?q=poker/profile/medium')
  for itemName in itemNames:
    client.storeVarFromJS(options=(u'%sId|$("img[title=%s]").attr("id")' % (itemName, itemName)))
  #Go and sit to a table
  client.open(url=u'{$BaseUrl}')
  client.waits.forElement(classname=u'jpoker_table_list_table_empty')
  client.click(id=u'play-now-button')
  client.waits.forElement(classname=u'jpoker_table',timeout=u'20000')
  #Items activation using JS (couldn't get Windmill to select and click in the iframe)
  for itemName in itemNames:
    #Set item_id JS variable using a JS assertion because Windmill variables are not working in execJS
    client.asserts.assertJS(js=u'!isNaN(item_id = parseInt("{$%sId}"))' % itemName)
    client.execJS(js=u'os_poker_send_message({type:"os_poker_activate_item", id_item: item_id});')
    #Wait for the item to be received by the player
    client.waits.forElement(classname=u'poker_player_item poker_gift_%s' % itemName.replace(' ', '-'),timeout=u'7000')
  client.click(classname=u'logout')
Exemplo n.º 39
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')
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
Exemplo n.º 41
0
def test_openid_authentication():
    client = WindmillTestClient(__name__)
    client.open(url='https://www.hampr.com/')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='hamprTitle']", timeout=8000)
    client.click(link='OpenID Login')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='pageContainer']/p[7]/b",
                            timeout=8000)
    client.click(xpath=u"//div[@id='pageContainer']/form/input")
    client.type(text='http://openid.claimid.com/windmilltest',
                xpath="//div[@id='pageContainer']/form/input")
    client.click(xpath="//div[@id='pageContainer']/form/input[2]")
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='content']/form/fieldset/label",
                            timeout=28000)
    client.click(xpath="//div[@id='content']/form/fieldset/label")
    client.click(id='username')
    client.type(text='windmillTest', id='username')
    client.type(text='test_windmill', id='password')
    client.click(value='Login')
    client.waits.forPageLoad(timeout=20000)
Exemplo n.º 42
0
def test_openid_authentication():
    client = WindmillTestClient(__name__)
    client.open(url='https://www.hampr.com/')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='hamprTitle']", timeout=8000)
    client.click(link='OpenID Login')
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='pageContainer']/p[7]/b",
                            timeout=8000)
    client.click(xpath=u"//div[@id='pageContainer']/form/input")
    client.type(text='http://openid.claimid.com/windmilltest',
                xpath="//div[@id='pageContainer']/form/input")
    client.click(xpath="//div[@id='pageContainer']/form/input[2]")
    client.waits.forPageLoad(timeout=20000)
    client.waits.forElement(xpath="//div[@id='content']/form/fieldset/label",
                            timeout=28000)
    client.click(xpath="//div[@id='content']/form/fieldset/label")
    client.click(id='username')
    client.type(text='windmillTest', id='username')
    client.type(text='test_windmill', id='password')
    client.click(value='Login')
    client.waits.forPageLoad(timeout=20000)
Exemplo n.º 43
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.º 44
0
def test_recordingSuite0():
    client = WindmillTestClient(__name__)

    client.click(link=u"Login")
    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"/html/body/div/form/button")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(link=u"Edit", timeout=u"8000")
    client.click(link=u"Edit")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(timeout=u"8000", id=u"id_contact-email")
    client.click(id=u"id_contact-email")
    client.type(text=u"*****@*****.**", id=u"id_contact-email")
    client.click(xpath=u"//div[@id='submit-buttons']/button")
    client.click(xpath=u"//div[@id='response-modal-error']/div[3]/a")
    client.click(id=u"id_contact-email")
    client.type(text=u"*****@*****.**", id=u"id_contact-email")
    client.click(xpath=u"//div[@id='submit-buttons']/button")
    client.click(link=u"OK")
    client.open(url=u"/accounts/logout/")
    client.waits.forPageLoad(timeout=u"20000")
    client.open(url=u"/")
Exemplo n.º 45
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.º 46
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]")
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.º 48
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.º 49
0
def test_recordingSuite1():
    client = WindmillTestClient(__name__)

    client.open(url=u"/admin/")
    client.waits.forPageLoad(timeout=u"8000")
    client.type(text=u"admin", id=u"id_username")
    client.type(text=u"admin", id=u"id_password")
    client.click(value=u"Log in")
    client.waits.forPageLoad(timeout=u"20000")
    client.open(url=u"/")
    client.waits.forPageLoad(timeout=u"8000")
    client.waits.forElement(link=u"Edit (admin)", timeout=u"8000")
    client.click(link=u"Edit (admin)")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(timeout=u"8000", name=u"_save")
    client.click(name=u"_save")
    client.waits.forPageLoad(timeout=u"20000")

    client.open(url=u"/admin/logout/")
    client.waits.forPageLoad(timeout=u"8000")
Exemplo n.º 50
0
def test_recordingSuite2():
    client = WindmillTestClient(__name__)

    client.open(url=u"/admin/logout/")
    client.waits.forPageLoad(timeout=u"8000")
    client.open(url=u"/admin/")
    client.waits.forPageLoad(timeout=u"8000")
    client.type(text=u"admin", id=u"id_username")
    client.type(text=u"admin", id=u"id_password")
    client.click(value=u"Log in")
    client.waits.forPageLoad(timeout=u"20000")
    client.open(url=u"/")
    client.waits.forPageLoad(timeout=u"8000")
    client.waits.forElement(link=u"Edit Person", timeout=u"8000")
    client.click(link=u"Edit Person")
    client.waits.forPageLoad(timeout=u"20000")
    client.waits.forElement(timeout=u"8000", id=u"id_bio")
    client.click(id=u"id_bio")
    client.type(text=u"NewName", id=u"id_name")
    client.click(value=u"Save person")
    client.asserts.assertValue(validator=u"NewName", id=u"id_name")
    client.click(id=u"id_name")
    client.type(text=u"", id=u"id_name")
    client.click(value=u"Save person")
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 teardown_module(module):
    client = WindmillTestClient(__name__)
    
    client.open(url=windmill.settings['TEST_URL'], id=u'fixture-file')
    client.click(id=u'end-session')
    
Exemplo n.º 53
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')
Exemplo n.º 54
0
def test_manage_society_page():
    client = WindmillTestClient('test_manage_society_page')

    client.open(url='/admin/society/1/manage')
    client.waits.forPageLoad(timeout='8000')
    client.asserts.assertNode(link="Manage this Society's Resources.+")
Exemplo n.º 55
0
def teardown_module(module):
    client = WindmillTestClient(__name__)

    client.open(url=windmill.settings['TEST_URL'], id=u'fixture-file')
    client.click(id=u'end-session')
Exemplo n.º 56
0
client = WindmillTestClient(__name__)

# temps avant timeout (pour ne pas bloquer si la page ne s'ouvre pas) // a certain amount of time before it gives up opening a page, so that it doesn't get stuck
timeOut=u'8000'		# 8 secondes avant time out // 8 sec before timeout
# temps de pause entre deux requêtes (pour ne pas surcharger les serveurs) // time lapse between two requests (not to overwhelm the servers)
timeSleep=u'100' 	# 0.1 seconde // 0.1 sec

# l'url qu'on va vouloir scraper // the url we want to scrape
rootServer="http://ec.europa.eu"
BASE_URL="http://ec.europa.eu/environment/ets/napMgt.do"
# la liste des pays qu'on va scrapper // the list of countries we want to scrape
cntryList=['France','Germany','Austria','Belgium','Bulgaria','Croatia','Cyprus','Czech Republic','Denmark',
'Estonia','Finland','Greece','Hungary','Iceland','Ireland','Italy','Latvia','Liechtenstein','Lithuania','Luxembourg','Malta','Netherlands','Norway','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden','United Kingdom']

# ouvrir la page // open the page
client.open(url=BASE_URL)
client.waits.forPageLoad(timeout=timeOut) # et qu'elle se charge // load the page
client.waits.sleep(milliseconds=timeSleep) # attendre que la page s'ouvre // wait till the web page opens


###### PHASE 1: lister les tables qui contiennent les liens // PHASE 1: listing the tables that contain links


list_of_tables=[]

for cntry in cntryList:
	# selectionner un pays et une période et ouvrir la page // select a country and a period and open the page 
	mute=client.selectReset(name='nap.registryCodeArray') # deselectionner toutes les options pays dans le choix multiple nap.registryCodeArray parce que quand on ouvre avec client il en sélectionne plusieurs // unselect all the options about the country in multiple choice nap.registryCodeArray
	mute=client.select(name='nap.registryCodeArray',option=cntry) # selectionner l'option pays dans le choix multiple nap.registryCodeArray // select the option country in the multiple choice nap.registryCodeArray
	mute=client.select(name='periodCode',option='All') # selectionner la periode dans le choix multiple periodCode // select period in multiple choice periodCode
	mute=client.click(value='Search') # cliquer sur search // click on search