def kde_common_before_all(context): common_before_all(context) # Start ksnapshot for screenshots os.system("kstart -iconify ksnapshot") # Record video via recordmydesktop os.system("rm -rf /tmp/screencast.ogv") master, slave = pty.openpty() cmd = "recordmydesktop --no-sound --on-the-fly-encoding -o /tmp/screencast.ogv" p = Popen(cmd, shell=True, stdin=PIPE, stdout=slave, stderr=slave, close_fds=True) context.recordvideo_stdout = os.fdopen(master) if isA11yEnabled() is False: print("Enabling a11y") enableA11y(True) if isA11yEnabled() is False: sleep(5) print("Warning: second attempt to enable a11y") enableA11y(True) # Wait for ksplash to dissappear wait_for_kde_splash_to_dissapear()
# -*- coding: UTF-8 -*- from dogtail.utils import isA11yEnabled, enableA11y if isA11yEnabled() is False: enableA11y(True) from time import time, sleep from functools import wraps from os import strerror, errno, system from signal import signal, alarm, SIGALRM from subprocess import Popen, PIPE from behave import step from gi.repository import GLib, Gio import fcntl, os from dogtail.rawinput import keyCombo, absoluteMotion, pressKey from dogtail.tree import root from unittest import TestCase # Create a dummy unittest class to have nice assertions class dummy(TestCase): def runTest(self): # pylint: disable=R0201 assert True def wait_until(my_lambda, element, timeout=30, period=0.25): """ This function keeps running lambda with specified params until the result is True or timeout is reached Sample usages: * wait_until(lambda x: x.name != 'Loading...', context.app)
# -*- coding: UTF-8 -*- from time import sleep from dogtail.utils import isA11yEnabled, enableA11y if not isA11yEnabled(): enableA11y(True) from common_steps import App, cleanup from dogtail.config import config from os import system, makedirs from shutil import copyfile def before_all(context): """Setup xviewer stuff Being executed before all features """ try: # Skip dogtail actions to print to stdout config.logDebugToStdOut = False config.typingDelay = 0.2 context.app_class = App('xviewer') context.screenshot_counter = 0 context.save_screenshots = False except Exception as e: print("Error in before_all: %s" % e.message)
initializes with the display of remote-viewer you want control over. remote.open() - opens or verifies the display is open remote.raise_window() - grab focus on the remote-viewers drawing area. """ import os import sys import logging import platform import time import subprocess from dogtail import utils utils.enableA11y() from dogtail import tree from dogtail import predicate from dogtail import rawinput sys.path.append(os.path.join(os.path.dirname(__file__), "lib")) import retries logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) class GeneralError(Exception): pass
----- Prior to running the rv interaction commands run the following calls: remote = RemoteViewer() initializes with the display of remote-viewer you want control over. remote.open() - opens or verifies the display is open remote.raise_window() - grab focus on the remote-viewers drawing area. """ import os import sys import logging from dogtail import utils utils.enableA11y() from dogtail import tree from dogtail import predicate from dogtail import rawinput import platform import time import commands sys.path.append(os.path.join(os.path.dirname(__file__), "lib")) import retries logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) class GeneralError(Exception):