# tizen sdk luanch
#openApp("/home/test/tizen-sdk/ide/startup.sh -data /home/test/tizen-sdk/test/ide/workspace")
if sys.argv[3] == "win" :
    ide=sys.argv[1] + "/IDE.bat -data " + sys.argv[2]    
else:
    ide=sys.argv[1] + "/startup.sh -data " + sys.argv[2]


print "%s%s" % ("start ide path : ",ide)
print "%s" % ("Tizen IDE launch...")
openApp( ide )
sleep( 120 ) ## wait ide open

# create tizen web test project 1, and test
type( "f", KeyModifier.ALT )
sleep( 2 )
type( "n" )
sleep( 2 )
type( "r" )
wait("1373869011937.png", 30)
type( "tizen web" )
sleep( 5 )
type( Key.ENTER )
sleep( 5 )
type( Key.ENTER )
sleep( 5 )
wait("1373869170312.png", 10)
click(Pattern("1373865829456.png").similar(0.90))
sleep( 5 )
wait("1373885396049.png", 60*5)
click("1373865867360.png")
type( "wT1" )
type( Key.ENTER )
sleep( 10 )

if exists("1373877306612.png"):
    click(Pattern("1373877363036.png").targetOffset(-81,1))
    click("1373877385908.png")

sleep( 5 )
type( "w", KeyModifier.ALT )
sleep( 2 )
type( "r" )
sleep( 2 )
type( Key.ENTER )
sleep( 5 )


    
click("1373866395268.png")
wait("1373866273709.png")

type( Key.F11, KeyModifier.CTRL )
sleep( 2 )
if exists("1373873356058.png"):
    click("1373857413406.png")
sleep( 30 )
wait("1373873427833.png", 60)
click(Pattern("1373883294273.png").targetOffset(-17,1))
sleep( 1 )




# create tizen native test project 1
type( "f", KeyModifier.ALT )
sleep( 2 )
type( "n" )
sleep( 2 )
type( "r" )
wait("1373869011937.png", 30)
type( "tizen native" )
sleep( 5 )
type( Key.ENTER )
sleep( 5 )
type( Key.ENTER )
sleep( 5 )
wait("1373877161869.png",10)
click(Pattern("1373877178205.png").similar(0.90))
sleep( 5 )
wait("1373885464049.png", 60*5)
click("1373865867360.png")
type( "nT1" )
type( Key.ENTER )
sleep(10)

if exists("1373877306612.png"):
    click(Pattern("1373877363036.png").targetOffset(-81,1))
    click("1373877385908.png")

sleep( 5 )
type( "w", KeyModifier.ALT )
sleep( 2 )
type( "r" )
sleep( 2 )
type( Key.ENTER )
sleep( 5 )

click("1373866395268.png")
wait("1373883239569.png")


type( Key.F11, KeyModifier.CTRL )
sleep( 1 )
doubleClick("1373883771509.png")
sleep( 1 )
wait("1373883824021.png", 60*10 )
click(Pattern("1373883294273.png").targetOffset(-17,1))
sleep( 1 )
doubleClick(Pattern("1373885544264.png").targetOffset(-29,1))
sleep( 1 )
print "%s" % ("[info] Exit code: 0")