Exemplo n.º 1
0
 def start(self, slideshow=None):
     """ start imagination, returns its root dogtail object """
     app = os.environ.get(
         "IMAGINATION",
         str(Path(__file__).parent.parent / "src" / "imagination"))
     cmd = app
     if slideshow:
         cmd += " " + str(slideshow)
     print("launching", cmd)
     run(cmd, timeout=4)
     self.imagination = root.application("imagination")
Exemplo n.º 2
0
def start_galicaster():

    global galicaster
    global root, predicate

    import gi
    gi.require_version('Atspi', '2.0')
    gi.require_version('Wnck', '3.0')
    from dogtail.tree import root, predicate

    pid = is_running('run_galicaster')
    if pid:
        execute(['kill',str(pid)])
    run('python run_galicaster.py')
    galicaster = root.application('run_galicaster.py')
Exemplo n.º 3
0
def start_galicaster():

    global galicaster
    global root, predicate

    import gi
    gi.require_version('Atspi', '2.0')
    gi.require_version('Wnck', '3.0')
    from dogtail.tree import root, predicate

    pid = is_running('run_galicaster')
    if pid:
        execute(['kill', str(pid)])
    run('python run_galicaster.py')
    galicaster = root.application('run_galicaster.py')
def setup_function(module):
    config.searchCutoffCount = 2
    config.defaultDelay = 1.5
    config.blinkOnActions = True
    config.fatalErrors = True
    module.pidgin_pid = run('pidgin -c ./base_purple')
    module.pidgin = root.application('Pidgin')
Exemplo n.º 5
0
def fileCopy(file1toOpen, file2toOpen):

    # Start gedit with two txt files.
    run('gedit /root/workspace/Functional_Auto/data/'+file2toOpen)
    run('gedit /root/workspace/Functional_Auto/data/'+file1toOpen)

    # get the handle of gedit app
    gedit = tree.root.application('gedit')

    # find 'File' menu
    file = gedit.findChildren(GenericPredicate(name='File',roleName='menu'))[-1]

    # find 'Edit' menu
    edit = gedit.findChildren(GenericPredicate(name='Edit',roleName='menu'))[-1]

    # find 'Documents' menu
    doc = gedit.findChildren(GenericPredicate(name='Documents',roleName='menu'))[-1]

    # Click on edit
    edit.doAction('click')

    # In Edit menu, find 'Select All' menu item and click
    selectall = edit.findChildren(GenericPredicate(name='Select All'))[-1]
    selectall.doAction('click')

    # In Edit menu, find 'Copy' menu item and click
    edit.doAction('click')
    copy = edit.findChildren(GenericPredicate(name='Copy'))[-1]
    copy.doAction('click')

    # In Documents menu, find file name check menu item and click
    doc.doAction('click')
    checkfilemenu = doc.findChildren(GenericPredicate(name=file2toOpen,roleName='check menu item'))[-1]
    checkfilemenu.doAction('click')

    # Paste in file 2
    edit.doAction('click')
    paste = edit.findChildren(GenericPredicate(name='Paste'))[-1]
    paste.doAction('click')

    # Click Save and Close the gedit
    file.doAction('click')
    save = file.findChildren(GenericPredicate(name='Save'))[-1]
    save.doAction('click')

    quit = file.findChildren(GenericPredicate(name='Quit'))[-1]
    quit.doAction('click')
