Esempio n. 1
0
	def preconditionLoggedIn(self):
		'''Logs in member if he is logged out, otherwise do nothing.'''
		selenium = self.selenium
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		hasUsername = selenium.is_element_present("//meta[@name='wrook.username']")
		if not hasUsername: self.doMemberLogsInWithEmailAddress()
Esempio n. 2
0
	def preconditionLoggedOut(self):
		'''Logs out the member if he is logged in, otherwise do nothing.'''
		selenium = self.selenium
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		hasUsername = selenium.is_element_present("//meta[@name='wrook.username']")
		if hasUsername: self.doMemberLogout()
Esempio n. 3
0
 def login(self):
     selenium = self.selenium
     selenium.open("/")
     selenium.click("login")
     selenium.wait_for_page_to_load(5000)
     selenium.type("email", "*****@*****.**")
     selenium.click("submit-login")
     selenium.wait_for_page_to_load(5000)
Esempio n. 4
0
	def Initial(self):
		try:
			os.system(config_element.get("setting", "cancel_msta"))
			selenium.start()
			selenium.open("/CWMServer/index.jsp")
			selenium.window_maximize()
			print "The screen was open - PASS"
		except:
			raise Exception("The screen was not open - FAIL")
Esempio n. 5
0
    def do_run(self):
        selenium = self.selenium
        for i in range(0,10):
            selenium.open("/run/example/")
            self.failUnless(not selenium.is_text_present("Request information"))
            self.failUnless(selenium.is_text_present("registers"))
            self.failUnless(selenium.is_text_present("output"))

        self.failUnless(selenium.is_text_present("1 1 2 3 5 8 13 21 34 55"))
Esempio n. 6
0
	def testMemberVisitHisPublicProfile(self):
		'''Member visits his public profile. (Via URL)'''
		selenium = self.selenium
		self.preconditionLoggedIn()
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		selenium.click("sidebarMenu-publicProfile")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-members-stories", selenium.get_attribute("//body@id"))
Esempio n. 7
0
	def testHalfBakedEdition(self):
		'''
		Tests the "Half Baked Edition" content page.
		Test includes acces via the main navigation path from the home page.
		'''
		selenium = self.selenium
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		selenium.click("link-halfBaked")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-about-HalfBakedEdition", selenium.get_attribute("//body@id"))
Esempio n. 8
0
	def testWhoIsBehindWrook(self):
		'''
		Tests the "Who is behind Wrook" content page.
		Test includes acces via the main navigation path from the home page.
		'''
		selenium = self.selenium
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		selenium.click("menuWho")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-about-who", selenium.get_attribute("//body@id"))
Esempio n. 9
0
 def testLinks(self):
     selenium = self.selenium
     selenium.open("/selenium-server/tests/html/test_click_page1.html")
     self.failUnless(selenium.get_text("link").find("Click here for next page") != -1, "link 'link' doesn't contain expected text")
     links = selenium.get_all_links()
     self.failUnless(len(links) > 3)
     self.assertEqual("linkToAnchorOnThisPage", links[3])
     selenium.click("link")
     selenium.wait_for_page_to_load(5000)
     self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page2.html"))
     selenium.click("previousPage")
     selenium.wait_for_page_to_load(5000)
     self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page1.html"))
Esempio n. 10
0
 def testGoogle__4(self):
     selenium = self.selenium
     selenium.open("http://www.google.com/webhp?hl=en")
     
     #Verifies that the title matches
     self.assertEqual ("Google", selenium.get_title())
     selenium.type("q", "Selenium OpenQA")
     
     #Verifies that it can find the Selenium website
     self.assertEqual("Selenium OpenQA", selenium.get_value("q"))
     selenium.click("btnG")
     selenium.wait_for_page_to_load("5000")
     self.assertEqual("Selenium OpenQA - Google Search", selenium.get_title())
 def testLinks(self):
     selenium = self.selenium
     selenium.open("/selenium-server/tests/html/test_click_page1.html")
     self.failUnless(selenium.get_text("link").find("Click here for next page") != -1, "link 'link' doesn't contain expected text")
     links = selenium.get_all_links()
     self.failUnless(len(links) > 3)
     self.assertEqual("linkToAnchorOnThisPage", links[3])
     selenium.click("link")
     selenium.wait_for_page_to_load(5000)
     self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page2.html"))
     selenium.click("previousPage")
     selenium.wait_for_page_to_load(5000)
     self.failUnless(selenium.get_location().endswith("/selenium-server/tests/html/test_click_page1.html"))
Esempio n. 12
0
    def testGoogle__4(self):
        selenium = self.selenium
        selenium.open("http://www.google.com/webhp?hl=en")

        #Verifies that the title matches
        self.assertEqual("Google", selenium.get_title())
        selenium.type("q", "Selenium OpenQA")

        #Verifies that it can find the Selenium website
        self.assertEqual("Selenium OpenQA", selenium.get_value("q"))
        selenium.click("btnG")
        selenium.wait_for_page_to_load("5000")
        self.assertEqual("Selenium OpenQA - Google Search",
                         selenium.get_title())
Esempio n. 13
0
    def testKeyPress(self):
        selenium = self.selenium
	input_id = 'ac4'
	update_id = 'ac4update'

	selenium.open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html")
        selenium.key_press(input_id, 74)
	time.sleep(0.5)
        selenium.key_press(input_id, 97)
        selenium.key_press(input_id, 110)
	time.sleep(0.5)
        self.failUnless('Jane Agnews' == selenium.get_text(update_id))
        selenium.key_press(input_id, '\9')
	time.sleep(0.5)
        self.failUnless('Jane Agnews' == selenium.get_value(input_id))
