from selenium import selenium
import unittest, time, re, sys

sys.path.append( "../../../../content/" );
import btv

global testvars
testvars = btv.ButterTestVariables

class testcase_TrackDrop(unittest.TestCase):

    def setUp( self ):
      self.verificationErrors = []
      self.selenium = selenium( testvars["Host"],
                                testvars["Port"],
                                testvars["Browser"],
                                testvars["Grid"]
                                )
      self.selenium.start()

    def test_case(self):
        sel = self.selenium
        sel.open(testvars["ButterTestPage"])
        sel.set_speed( 500 )
        sel.wait_for_page_to_load("7500")
        for i in range(60):
            try:
                if sel.is_element_present("id=TrackEventView1"): break
            except: pass
            time.sleep(1)
        else: self.fail("time out")
        sel.mouse_move_at("id=TrackEventView1", "5,0")
        sel.mouse_down_at("id=TrackEventView1", "5,0")
        self.failUnless(sel.is_element_present("id=TrackView2"))
        sel.mouse_move_at("id=TrackView2", "300,5")
        sel.mouse_up_at("id=TrackView2", "300,5")
        self.failUnless(sel.is_element_present("id=TrackEventView1"))

    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

class testcase_DeleteTrack(unittest.TestCase):
    def setUp(self):
      self.verificationErrors = []
      self.selenium = selenium( testvars["Host"],
                                testvars["Port"],
                                testvars["Browser"],
                                testvars["Grid"]
                                )
      self.selenium.start()

    def test_delete_track(self):
        sel = self.selenium
        sel.open(testvars["ButterTestPage"])
        sel.wait_for_page_to_load("7500")
        for i in range(60):
            try:
                if sel.is_element_present("id=TrackView2"): break
            except: pass
            time.sleep(1)
        else: self.fail("time out")
        self.failUnless(sel.is_element_present("id=TrackView2"))
        self.failUnless(sel.is_element_present("id=TrackView1"))
        self.failUnless(sel.is_element_present("id=track-handle-Track0"))
        self.failUnless(sel.is_element_present("id=TrackEventView1"))
        # sel.asser("id=track-handle-Track2", "0,5")
        sel.mouse_down_at("id=track-handle-Track2", "0,5")
        sel.mouse_move_at("id=track-handle-Track1", "5,15")
        sel.mouse_up_at("id=track-handle-Track1", "5,15")
        self.failUnless(sel.is_element_present("id=TrackView2"))
        self.failUnless(sel.is_element_present("id=TrackView1"))
        self.failUnless(sel.is_element_present("id=track-handle-Track0"))
        self.failUnless(sel.is_element_present("id=TrackEventView1"))

    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

@@ -105,19 +105,24 @@
 %0Aimport 
-btv
+testvars
 %0A%0Aglobal
@@ -126,25 +126,26 @@
 bal 
-testvars%0A
+btv%0Abtv = 
 testvars
  = b
@@ -144,14 +144,8 @@
 vars
- = btv
 .But
@@ -294,32 +294,27 @@
 = selenium( 
-testvars
+btv
 %5B%22Host%22%5D,%0A  
@@ -339,32 +339,27 @@
             
-testvars
+btv
 %5B%22Port%22%5D,%0A  
@@ -384,32 +384,27 @@
             
-testvars
+btv
 %5B%22Browser%22%5D,
@@ -432,32 +432,27 @@
             
-testvars
+btv
 %5B%22Grid%22%5D%0A   
@@ -577,32 +577,27 @@
    sel.open(
-testvars
+btv
 %5B%22ButterTest
@@ -1469,24 +1469,19 @@
 lenium( 
-testvars
+btv
 %5B%22Host%22%5D
@@ -1514,24 +1514,19 @@
         
-testvars
+btv
 %5B%22Port%22%5D
@@ -1559,24 +1559,19 @@
         
-testvars
+btv
 %5B%22Browse
@@ -1607,24 +1607,19 @@
         
-testvars
+btv
 %5B%22Grid%22%5D
@@ -1760,24 +1760,19 @@
 el.open(
-testvars
+btv
 %5B%22Butter

Fix mixed up import