Exemplo n.º 6
0
    def setUp(self):
        # Force the locale/language to English.
        # Otherwise we won't be able to grab the right widgets.
        os.environ["LC_ALL"] = 'C'
        # Try to speed up UI interaction a little.
        # Do not change "typingDelay" from its default (0.075 secs);
        # Setting it too low makes dogtail type characters in random order!
        from dogtail.config import config
        config.load({'actionDelay': 0.1,
                     'runTimeout': 1,
                     'searchCutoffCount': 5,
                     'defaultDelay': 0.1})
        from dogtail.utils import run
        from dogtail.tree import root
        # Setting appName is critically important here.
        # Otherwise it will try to look for "bin/pitivi" through AT-SPI and fail,
        # making the tests take ages to start up.
        self.pid = run('bin/pitivi', dumb=False, appName="pitivi")
        # Apparently, if we start inspecting "too fast"... we slow down startup.
        # With GNOME 3.6, startup would be delayed to the point where the "Esc"
        # keypress to dismiss the welcome dialog would happen too soon.
        sleep(1)

        self.pitivi = root.application('pitivi')
        timer_start = time()
        # This is a performance hack to very quickly get the widgets we want,
        # by using their known position instead of searching.
        # Reuse those variables throughout your scripts for efficient access.
        # FIXME: this will probably break with detached tabs.
        mainwindow = self.pitivi.children[0].children[0]  # this is a vbox
        mainwindow_upper = mainwindow.children[2].child(name="upper half", recursive=False)
        timeline_area = mainwindow.children[2].child(name="timeline area", recursive=False)
        primary_tabs = mainwindow_upper.children[0].child(name="primary tabs", recursive=False)
        secondary_tabs = mainwindow_upper.children[0].child(name="secondary tabs", recursive=False)
        # These are the "shortcut" variables you can use for better perfs:
        self.menubar = mainwindow.child(roleName='menu bar')
        self.medialibrary = primary_tabs.children[0]
        self.effectslibrary = primary_tabs.children[1]
        self.clipproperties = secondary_tabs.children[0]
        self.transitions = secondary_tabs.children[0]
        self.titles = secondary_tabs.children[0]
        self.viewer = mainwindow_upper.child(name="viewer", recursive=False)
        self.zoom_best_fit_button = timeline_area.child(name="Zoom", recursive=True)
        self.timeline = timeline_area.child(name="timeline canvas", recursive=False)
        self.timeline_toolbar = timeline_area.child(name="timeline toolbar", recursive=False)
        # Used to speed up helper_functions in particular:
        self.import_button = self.medialibrary.child(name="media_import_button")
        self.insert_button = self.medialibrary.child(name="media_insert_button")
        start_time = time() - timer_start
        if start_time > 0.1:
            # When we were simply searching the toplevel for the menu bar,
            # startup time was 0.0043 seconds. Anything significantly longer
            # means there are optimizations to be done, avoid recursive searches
            print "\nWARNING: setUp in test_base took", start_time, "seconds, that's too slow.\n"
        try:
            self.unlink
        except AttributeError:
            self.unlink = []
Exemplo n.º 7
0
    def startViaCommand(self):
        """
        Start the app via command
        """
        if self.forceKill and self.isRunning():
            self.kill()
            assert not self.isRunning(), "Application cannot be stopped"

        command = "%s %s" % (self.appCommand, self.parameters)
        self.pid = run(command, timeout=1)

        assert self.isRunning(), "Application failed to start"
        return root.application(self.a11yAppName)
Exemplo n.º 8
0
    def startViaCommand(self):
        """
        Start the app via command
        """
        if self.forceKill and self.isRunning():
            self.kill()
            assert not self.isRunning(), "Application cannot be stopped"

        command = "%s %s" % (self.appCommand, self.parameters)
        self.pid = run(command, timeout=10)

        assert self.isRunning(), "Application failed to start"
        return root.application(self.a11yAppName)
Exemplo n.º 9
0
    def test00Basic(self):
        """Run the GUI and click Quit"""
        from dogtail import tree
        from dogtail.tree import SearchError
        from dogtail.utils import run
        from time import sleep
        from os import environ, path, remove
        environ['LANG'] = 'en_US.UTF-8'
        os.chdir("../..")
        run("./netconf.py -d -r %s" % CHROOT)
        scn = None
        appname = None
        for str in ["netconf.py", "scn", "system-config-network"]:
            try:
                scn = tree.root.application(str)
                appname = str
            except SearchError:
                pass

            if scn:
                break
        else:
            self.fail()

        maindialog = scn.window('Network Configuration')
        line_eth0 = maindialog.child(roleName='table cell', name='eth0')
        line_eth0.rawClick()
        scn.button("Edit").click()
        ethernetdialog = scn.dialog('Ethernet Device')
        ethernetdialog.button("OK").click()
        #scn.menuItem('Save').click()
        scn.menuItem('Quit').click()
        scn.child(roleName="alert", recursive=False,
                  name="Question").button("Yes").click()
        scn.child(roleName="alert", recursive=False,
                  name="Information").button("OK").click()
