Exemplo n.º 1
0
 def setUp(self):
     self.seleniumObj = selenium("localhost", 4444, "*firefoxproxy",
                                 self.URL)
     self.seleniumObj.set_speed(1000)
     self.flashSeleniumObj = FlashSelenium(self.seleniumObj,
                                           "coloredSquare")
     self.flashSeleniumObj.start()
Exemplo n.º 2
0
 def _testShouldCreateFlashSeleniumObject(self):
     self.assertTrue(self.flashSeleniumObj is not None)
     self.assertEquals(
         FlashSelenium(None, "").__class__, self.flashSeleniumObj.__class__)
Exemplo n.º 3
0
class FlashSeleniumTest(unittest.TestCase):

    URL = "http://flashselenium.t35.com/colors.html"

    def setUp(self):
        self.seleniumObj = selenium("localhost", 4444, "*firefoxproxy",
                                    self.URL)
        self.seleniumObj.set_speed(1000)
        self.flashSeleniumObj = FlashSelenium(self.seleniumObj,
                                              "coloredSquare")
        self.flashSeleniumObj.start()

    def tearDown(self):
        self.flashSeleniumObj.stop()

    def _testShouldOpenGoogleHomePage(self):
        seleniumObj = selenium("localhost", 4444, "*firefox",
                               "http://www.google.co.in")
        seleniumObj.start()
        seleniumObj.open("http://www.google.co.in")
        self.assertEquals("Google", seleniumObj.get_title())
        seleniumObj.stop()

    def _testShouldCreateFlashSeleniumObject(self):
        self.assertTrue(self.flashSeleniumObj is not None)
        self.assertEquals(
            FlashSelenium(None, "").__class__, self.flashSeleniumObj.__class__)

    def testShouldLoadMovie100Percent(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertEquals('100', self.flashSeleniumObj.percent_loaded())

    def testShouldCheckIfMovieIsPlaying(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertTrue(self.flashSeleniumObj.is_playing())

    def testShouldReturnVariableValueFromMovie(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertEquals('GREEN', self.flashSeleniumObj.call('getColor'))
        self.flashSeleniumObj.call("click")
        self.assertEquals('BLUE', self.flashSeleniumObj.call('getColor'))

    def testShouldGetVariable(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.set_variable("FooBar", "42")
        self.assertEquals("42", self.flashSeleniumObj.get_variable("FooBar"))

    def testShouldClickAndProceedToNextFrame(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.call("click")
        self.assertEquals('BLUE', self.flashSeleniumObj.call('getColor'))
        self.flashSeleniumObj.call("click")
        self.assertEquals('RED', self.flashSeleniumObj.call('getColor'))

    def testShouldPanMovie(self):
        self.flashSeleniumObj.open(self.URL)
        try:
            self.flashSeleniumObj.zoom(10)
            self.flashSeleniumObj.pan(20, 20, 1)
        except:
            self.fail("Should not fail")

    def testShouldFailWhenInvalidArgumentsAreSentToPanMethod(self):
        self.flashSeleniumObj.open(self.URL)
        try:
            self.flashSeleniumObj.pan("Invalid", "Arguments", "And Strings")
            self.fail("Should have thrown exception")
        except:
            self.assertTrue(True)

    def testShouldZoomMovieBy10Percent(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.zoom(10)

    def testShouldReturnTotalNumberOfFramesInMovie(self):
        self.flashSeleniumObj.open(self.URL)
        while (self.flashSeleniumObj.percent_loaded() < 100):
            pass
        self.assertEquals('1', self.flashSeleniumObj.total_frames())

    def testShouldGetNavigatorName(self):
        self.flashSeleniumObj.open(self.URL)
        retVal = self.flashSeleniumObj.checkBrowserAndReturnJSPrefix()
        self.assertEquals("window.document['coloredSquare'].", retVal)
 def setUp(self):
     self.seleniumObj = selenium("localhost", 4444, "*firefoxproxy", self.URL)
     self.seleniumObj.set_speed(1000)
     self.flashSeleniumObj = FlashSelenium(self.seleniumObj, "coloredSquare")
     self.flashSeleniumObj.start()
class FlashSeleniumTest(unittest.TestCase):
    
    URL = "http://flashselenium.t35.com/colors.html"
    
    def setUp(self):
        self.seleniumObj = selenium("localhost", 4444, "*firefoxproxy", self.URL)
        self.seleniumObj.set_speed(1000)
        self.flashSeleniumObj = FlashSelenium(self.seleniumObj, "coloredSquare")
        self.flashSeleniumObj.start()
        
    def tearDown(self):
        self.flashSeleniumObj.stop()

    def _testShouldOpenGoogleHomePage(self):
        seleniumObj = selenium("localhost", 4444, "*firefox", "http://www.google.co.in")
        seleniumObj.start()
        seleniumObj.open("http://www.google.co.in")
        self.assertEquals("Google", seleniumObj.get_title())
        seleniumObj.stop()
    
    def _testShouldCreateFlashSeleniumObject(self):
        self.assertTrue(self.flashSeleniumObj is not None)
        self.assertEquals(FlashSelenium(None, "").__class__, self.flashSeleniumObj.__class__)

    def testShouldLoadMovie100Percent(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertEquals('100', self.flashSeleniumObj.percent_loaded());
        
    def testShouldCheckIfMovieIsPlaying(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertTrue(self.flashSeleniumObj.is_playing())
        
    def testShouldReturnVariableValueFromMovie(self):
        self.flashSeleniumObj.open(self.URL)
        self.assertEquals('GREEN', self.flashSeleniumObj.call('getColor'))
        self.flashSeleniumObj.call("click")
        self.assertEquals('BLUE', self.flashSeleniumObj.call('getColor'))
        
    def testShouldGetVariable(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.set_variable("FooBar", "42")
        self.assertEquals("42", self.flashSeleniumObj.get_variable("FooBar"))
       
    def testShouldClickAndProceedToNextFrame(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.call("click")
        self.assertEquals('BLUE', self.flashSeleniumObj.call('getColor'))
        self.flashSeleniumObj.call("click")
        self.assertEquals('RED', self.flashSeleniumObj.call('getColor'))
        
    def testShouldPanMovie(self):
        self.flashSeleniumObj.open(self.URL)
        try:
            self.flashSeleniumObj.zoom(10)
            self.flashSeleniumObj.pan(20, 20, 1)
        except:
            self.fail("Should not fail")
            
    def testShouldFailWhenInvalidArgumentsAreSentToPanMethod(self):
        self.flashSeleniumObj.open(self.URL)
        try:
            self.flashSeleniumObj.pan("Invalid", "Arguments", "And Strings")
            self.fail("Should have thrown exception")
        except:
            self.assertTrue(True)
        
    def testShouldZoomMovieBy10Percent(self):
        self.flashSeleniumObj.open(self.URL)
        self.flashSeleniumObj.zoom(10)
        
    def testShouldReturnTotalNumberOfFramesInMovie(self):
        self.flashSeleniumObj.open(self.URL)
        while (self.flashSeleniumObj.percent_loaded() < 100):
            pass
        self.assertEquals('1', self.flashSeleniumObj.total_frames())
    
    def testShouldGetNavigatorName(self):
    	self.flashSeleniumObj.open(self.URL)
        retVal = self.flashSeleniumObj.checkBrowserAndReturnJSPrefix()
        self.assertEquals("window.document['coloredSquare'].", retVal);
Exemplo n.º 6
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()