Esempio n. 14
0
    def testKeyPress(self):
        selenium = self.selenium
	input_id = 'ac4'
	update_id = 'ac4update'

	selenium.open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html")
        selenium.key_press(input_id, 74)
	time.sleep(0.5)
        selenium.key_press(input_id, 97)
        selenium.key_press(input_id, 110)
	time.sleep(0.5)
        self.failUnless('Jane Agnews' == selenium.get_text(update_id))
        selenium.key_press(input_id, '\9')
	time.sleep(0.5)
        self.failUnless('Jane Agnews' == selenium.get_value(input_id))
Esempio n. 15
0
    def test_run(self):
        selenium = self.selenium
        self.login()
        self.do_run()

        #Reset
        selenium.open("/programs/")
        self.get_details()
        self.do_reset()

        self.do_run()

        #Reset
        selenium.open("/programs/")
        self.get_details()
        self.do_reset()
Esempio n. 16
0
	def testWrookIsOpenSource(self):
		'''
		Tests the "Wrook is Open Source" content page.
		Test includes acces via the main navigation path from the home page.
		'''
		selenium = self.selenium
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		selenium.click("menu-openSourceLicense")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-about-OpenSourceLicense", selenium.get_attribute("//body@id"))
		selenium.click("menu-openSourceAttribution")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-about-openSourceAttribution", selenium.get_attribute("//body@id"))
		selenium.click("menu-CPAL10License")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-about-CPAL", selenium.get_attribute("//body@id"))
Esempio n. 17
0
	def Login(self):
		try:
			selenium.open(config_element.get("setting", "acs_address_sub"))
			selenium.type("id="+config_element.get("login", "username_id"),
						  config_setting.get("setting", "username"))
			selenium.type("id="+config_element.get("login", "password_id"),
						  config_setting.get("setting", "password"))
			selenium.click("id="+config_element.get("login", "login_Id"))
			selenium.wait_for_page_to_load(
				config_element.get("setting", "wait_time"))
			print "Login to the web - PASS"
			pyautogui.click(1000, 30)
			selenium.click(
				"xpath="+config_element.get("setting", "askey_logo"))
			print "Get the ASKEY image - PASS"
		except:
			raise Exception("No login to the web - FAIL")
Esempio n. 18
0
	def testMemberViewsAndEditsHisAccountSettings(self):
		'''
		Member views and edits his account settings.
		Persistance is tested by changing the about field twice
		and verifying the saved input
		'''
		selenium = self.selenium
		self.preconditionLoggedIn()
		selenium.open("/")
		selenium.wait_for_page_to_load("30000")
		selenium.click("sidebarMenu-accountSettings")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-account-view", selenium.get_attribute("//body@id"))
		selenium.click("btnEditAccount")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-account-edit", selenium.get_attribute("//body@id"))
		selenium.type("About", "Bonjour!")
		selenium.click("btnSave")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-account-view", selenium.get_attribute("//body@id"))
		self.assertEqual("Bonjour!", selenium.get_text("valAbout"))
		selenium.click("btnEditAccount")
		selenium.wait_for_page_to_load("30000")
Esempio n. 19
0
from FlashSelenium import FlashSelenium
from selenium import selenium

url = "http://flashselenium.t35.com/colors.html"
browserType = "*firefox"

selenium = selenium("localhost", 4444, browserType, url)
selenium.start()
selenium.open(url)

flashApp = FlashSelenium(selenium, "coloredSquare")
flashApp.percent_loaded()
Esempio n. 20
0
class main_script(unittest.TestCase):
    # for Firefox
    selenium = selenium("localhost", 5555, "*chrome", "http://google.co.in")
    selenium.start()
    selenium.open("/")
    # end of Firefox
    # for IE
    #driver = webdriver.Ie("C:\\Python34\\IEDriverServer.exe")
    #driver.close()
    # end of IE
    # for Chrome
    #     chromedriver = "D:\\Work\\Drivers\\chromedriver"
    #     os.environ["webdriver.chrome.driver"] = chromedriver
    #     driver = webdriver.Chrome(chromedriver)
    #     driver.get("http://stackoverflow.com")
    #     driver.quit()
    #     selenium.start()
    #     End for Chrome
    #     selenium.open("/")
    #display = Display(visible=0, size=(800, 600))
    #display.start()
    #driver = webdriver.Chrome("D:\Work\Drivers\chromedriver.exe")
    #driver.get("http://www.google.com")
    #print driver.page_source.encode('utf-8')
    pass

    def test01_script(self):
        pass
        browser = self.selenium
        print "Open the google page"
        browser.type("q", "selenium RC")
        print "Enter the search test Selenium RC"
        browser.click("btnG")
        print "Click on Google Search button"
        browser.stop()

    @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
    def test02_script(self):
        pass
        browser = self.selenium
        print "Open the google page"
        browser.type("q", "selenium RC")
        print "Enter the search test Selenium RC"
        browser.click("btnG")
        print "Click on Google Search button"
        browser.stop()

    @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
    #@unittest.expectedFailure
    def test03_script(self):
        pass
        browser = self.selenium
        print "Open the google page"
        browser.type("q", "selenium RC")
        print "Enter the search test Selenium RC"
        browser.click("btnG")
        print "Click on Google Search button"
        browser.stop()

    def close_Chrome(self):
        self.driver.quit()
Esempio n. 21
0
	def doMemberLogout(self):
		selenium = self.selenium
		selenium.open("/Logout")
		selenium.wait_for_page_to_load("30000")
		self.assertEqual("page-home-visitor", selenium.get_attribute("//body@id"))
Esempio n. 22
0
class main_script(unittest.TestCase):
    selenium = selenium("localhost", 4444, "*chrome", "http://google.co.in")
    selenium.start()
    selenium.open("/")