Exemplo n.º 10
0
def test_unit_converter():
    """Dogtail integration test: Unit converter plugin behaves as intended."""

    cmd = "gourmet"

    pid = run(cmd, timeout=3)
    gourmet = None

    for app in tree.root.applications():
        if app.get_process_id() == pid:
            gourmet = app
            break

    assert gourmet is not None, "Could not find Gourmet instance!"

    # Open the unit converter plugin
    procedural.keyCombo("<Alt>T")
    procedural.keyCombo("U")
    procedural.focus.window("Unit Converter")

    # Enter source amount and unit (5 liters)
    procedural.keyCombo("<Alt>A")
    procedural.type("5")
    procedural.keyCombo("<Alt>U")
    procedural.keyCombo("<Enter>")
    procedural.click("liter (l)")

    # Enter target unit (ml)
    procedural.keyCombo("<Alt>U")
    procedural.keyCombo("<Enter>")
    procedural.keyCombo("Right")
    for _ in range(7):
        procedural.keyCombo("Down")
    procedural.keyCombo("<Enter>")

    # Check that the result is shown correctly
    assert procedural.focus.widget(name="5 l = 5000 ml", roleName="label")

    # There are now two windows, the unit converter, and main window
    # Close them successively to quit the application
    procedural.keyCombo("<Alt><F4>")
    procedural.keyCombo("<Alt><F4>")
Exemplo n.º 11
0
    def setUp(self):
        # Force the locale/language to English.
        # Otherwise we won't be able to grab the right widgets.
        os.environ["LC_ALL"] = "C"
        # Try to speed up UI interaction a little
        from dogtail.config import config

        config.load(
            {"actionDelay": 0.1, "typingDelay": 0.02, "runTimeout": 1, "searchCutoffCount": 5, "defaultDelay": 0.1}
        )
        from dogtail.utils import run
        from dogtail.tree import root

        # Setting appName is critically important here.
        # Otherwise it will try to look for "bin/pitivi" through AT-SPI and fail,
        # making the tests take ages to start up.
        self.pid = run("bin/pitivi", dumb=False, appName="pitivi")
        self.pitivi = root.application("pitivi")
        self.menubar = self.pitivi.get_child()(roleName="menu bar")
        try:
            self.unlink
        except AttributeError:
            self.unlink = []
 def setUp(self):
     from dogtail import utils
     self.pid = utils.run('gtk3-demo')
     self.app = procedural.focus.application('gtk3-demo')
os.system('touch RUNNING')
try:
    from dogtail import logging, predicate, rawinput, tree, utils

    # Roles
    ROLE_FILLER = "filler"
    ROLE_FRAME = "frame"
    ROLE_LABEL = "label"
    ROLE_MENU_ITEM = "menu item"
    ROLE_PANEL = "panel"
    ROLE_PUSH_BUTTON = "push button"
    ROLE_TOGGLE_BUTTON = "toggle button"
    ROLE_WINDOW = "window"

    # start gnome-tweaks
    utils.run("gnome-tweaks")

    # click on Extensions label
    tweaks_node = tree.root.application("gnome-tweaks")
    tweaks_node \
        .child(name="Extensions", roleName=ROLE_LABEL) \
        .click()

    # enable applet
    applet_text_node = tweaks_node.child(name="System-monitor",
                                         roleName=ROLE_LABEL)
    toggle_button_node = applet_text_node \
        .findAncestor(predicate.GenericPredicate(roleName=ROLE_FILLER)) \
        .findAncestor(predicate.GenericPredicate(roleName=ROLE_FILLER)) \
        .child(roleName=ROLE_TOGGLE_BUTTON)
    if not toggle_button_node.isChecked:
