[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

How to launch Dogtail script from within Anaconda



Hello,
I would like to gather some ideas what is the best way of launching dogtail testcases from anaconda.
Suppose we have all the required files in stage2.img.

My thoughts:

Supose we have dogtail="something" option in anaconda.
The execution gets to the point where we have to download the testcase and run it. In the moment I use two files. One is the testcase (testcase.py) and the second one is a helper (launcher.sh). My launcher sets up the environment (e.g. export DISPLAY=:1) and then executes the testcase.
I could use it to copy the logfiles after the testcase has finished.
The good thing here is that I have my testcase containing dogtail only stuff. All other actions are left to launcher.sh

The other approach is to have anaconda execute testcase.py and leave the testcase developer take care of environment.
We can have some helpers to ease testcase development of course.

What do you think is the best approach here?
I would like to hear other people's opinion.

Greetings,
Alexander.

Attachment: launcher.sh
Description: application/shellscript

#!/usr/bin/env python
# Dogtail+Anaconda demo script

print "*** start of testcase.py ***"

import time

from dogtail.config import config
from dogtail.procedural import *
from dogtail import predicate
from dogtail import tree

# Set focus on app.
app_found=False
config.fatalErrors=True
while not app_found:
    try:
        focus.application('anaconda')
        app_found=True
    except FocusError:
        print "anaconda not found! Sleeping and retry."
        time.sleep(5)

# 1st screen - welcome
click("Next")

# 2nd screen - installation number
click("Skip entering Installation Number")
click("OK")

# 2nd screen - skip installation number warning
focus.button("Skip")
focus.widget.click()

# 3rd screen - install or upgrade
time.sleep(10) # sleep the Searching for previous installations progress
cl = tree.root.findChildren(predicate.GenericPredicate(roleName='radio button'), True)
print "Radio Buttons Install or Upgrade:", str(cl)
if (cl != None) and (cl != []):
    click("Next")

# 3rd screen - partitioning
# an error message about partitions appeared
try:
    focus.button("OK")
    if focus.widget != None:
	focus.widget.click()
except:
    pass

time.sleep(5)
try:
    focus.button("Next")
    focus.widget.click()
except:
    pass

# 3rd screen - erase all data warning
click("Yes")

# 4th screen - network settings
click("Next")

# 5th screen - timezone
click("Next")

# 6th screen - root password
for pf in tree.root.findChildren(predicate.GenericPredicate(name=None, roleName='password text'), True):
    pf.text = 'redhat'
click("Next")

# 7th screen - default packages selection
time.sleep(10)
# these two are table cells without names, not check boxes
#click("Office")
#click("Multimedia")
click("Next")

# 8th screen - click next to install
print "sleeping dependency checking"
time.sleep(150) # sleep dependency checking
click("Next")

print "*** end of testcase.py ***"

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]