def testHome(self): browser = Browser() browser.open('http://testserver') browser.getControl(name='first_name').value = 'Jim' browser.getForm().submit() self.assertEquals(browser.url, 'http://testserver/hello') self.assertEquals(browser.title, 'Hello Jim') browser.getLink('Go back').click() self.assertEquals(browser.title, 'Home')
def siteTestCase(self): """Patikrink pagrindinį tinklapio funkcionalumą""" TEST_PORT = 8000 browser = Browser() browser.base = 'http://*****:*****@Tom.com' browser.getControl(name='psw').value = 'tom' browser.getControl(name='psw2').value = 'tom' browser.getForm().submit() if not ("Prisijungta" in browser.contents): browser.getLink(id='pagrindinis').click() browser.getControl(name='name').value = 'UserName' browser.getControl(name='psw').value = 'UserName' browser.getControl(name="prisijungti").click() browser.getLink('Pasikeisti slaptažodį').click() browser.getControl(name='psw').value = 'tom' browser.getControl(name='newpsw1').value = 'tom' browser.getControl(name='newpsw2').value = 'tom' browser.getForm().submit() if not "Slaptažodis pakeistas" in browser.contents: raise Exception('Bad contents, when changing psw') browser.getLink(id='sarasas').click() browser.getLink('Biskvitiniai sklindžiai').click() self.assertEquals(browser.url, 'http://localhost:%s/receptas/1/' % TEST_PORT) browser.getLink(id='kurimas').click() self.assertEquals(browser.url, 'http://localhost:%s/kurimas/' % TEST_PORT) browser.getControl(name='name').value = 'Pyragas' browser.getControl(name='process').value = 'Kepti orkaitėje.' browser.getControl(name='duration').value = '40 min.' browser.getControl(name='description').value = 'Skanaus :}' browser.getControl('Pyragas') browser.getControl('Lietuvių') browser.getControl('Kepimas orkaitėje') browser.getControl('Lengvas') browser.getControl(name='ingredients').value = "." browser.getForm(name='kurimo_forma').submit() form = browser.getForm(name='komentaru_forma') form.getControl(name='comment').value = "Testinis komentaras" form.submit() if not "Testinis komentaras" in browser.contents: raise Exception('Bad contents, when changing psw')