Exemplo n.º 14
0
    def setUp(self):
        # Force the locale/language to English.
        # Otherwise we won't be able to grab the right widgets.
        os.environ["LC_ALL"] = 'C'
        # Try to speed up UI interaction a little.
        # Do not change "typingDelay" from its default (0.075 secs);
        # Setting it too low makes dogtail type characters in random order!
        from dogtail.config import config
        config.load({'actionDelay': 0.1,
                     'runTimeout': 1,
                     'searchCutoffCount': 5,
                     'defaultDelay': 0.1})
        # Specify custom xdg user dirs to not be influenced by the settings
        # chosen by the current user.
        if not hasattr(self, "user_dir"):
            self.user_dir = tempfile.mkdtemp()
            os.environ["PITIVI_USER_CONFIG_DIR"] = os.path.pathsep.join([self.user_dir, "config"])
            os.environ["PITIVI_USER_DATA_DIR"] = os.path.pathsep.join([self.user_dir, "data"])
            os.environ["PITIVI_USER_CACHE_DIR"] = os.path.pathsep.join([self.user_dir, "cache"])
        from dogtail.utils import run
        from dogtail.tree import root
        # Setting appName is critically important here.
        # Otherwise it will try to look for "bin/pitivi" through AT-SPI and fail,
        # making the tests take ages to start up.
        self.pid = run('bin/pitivi', dumb=False, appName="pitivi")
        # Apparently, if we start inspecting "too fast"... we slow down startup.
        # With GNOME 3.6, startup would be delayed to the point where the "Esc"
        # keypress to dismiss the welcome dialog would happen too soon.
        time.sleep(1)

        self.pitivi = root.application('pitivi')
        timer_start = time.time()
        # This is a performance hack to very quickly get the widgets we want,
        # by using their known position instead of searching.
        # Reuse those variables throughout your scripts for efficient access.
        mainwindow = self.pitivi.children[0]
        self.assertEqual('main window', mainwindow.name)
        headerbar, contents = mainwindow.children

        # Headerbar
        self.main_menu_button = headerbar.children[5]
        self.assertEqual("main menu button", self.main_menu_button.name)

        # Content below the headerbar.
        self.assertEqual('contents', contents.name)
        upper_half, timeline_area = contents.children
        self.assertEqual('upper half', upper_half.name)
        self.assertEqual('timeline area', timeline_area.name)

        # Tabs
        primary_tabs = upper_half.children[0].child(name="primary tabs", recursive=False)
        secondary_tabs = upper_half.children[0].child(name="secondary tabs", recursive=False)
        self.medialibrary = primary_tabs.children[0]
        self.effectslibrary = primary_tabs.children[1]
        self.clipproperties = secondary_tabs.children[0]
        self.transitions = secondary_tabs.children[1]
        self.titles = secondary_tabs.children[2]
        self.viewer = upper_half.child(name="viewer", recursive=False)
        self.import_button = self.medialibrary.child(name="media_import_button")
        self.insert_button = self.medialibrary.child(name="media_insert_button")

        # Timeline area
        self.zoom_best_fit_button = timeline_area.child(name="Zoom", recursive=True)
        self.timeline = timeline_area.child(name="timeline canvas", recursive=False)
        self.timeline_toolbar = timeline_area.child(name="timeline toolbar", recursive=False)

        start_time = time.time() - timer_start
        if start_time > 0.1:
            # When we were simply searching the toplevel for the menu bar,
            # startup time was 0.0043 seconds. Anything significantly longer
            # means there are optimizations to be done, avoid recursive searches
            print("\nWARNING: setUp in test_base took", start_time, "seconds, that's too slow.\n")
        try:
            self.unlink
        except AttributeError:
            self.unlink = []
#!/usr/bin/env python

from dogtail.tree import *
from dogtail.utils import run

run('bin/alexandria', appName='alexandria')
app = root.application('alexandria')
quit_item = app.menuItem('Quit')
quit_item.doActionNamed('click')
Exemplo n.º 16
0
    os.path.pardir,
    'bin'
) + os.path.pathsep + os.environ['PATH']

config.config.typingDelay = 0.025

t = tempfile.NamedTemporaryFile()
t.write("""
2015-10-05 * beer
    Assets:Cash                       -30 CHF
    Expenses:Drinking                  30 CHF
""")
t.flush()
t.seek(0, 0)

run('addtrans --file %s' % pipes.quote(t.name))
addtrans = tree.root.application('addtrans')
mainwin = addtrans.window('Add transaction')

try:
    type("wine")
    pressKey("Tab")
    type("30")
    pressKey("Tab")
    type("Expenses:Drinking")
    pressKey("Tab")
    pressKey("Tab")
    type("Assets:Cash")
    pressKey("Tab")

    expected = """
Exemplo n.º 17
0
 def setUp(self): #*@ \label{dogtailminimal:setup} @*
     from dogtail import utils #*@ \label{dogtailminimal:utilsimport} @*
     self.pid = utils.run('gtk3-demo') #*@ \label{dogtailminimal:utilsrun} @*
     self.app = tree.root.application('gtk3-demo') #*@ \label{dogtailminimal:focusapp} @*
Exemplo n.º 18
0
#!/usr/bin/env python
# Stress test: repeatedly open and close the filechooser dialog

from dogtail.tree import *
from dogtail.utils import run
from sys import exit

run('gedit')

gedit = root.application('gedit')

while True:
    try:
        gedit.child('Open').click()
    except SearchError:  #toolbar not present?
        gedit.child('Open...').click()

    try:
        filechooser = gedit.child(name='Open Files', roleName='file chooser')
        filechooser.childNamed('Cancel').click()
    except SearchError:
        print('File chooser did not open')
        exit(1)
Exemplo n.º 19
0
# FIXME: Use TC.
__author__ = 'Zack Cerza <*****@*****.**'

from dogtail import tree
from dogtail.utils import run
from dogtail.predicate import GenericPredicate
from time import sleep
from os import environ, path, remove
environ['LANG']='en_US.UTF-8'

# Remove the output file, if it's still there from a previous run
if path.isfile(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt")):
    remove(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt"))

# Start gedit.
run("gedit")

# Get a handle to gedit's application object.
gedit = tree.root.application('gedit')

# Get a handle to gedit's text object.
# Last text object is the gedit's text field
textbuffer = gedit.findChildren(GenericPredicate(roleName='text'))[-1]

# This will work only if 'File Browser panel' plugin is disabled
#textbuffer = gedit.child(roleName = 'text')

# Load the UTF-8 demo file.
from sys import path
utfdemo = open(path[0] + '/data/UTF-8-demo.txt', 'r')
Exemplo n.º 20
0
# FIXME: Use TC.
__author__ = 'Zack Cerza <*****@*****.**'

from dogtail import tree
from dogtail.utils import run
from dogtail.predicate import GenericPredicate
from time import sleep
from os import environ, path, remove
environ['LANG'] = 'en_US.UTF-8'

# Remove the output file, if it's still there from a previous run
if path.isfile(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt")):
    remove(path.join(path.expandvars("$HOME"), "Desktop", "UTF8demo.txt"))

# Start gedit.
run("gedit")

# Get a handle to gedit's application object.
gedit = tree.root.application('gedit')

# Get a handle to gedit's text object.
# Last text object is the gedit's text field
textbuffer = gedit.findChildren(GenericPredicate(roleName='text'))[-1]

# This will work only if 'File Browser panel' plugin is disabled
#textbuffer = gedit.child(roleName = 'text')

# Load the UTF-8 demo file.
from sys import path
utfdemo = file(path[0] + '/data/UTF-8-demo.txt')
Exemplo n.º 21
0
    def setUp(self):
        # Force the locale/language to English.
        # Otherwise we won't be able to grab the right widgets.
        os.environ["LC_ALL"] = 'C'
        # Try to speed up UI interaction a little.
        # Do not change "typingDelay" from its default (0.075 secs);
        # Setting it too low makes dogtail type characters in random order!
        from dogtail.config import config
        config.load({
            'actionDelay': 0.1,
            'runTimeout': 1,
            'searchCutoffCount': 5,
            'defaultDelay': 0.1
        })
        # Specify custom xdg user dirs to not be influenced by the settings
        # chosen by the current user.
        if not hasattr(self, "user_dir"):
            self.user_dir = tempfile.mkdtemp()
            os.environ["PITIVI_USER_CONFIG_DIR"] = os.path.pathsep.join(
                [self.user_dir, "config"])
            os.environ["PITIVI_USER_DATA_DIR"] = os.path.pathsep.join(
                [self.user_dir, "data"])
            os.environ["PITIVI_USER_CACHE_DIR"] = os.path.pathsep.join(
                [self.user_dir, "cache"])
        from dogtail.utils import run
        from dogtail.tree import root
        # Setting appName is critically important here.
        # Otherwise it will try to look for "bin/pitivi" through AT-SPI and fail,
        # making the tests take ages to start up.
        self.pid = run('bin/pitivi', dumb=False, appName="pitivi")
        # Apparently, if we start inspecting "too fast"... we slow down startup.
        # With GNOME 3.6, startup would be delayed to the point where the "Esc"
        # keypress to dismiss the welcome dialog would happen too soon.
        time.sleep(1)

        self.pitivi = root.application('pitivi')
        timer_start = time.time()
        # This is a performance hack to very quickly get the widgets we want,
        # by using their known position instead of searching.
        # Reuse those variables throughout your scripts for efficient access.
        mainwindow = self.pitivi.children[0]
        self.assertEqual('main window', mainwindow.name)
        headerbar, contents = mainwindow.children

        # Headerbar
        self.main_menu_button = headerbar.children[5]
        self.assertEqual("main menu button", self.main_menu_button.name)

        # Content below the headerbar.
        self.assertEqual('contents', contents.name)
        upper_half, timeline_area = contents.children
        self.assertEqual('upper half', upper_half.name)
        self.assertEqual('timeline area', timeline_area.name)

        # Tabs
        primary_tabs = upper_half.children[0].child(name="primary tabs",
                                                    recursive=False)
        secondary_tabs = upper_half.children[0].child(name="secondary tabs",
                                                      recursive=False)
        self.medialibrary = primary_tabs.children[0]
        self.effectslibrary = primary_tabs.children[1]
        self.clipproperties = secondary_tabs.children[0]
        self.transitions = secondary_tabs.children[1]
        self.titles = secondary_tabs.children[2]
        self.viewer = upper_half.child(name="viewer", recursive=False)
        self.import_button = self.medialibrary.child(
            name="media_import_button")
        self.insert_button = self.medialibrary.child(
            name="media_insert_button")

        # Timeline area
        self.zoom_best_fit_button = timeline_area.child(name="Zoom",
                                                        recursive=True)
        self.timeline = timeline_area.child(name="timeline canvas",
                                            recursive=False)
        self.timeline_toolbar = timeline_area.child(name="timeline toolbar",
                                                    recursive=False)

        start_time = time.time() - timer_start
        if start_time > 0.1:
            # When we were simply searching the toplevel for the menu bar,
            # startup time was 0.0043 seconds. Anything significantly longer
            # means there are optimizations to be done, avoid recursive
            # searches
            print("\nWARNING: setUp in test_base took", start_time,
                  "seconds, that's too slow.\n")
        try:
            self.unlink
        except AttributeError:
            self.unlink = []
Exemplo n.º 22
0
#!/usr/bin/env python
# Stress test: repeatedly open and close the filechooser dialog

from dogtail.tree import *
from dogtail.utils import run
from sys import exit

run('gedit')

gedit = root.application('gedit')

while True:
    try:
        gedit.child('Open').click()
    except SearchError: #toolbar not present?
        gedit.child('Open...').click() 

    try:
        filechooser = gedit.child(name='Open Files', roleName='file chooser')
        filechooser.childNamed('Cancel').click()
    except SearchError:
        print('File chooser did not open')
        exit(1)
Exemplo n.º 23
0
 def setUp(self):
     config.logDebugToStdOut = True
     config.logDebugToFile = False
     # Next line may take some time to run - about 40 sec.
     self.pid = run('./coala-gui')
     self.app = dogtail.tree.root.application('coala-gui')
Exemplo n.º 24
0
    def setUp(self):
        # Force the locale/language to English.
        # Otherwise we won't be able to grab the right widgets.
        os.environ["LC_ALL"] = 'C'
        # Try to speed up UI interaction a little.
        # Do not change "typingDelay" from its default (0.075 secs);
        # Setting it too low makes dogtail type characters in random order!
        from dogtail.config import config
        config.load({
            'actionDelay': 0.1,
            'runTimeout': 1,
            'searchCutoffCount': 5,
            'defaultDelay': 0.1
        })
        from dogtail.utils import run
        from dogtail.tree import root
        # Setting appName is critically important here.
        # Otherwise it will try to look for "bin/pitivi" through AT-SPI and fail,
        # making the tests take ages to start up.
        self.pid = run('bin/pitivi', dumb=False, appName="pitivi")
        # Apparently, if we start inspecting "too fast"... we slow down startup.
        # With GNOME 3.6, startup would be delayed to the point where the "Esc"
        # keypress to dismiss the welcome dialog would happen too soon.
        sleep(1)

        self.pitivi = root.application('pitivi')
        timer_start = time()
        # This is a performance hack to very quickly get the widgets we want,
        # by using their known position instead of searching.
        # Reuse those variables throughout your scripts for efficient access.
        # FIXME: this will probably break with detached tabs.
        mainwindow = self.pitivi.children[0].children[0]  # this is a vbox
        mainwindow_upper = mainwindow.children[2].child(name="upper half",
                                                        recursive=False)
        mainwindow_lower = mainwindow.children[2].child(name="lower half",
                                                        recursive=False)
        primary_tabs = mainwindow_upper.children[0].child(name="primary tabs",
                                                          recursive=False)
        secondary_tabs = mainwindow_upper.children[0].child(
            name="secondary tabs", recursive=False)
        # These are the "shortcut" variables you can use for better perfs:
        self.menubar = mainwindow.child(roleName='menu bar')
        self.medialibrary = primary_tabs.children[0]
        self.effectslibrary = primary_tabs.children[1]
        self.clipproperties = secondary_tabs.children[0]
        self.transitions = secondary_tabs.children[0]
        self.titles = secondary_tabs.children[0]
        self.viewer = mainwindow_upper.child(name="viewer", recursive=False)
        self.timeline = mainwindow_lower.children[0].children[1].child(
            name="timeline canvas", recursive=False)
        self.timeline_toolbar = mainwindow_lower.child(name="timeline toolbar",
                                                       recursive=False)
        # Used to speed up helper_functions in particular:
        self.import_button = self.medialibrary.child(
            name="media_import_button")
        self.insert_button = self.medialibrary.child(
            name="media_insert_button")
        start_time = time() - timer_start
        if start_time > 0.1:
            # When we were simply searching the toplevel for the menu bar,
            # startup time was 0.0043 seconds. Anything significantly longer
            # means there are optimizations to be done, avoid recursive searches
            print "\nWARNING: setUp in test_base took", start_time, "seconds, that's too slow.\n"
        try:
            self.unlink
        except AttributeError:
            self.unlink = []
Exemplo n.º 25
0
def startgui(context):
    context.dagui_pid = utils.run(context.dagui_scriptpath,
                                  appName=context.dagui_scriptname)
    context.dagui_root = tree.root.application(context.dagui_scriptname)
Exemplo n.º 26
0
def startgui(context):
    context.dagui_pid = utils.run(context.dagui_scriptpath, appName=context.dagui_scriptname)
    context.dagui_root = tree.root.application(context.dagui_scriptname)
Exemplo n.º 27
0
def step_impl(context):
    context.app_id = run(context.binary, timeout=1)
    try:
        context.app = tree.root.application('cribar')
    except tree.SearchError:
        assert False, 'Cannot find the application'
Exemplo n.º 28
0
def when_the_application_is_started(step):
    run('../scripts/mysterymachine_wx')
 def run(self, *args, **kwargs):
     utils.run("liveinst %(anacondaArgs)s")
     unittest.TestSuite.run(self, *args, **kwargs)
#!/usr/bin/env python

from dogtail.tree import *
from dogtail.utils import run

run('bin/alexandria', appName = 'alexandria')
app = root.application('alexandria')
quit_item = app.menuItem('Quit')
quit_item.doActionNamed('click')