示例#1
0
    def exportPdfCheck(self, panelsPerPage):
        log('## exportPdfCheck')

        # Assuming 5sec + 1sec/panel is enough to generate the PDF
        timeout = 5 + self.export.testInfo.getNumberPanelsFromShotEdit()

        pdfFile = "%s/%s_%s_%s_%s_%s.pdf" % (self.export.pdfDir,
                                             self.export.testInfo.show,
                                             self.export.testInfo.sequence,
                                             self.export.testInfo.getEditVersion(),
                                             self.export.testInfo.currentBranch,
                                             panelsPerPage)

        sikuli.wait(timeout)
        if not os.path.exists(pdfFile):
            self.export.testInfo.failed('exportPdfCheck: PDF was not generated in %s.' % self.export.pdfDir)
        else:
            log('- Found generated PDF.')
            sikuliUtils.closeChromeTab()

        if not checkUtils.popupCheck(self.export.testInfo, 5, "exportPdfCheck"):
            self.export.testInfo.failed('exportPdfCheck: Plugin failed, '
                                        'check log for errors. Exiting current checks...')

        log('All checks performed for exportPdf.')
def openFwBackup(source_filename, mywait=60):
    """
    Usage: flex_helper.openFwBackup("Kamasau 2015-07-07 1036 for testing purposes.fwbackup")
    or flex_helper.openFwBackup("Kamasau 2015-07-07 1036 for testing purposes.fwbackup", 25)
    """
    source_path = os.path.join(_getProjectsFolder(), source_filename)
    with zipfile.ZipFile(source_path) as zf:
        for file in zf.namelist():
            if file[-7:] == ".fwdata":
                dest = os.path.join(os.path.normpath(flexProjectsFolder),
                                    str(file[:-7]))
                fwdataFile = file

        ###start zf.extractall(dest) workaround ###
        ###modified from sikuli.jar/Lib/zipfile.py[1041-1081]###
        for member in zf.infolist():
            arcname = str(member.filename).replace('/', os.path.sep)
            if os.path.altsep:
                arcname = arcname.replace(os.path.altsep, os.path.sep)
            # interpret absolute pathname as relative, remove drive letter or
            # UNC path, redundant separators, "." and ".." components.
            arcname = os.path.splitdrive(arcname)[1]
            arcname = os.path.sep.join(x for x in arcname.split(os.path.sep)
                                       if x not in ('', os.path.curdir,
                                                    os.path.pardir))
            if os.path.sep == '\\':
                # filter illegal characters on Windows
                illegal = ':<>|"?*'
                table = string.maketrans(illegal, '_' * len(illegal))
                arcname = arcname.translate(table)
                # remove trailing dots
                arcname = (x.rstrip('.') for x in arcname.split(os.path.sep))
                arcname = os.path.sep.join(x for x in arcname if x)

            targetpath = os.path.join(dest, arcname)
            targetpath = os.path.normpath(targetpath)

            # Create all upper directories if necessary.
            upperdirs = os.path.dirname(targetpath)
            if upperdirs and not os.path.exists(upperdirs):
                os.makedirs(upperdirs)

            if str(member.filename)[-1] == '/':
                if not os.path.isdir(targetpath):
                    os.mkdir(targetpath)
                return targetpath

            #with zf.open(member) as source, \
            #     file(targetpath, "wb") as target:
            #    shutil.copyfileobj(source, target)

            source = zf.open(str(member.filename))
            newdest = os.path.join(dest,
                                   os.path.normpath(str(member.filename)))
            target = open(newdest, "wb")
            shutil.copyfileobj(source, target)
        ###end extractall workaround###

    sikuli.wait(mywait)
    openFwData(os.path.join(dest, fwdataFile))
示例#3
0
def switchPlugin(pluginGroup, image):
    """Switches the plugin from its default to the specified one and returns plugin location on screen.

    pluginGroup -- The group to which the plugin belongs to ('editing', 'editorial', 'pdf' or 'export')
    image -- PNG image corresponding to the plugin
    """
    pluginGroupImage = pluginGroup + '_default.png'
    # If the plugin isn't default any more, reload Flix to have all plugins reset to default.
    if not exists(pluginGroupImage, 3):
        if reloadFlix(pluginGroupImage) == 0:
            log('Could not find %s for the %s plugin group.' % (pluginGroupImage, pluginGroup), 'error')
            return 0

    # hover(pluginGroupImage)
    # pluginLocation = sikuli.Env.getMouseLocation()
    # mouseDown(sikuli.Button.LEFT)
    # hover(image)
    # mouseUp(sikuli.Button.LEFT)

    hover(pluginGroupImage); wait(1) # wait for the tooltip to appear and go away
    pluginLocation = sikuli.Env.getMouseLocation()
    mouseDown(sikuli.Button.LEFT)
    # hover('projectBrowserBtn.PNG') # makes sure the tooltip isn't in the way
    click(image)

    return pluginLocation
示例#4
0
def deleteSeqOrEp(seqOrEp):

    # Removes the sequence/episode locally
    log('seqOrEp[dir]: %s' % seqOrEp['dir'])
    if os.path.exists(seqOrEp['dir']):
        log('Sequence directory exists!')
        while True:
            try:
                shutil.rmtree(seqOrEp['dir'])
                break
            except OSError:
                sikuli.popup('Could not delete sequence directory.\nClose any application that could be'
                             ' accessing files from the %s sequence directory and try again.' % seqOrEp['name'])

    # Removes the sequence/episode from the remote location
    if seqOrEp['remote'] == '1':
        sshUtils = '%sassets/ssh/' % seqOrEp['testPath']
        putty = '%sputty.exe' % sshUtils
        key = '%sivo.ppk' % sshUtils
        ssh = '[email protected]'
        script = '%s%s.sh' % (sshUtils, seqOrEp['name'])

        if os.path.exists(script):
            cmd = "\"%s\" -ssh -i \"%s\" %s -m \"%s\"" % (putty, key, ssh, script)
            log('PUTTY cmd:\n%s' % cmd.replace('/', '\\'), 'debug')

            subprocess.Popen(cmd.replace('/', '\\'), shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            # log('Deleting the sequence remotely...', 'debug')
            sikuli.App.focus('Google Chrome') # make sure the putty window is out of the way
            wait(3)
        else:
            log('deleteSeqOrEp: Could not find the script to remove %s.' % seqOrEp['name'], 'error')
示例#5
0
def openMayaFile(testInfo, mayaFile):

    path = '%sassets/fromMaya/%s' % (testInfo.testPath, mayaFile)

    if os.path.exists(path):
        pyUtils.revealFile(path); wait(2)
        sikuli.App.focus('fromMaya'); wait(.5)
        type(sikuli.Key.ENTER); wait(1)

        if not exists('mayaIcon.png', 30):
            log('openMayaFile: Could not find Maya open.', 'error')
            return

        closeExplorerWindow('fromMaya'); wait(1)

        sikuli.App.focus('Maya')

        wait(10) # make sure Maya's ready to do stuff

        # Make sure the Flix shelf is in focus
        if not exists('mayaFlixServer.png', 2):
            if click('mayaFlixShelf.png') == 0:
                log('openMayaFile: Could not find the Flix shelf in Maya; exiting.', 'error')
                return

    else:
        log('openMayaFile: %s does not exist, skipping.' % path, 'error')
示例#6
0
def waitUntilGone(image, timeout):
    """Method to wait until an image goes away (convenient for processing thumbnails)"""
    endTime = time.time() + timeout
    while True:
        if not exists(image):
            return 1
        elif time.time() > endTime:
            return 0
        else:
            wait(3)
示例#7
0
def saveVersion(testInfo, comment='Default comment'):
    """Saves a new version along with a comment"""
    # log('##### saveVersion')

    click('saveComment.png'); wait(1)
    paste(comment)

    click('saveEdit.png'); wait(1)

    testInfo.incrementEditVersion()
示例#8
0
    def exportPanels(self, settings, deletePoses=False):
        log('##### exportPanels')

        if not self.testInfo.getShotEdit():
            log("Cannot use an export plugin when no edit is saved for this sequence; exiting...", "error")
            return

        if self.testInfo.OS == "mac":
            log("exportPanels is only supported on Windows at the moment. Exiting...", "error")
            return

        if deletePoses:
            pyUtils.deleteLocalPoses(self.testInfo)

        if settings['format'] == 'jpeg':
            plugin = 'exportJpegs.png'
            outputPath = self.jpgOutputDir
        elif settings['format'] == 'psd':
            plugin = 'exportPsds.png'
            outputPath = self.psdOutputDir
        else:
            self.testInfo.failed('%s is not a valid format. Must be \'psd\' or \'jpeg\'.' % settings['format'])
            return

        if os.path.isdir(outputPath):
            shutil.rmtree(outputPath)
    
        os.makedirs(outputPath)
    
        if self.testInfo.flixVersion < '5.2':
            pluginLocation = sikuliUtils.switchPlugin('export', plugin)
    
        click(settings['panels'][0])
        if len(settings['panels']) != 1:
            for panel in settings['panels'][1:]:
                sikuliUtils.ctrlClick(panel)
    
        if self.testInfo.flixVersion < '5.2':
            click(pluginLocation)
        else:
            sikuliUtils.switchPlugin('export', plugin)
    
        if not exists('exportFileBrowser.png', 10):
            self.testInfo.failed('Could not find the File Browser.')
        click('exportFileBrowserFolder.png')
    
        type(outputPath.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)
        type(sikuli.Key.BACKSPACE)
        type(sikuli.Key.ENTER)
    
        self.exportCheck.exportPanelsCheck(settings)
    
        sikuliUtils.closeExplorerWindow('%ss' % settings['format'])
示例#9
0
    def __publishFromFlix(self, methodName, comment, checkMethod, windowName="fcp", importAAFs=False, createSgSeq=False):
        """Method that will select the specified editorial plugin, publish with a comment and call the relevant check
        method

        :param methodName: Name of the method calling me
        :param comment: Comment to add to the publish
        :param checkMethod: Method to call to check the publish results
        :param windowName: Name of the Explorer window Flix reveals after publishing
        :param importAAFs: Set to True to import AAFs after Avid publish (not relevant for other editorial publishes)
        :param createSgSeq: Set to True to create the Flix sequence in Shotgun (only relevant for Shotgun publish)
        :return: None
        """
        log("##### toEditorial: %s" % methodName)

        if methodName == "toShotgun" and createSgSeq:
            sikuliUtils.createShotgunSequence(self.testInfo)

        if self.testInfo.flixVersion < '5.2':
            click(sikuliUtils.switchPlugin('editorial', '%s.png' % methodName)); wait(1)
        else:
            sikuliUtils.switchPlugin('editorial', '%s.png' % methodName); wait(1)

        click('publishComment.png'); wait(1)

        type(comment); wait(1)
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.ENTER)

        # Assuming .5 sec/frame is enough to publish an edit to editorial
        # timeout = self.testInfo.getDurationFromShotEdit()/2
        # Assuming 2 sec/panel for stills and 1.5 sec/frame for animated panels is enough to publish an edit
        stillPanels = len(self.testInfo.editPanels["p"]) + len(self.testInfo.editPanels["s"])
        animPanels = self.testInfo.editPanels["a"]
        animFrames = 0
        for panel in animPanels:
            animFrames += self.testInfo.getPanelDurationFromShotEdit(panel)
        if methodName == "toAvid":
            stillTimeout = 2
            animFrameTimeout = 1.5
        else:
            stillTimeout = 0.5
            animFrameTimeout = 0.5
        timeout = int((stillTimeout*stillPanels) + (animFrameTimeout*animFrames))
        if timeout < 20:
            timeout = 20

        checkMethod(timeout)

        if methodName in ["toSbp", "toPremiere"]:
            sikuliUtils.closeExplorerWindow("%s" % windowName)
        elif importAAFs:
            self.launch.openEditorialGUI(10)
            self.editorialProjectBrowser.selectEditorialProject()
            self.__importToAvid()
示例#10
0
    def createNewPanels(self, n=3):
        """Creates n new panels using the New Button panel in Flix

        :param n: Number of new panels to be created
        :return: None
        """
        log('##### createNewPanels')

        for _ in range(0, n):
            click('newPanelBtn.png'); wait(2)

        self.editToolsCheck.createNewPanelsCheck(n)
示例#11
0
    def logIn(self, timeout):
        log('##### logIn')

        click('logInScreen.png'); wait(.5)

        type(sikuli.Key.TAB); wait(.5)
        type(self.testInfo.user); wait(1)
        type(sikuli.Key.TAB); wait(.5)
        type('latte'); wait(1)
        type(sikuli.Key.ENTER)

        self.launchCheck.launchFlixCheck(timeout)
示例#12
0
def waitUntilEmpty(dir, timeout):
    """Checks a directory every 5 sec until it's empty and returns 1

    dir -- Path to the directory to check
    timeout -- Time in seconds before force quitting the test
    """
    timeout += time.time()
    while True:
        if glob.glob('%s/*' % dir) == []:
            return 1
        elif time.time() > timeout:
            return 0
        else:
            wait(2)
示例#13
0
    def addDialogue(self, dialogue="Adding dialogue to panel [panelIndex].", firstPanel=1, lastPanel=3):
        """Adds dialogue to all of the panels currently in the sequence

        :param dialogue: String to add to every panel as the dialogue
        :param firstPanel: Panel index of first panel to add dialogue to
        :param lastPanel: Panel index of last panel to add dialogue to
        :return: None
        """
        log('##### addDialogue')

        panels = []
        for i in range(firstPanel, lastPanel+1):
            panels.append(i)
        log("addDialogue: Panel indices to add dialogue to: %s" % panels, "debug")
        url = "127.0.0.1:35980/html/index.html#show=%s;seq=%s;branch=%s;edit=%s;panel=%s" % \
              (self.testInfo.show,
               self.testInfo.sequence,
               self.testInfo.currentBranch,
               self.testInfo.getEditVersion(),
               panels[0])

        sikuliUtils.newChromeTab(url, closeCurrent=True); wait(5)

        click("dialogueField.png"); wait(1)
        for panel in panels:
            # Paste the dialogue (paste better than type as it keeps special characters)
            dial = dialogue.replace("[panelIndex]", str(panel))
            sikuli.paste(unicode(dial, "utf8")); wait(1)
            sikuli.type(sikuli.Key.ENTER, sikuli.KeyModifier.SHIFT); wait(1)

        self.editToolsCheck.addDialogueCheck(panels, dialogue)
示例#14
0
    def duplicatePanel(self, panel="panel1.png"):
        """Duplicate a panel, given the name of its screenshot

        :param panel: Name of the Sikuli screenshot associated with the panel to be copy/pasted
        :return: None
        """
        log('##### duplicatePanel')

        if not click(panel):
            log('duplicatePanel: Could not find %s on screen, exiting test.' % panel, 'error')
            return

        click('duplicateBtn.png'); wait(1)

        self.editToolsCheck.duplicatePanelCheck(panel)
示例#15
0
def closeCurrentApp():

    # type('q', sikuli.KeyModifier.CTRL); wait(3)
    ctrlType('q'); wait(3)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.ENTER); wait(2)

    sikuli.App.focus('Google Chrome'); wait(1)
示例#16
0
    def importToAvidCheck(self):
        """Checks the AAFs, ALE and marker.txt were imported correctly via the Flix Editorial GUI

        :return: None
        """
        log('## importToAvidCheck:')
    
        # Wait half a second per AAF to be imported
        wait((len(self.toEditorial.testInfo.avidPublished) - len(self.toEditorial.testInfo.avidImported))/2)

        self.__checkAafCopied()
        self.__checkAafImported()
        self.__checkAleImported()
        self.__checkMarkersCopied()

        log('All checks performed for importToAvid.')
示例#17
0
    def importPanels2(self, ext, nPanels=10):
        """Imports nPanels panels without checking image in Flix

        :param ext: extension of the files to import
        :param nPanels: Number of panels to import, 10 by default
        :return: None
        """
        log('##### importPanels2')

        if self.testInfo.OS == "mac":
            log("importPanels only supported on Windows right now. Using importDrawings instead...", "error")
            self.importDrawings(ext, nPanels)
            return

        availablePanels = self.__getAvailablePanels(ext)

        panelList = []
        while len(panelList) < nPanels:
            rest = nPanels - len(panelList)
            if rest > len(availablePanels):
                for panel in availablePanels:
                    panelList.append(panel)
            else:
                for panel in availablePanels[0:rest]:
                    panelList.append(panel)

        # Got to do it in chunks of 10 panels
        for i in range(0, len(panelList), 10):
            chunk = panelList[i:i+10]
            click('importDrawingsButton.png')

            if not exists('importFileBrowserFilename.png', 20):
                log('importPanels2: Could not find importFileBrowserFilename after 20 seconds.', 'error')
                return
            click('importFileBrowserFilename.png'); wait(1)

            if i == 0:
                type(self.importPath.replace('/', '\\')); wait(1)
                type(sikuli.Key.ENTER); wait(1)

            for panel in chunk:
                type("\"" + panel + "\" ")

            type(sikuli.Key.ENTER)
            # wait(len(chunk))

            # Wait until the 'processing' image for the first panel
            timeout = int((len(chunk) * 1.5))
            if ext == 'mov':
                timeout = 0
                for movie in chunk:
                    timeout += pyUtils.readMovSettings(self.testInfo, movie)['timeout']
            log('importPanels2: timeout set to %ssec.' % timeout, 'debug')
            wait(timeout)

        self.importDrawingCheck.importPanels2Check(ext, nPanels, panelList)
示例#18
0
def waitForFile(path, token, timeout):
    """Checks if a file was created in a directory and returns its path

    path -- Directory in which the file is meant to be created
    token -- String that clearly identifies the name of the file to be created
    timeout -- Time in seconds before force quitting the test
    """
    #startTime = time.time()
    timeout += time.time()
    while True:
        if not glob.glob("%s/%s" % (path, token)) == []:
            f = glob.glob("%s/%s" % (path, token))[-1]
            #print 'waitForFile: File was generated: %s' % f
            return f
        # elif (startTime + timeout) > time.time():
        elif time.time() > timeout:
            log('pythonHelper: waitForFile: %s not found in %s after %s seconds.' % (token, path, timeout), 'error')
            return 0
        else:
            wait(2)
示例#19
0
 def launchFlixCheck(self, timeout):
     """Checker function to verify if Flix was launched."""
     log('## launchFlixCheck')
 
     wait(5)
 
     if self.launch.testInfo.flixVersion > "5.2":
         oneOrOther = sikuliUtils.oneOrTheOther('logInScreen.png', 'newShowButton.png', timeout)
     else:
         oneOrOther = sikuliUtils.oneOrTheOther('logInScreen.png', 'projectBrowser.png', timeout)
 
     if oneOrOther == 0:
         return 'login'
     elif oneOrOther == 1:
         log('- Project Browser open.')
         self.launch.projectBrowser.showing = True
     else:
         self.launch.testInfo.failed('launchFlixCheck: Could not find the Project Browser or log in screen.', True)
 
     log('All checks performed for launchFlix.')
示例#20
0
def deleteLocalPoses(testInfo):
    """Deletes the poses directory for each beat in the current sequence

    :param testInfo: TestInfo object
    :return: None
    """
    if not testInfo.remote:
        log('deleteLocalPoses: Not a remote Flix setup, skipping pose deletion.', 'debug')
        return

    poseDirs = []
    for beat in testInfo.editPanels:
        for panel in testInfo.editPanels[beat]:
            poseFile = testInfo.getPanelPoseFile(panel)
            if not poseFile:
                continue
            poseDir = os.path.dirname(poseFile)
            if poseDir not in poseDirs:
                poseDirs.append(poseDir)
            resyncFile = "%s/.flixResync2" % poseDir

            # log('deleteLocalPoses: resyncFile: %s' % resyncFile, 'debug')
            attempts = 20
            for attempt in range(attempts):
                # log('deleteLocalPoses: panel: %s. attempt: %s' % (panel, attempt+1), 'debug')
                if os.path.exists(resyncFile):
                    # log('deleteLocalPoses: Pose for panel %s has been synced.' % panel, 'debug')
                    break
                elif attempt == attempts+1:
                    # log('deleteLocalPoses: Could not find .flixResync2 file in %s after 20 attempts.'
                    #     % poseDir, 'debug')
                    wait(5)

    for dir in poseDirs:
        try:
            shutil.rmtree(dir)
            log('deleteLocalPoses: %s deleted successfully.' % dir, 'debug')
        except (IOError, OSError) as e:
            log('deleteLocalPoses: Could not delete %s\n%s' % (dir, e), 'error')

    log('deleteLocalPoses: All poses have been deleted locally.', 'debug')
示例#21
0
    def importAudio(self, filename="newWorld.mp3", timeout=100):
        log('##### importAudio')

        self.testInfo.allAudio = pyUtils.countFiles(self.mp3Dir, '*.mp3')

        path = "%s/%s" % (self.audioAssetsDir, filename)

        if not os.path.exists(path):
            log('importAudio: the audio file specified does not exist, exiting.\naudio file: %s' % path, 'error')
            return

        click('importDrawingsButton.png')

        if not exists('importFileBrowserFilename.png', 10):
            log('importAudio: Could not find importFileBrowserFilename after 10 seconds.', 'error')
        click('importFileBrowserFilename.png')

        type(path.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)

        self.importDrawingCheck.importAudioCheck(timeout)
示例#22
0
def reloadFlix(image):
    """Method to reload Flix.

    Can be useful to find things like plugins when Flix isn't in its default state any more.
    After reloading the page, it will try to look for the image.
    It returns 1 if it found it, 0 if it didn't.
    """
    """
    # In case the edit wasn't saved already
    if exists('saveEdit.png'):
        click('saveEdit.png'); wait(1)
    """
    closeChromeTab()
    # type('t', sikuli.KeyModifier.CTRL | sikuli.KeyModifier.SHIFT)
    ctrlType('t', sikuli.KeyModifier.SHIFT)

    if exists(image, 10):
        wait(2)
        return 1
    else:
        return 0
示例#23
0
def newChromeTab(url, closeCurrent=False):
    """Opens a new Chrome tab and goes to the given URL"""
    if closeCurrent:
        closeChromeTab()
    sikuli.App.focus('Google Chrome'); wait(1)
    ctrlType('t'); wait(1)
    type(url); wait(1)
    type(sikuli.Key.ENTER)
示例#24
0
    def importPanels(self, filebase, ext, nPanels):
        """Imports all the panels contained in the provided path

        info - dictionary containing info on the show/sequence
        filebase -- Basename for the files to import (e.g. testJpeg)
        ext -- Extension of the files to import (e.g. jpeg)
        nPanels -- Number of panels to import
        """
        log('##### importPanels')

        if self.testInfo.OS == "mac":
            log("importPanels only supported on Windows right now. Using importDrawings instead...", "error")
            self.importDrawings(ext, nPanels)
            return

        availablePanels = self.__getAvailablePanels(ext)

        panelList = []
        for n in range(1, nPanels+1):
            panelList.append('%s%s.%s' % (filebase, str(n), ext))

        log('panelList: %s' % panelList, 'debug')

        click('importDrawingsButton.png')

        if not exists('importFileBrowserFilename.png', 10):
            log('Could not find importFileBrowserFilename after 10 seconds.', 'error')
        click('importFileBrowserFilename.png')

        type(self.importPath.replace('/', '\\')); wait(1)
        type(sikuli.Key.ENTER); wait(1)

        for panel in panelList:
            type("\"" + panel + "\" ")

        type(sikuli.Key.ENTER)

        self.importDrawingCheck.importPanelsCheck(ext, nPanels, panelList)
示例#25
0
def cleanup(testInfo, deleteSeq):

    # Close the Flix Chrome tab
    closeChromeTab(); wait(1)

    # Kill Flix
    quitFlix(testInfo.OS)
    # exitProc("127.0.0.1", "35980")
    # try:
    #     urllib2.urlopen("http://127.0.0.1:35980/exit")
    # except urllib2.URLError, e:
    #     log('cleanup: Could not exit Flix, probably already down.\n%s' % e, 'debug')

    # Close command prompt
    # if sikuli.App.focus('flix UI'):
    #     wait(1)
    #     type('exit'); wait(1)
    #     type(sikuli.Key.ENTER); wait(1)
    # else:
    #     log('cleanup: Could not focus on the Flix UI Command Prompt window.')

    if os.getenv('QA_FLIX_ZIPSEQ') == '1':
        log('cleanup: Zipping sequence...', 'debug')
        pyUtils.zipSequence(testInfo)

    # Delete the sequence
    if deleteSeq:
        pyUtils.deleteSequence(testInfo)
        if testInfo.episode:
            pyUtils.deleteEpisode(testInfo)

    # Copy Flix's local log to the logs directory
    try:
        shutil.copyfile(testInfo.flixLog, "%s/../flixLog_%s.log" % (testInfo.outDir, testInfo.testName))
    except Exception, e:
        log("cleanup: failed to copy the Flix log file.\n%s" % e, "error")
示例#26
0
def quitFlix(platform):
    if click('flixOptionsBtn.png'):
        wait(.5)
        type(sikuli.Key.UP); wait(.5)
        type(sikuli.Key.ENTER); wait(2)
        log('quitFlix: Flix has been killed.', 'debug')
    else:
        log('quitFlix: Flix could not be killed from Options menu; force killing it...')
        if platform == "mac":
            cmd = "ps -A | grep Applications/Flix | awk '{print $1}' | xargs kill -9"
            os.system(cmd)
示例#27
0
    def openInPhotoshop(self, panels, psMethod):
        """Opens one or multiple panels in Photoshop using Layer Comps ('layerComp') or Timeline ('timeline')

        panels -- List of panels to open in Photoshop
        psMethod -- Either open the panels in 'layerComp' or 'timeline' view in PS
        """
        log('##### openInPhotoshop')

        click(panels[0])
        if len(panels) != 1:
            for panel in panels[1:]:
                # click(panel, sikuli.KeyModifier.CTRL)
                sikuliUtils.ctrlClick(panel)

            if psMethod == 'layerComp':
                plugin = 'photoshopLayerComp.png'
            elif psMethod == 'timeline':
                plugin = 'photoshopTimeline.png'
            else:
                log('openInPhotoshop: %s psMethod is not supported in this test.' % psMethod)
                return
            if self.testInfo.flixVersion < '5.2':
                click(sikuliUtils.switchPlugin('editing', plugin))
            else:
                sikuliUtils.switchPlugin('editing', plugin)

        wait(1)
        # type(sikuli.Key.ENTER, sikuli.KeyModifier.CTRL)
        sikuliUtils.ctrlType('', sikuli.KeyModifier.ENTER)

        # Need to find a way to make sure the panel is open in Photoshop
        psState = sikuliUtils.oneOrTheOther('psOpen.png', 'psOpening.png', 30)
        if psState == 0:
            wait(5)
        elif psState == 1:
            wait(30)
        elif psState == 2:
            self.testInfo.failed('openInPhotoshop: Photoshop is not open and not opening.')

        sikuliUtils.psEdit()

        sikuli.App.focus('Google Chrome')

        for panel in panels:
            toPs.openInPhotoshopCheck(self.testInfo, panel)
示例#28
0
def closeExplorerWindow(lastDir):
    if sikuli.App.focus(lastDir):
        wait(1)
        ctrlType('w'); wait(1)
    elif sikuli.App.focus('Documents'):
        wait(1)
        ctrlType('w'); wait(1)
        log('closeExplorerWindow: File Explorer revealed in Documents and not %s.' % lastDir, 'debug')
    else:
        wait(3)
        if sikuli.App.focus(lastDir):
            wait(1)
            ctrlType('w'); wait(1)
        else:
            log('Could not find %s explorer window, so did not close it.' % lastDir, 'debug')
示例#29
0
def closeChromeTab():
    """Closes the current Chrome tab"""
    sikuli.App.focus('Google Chrome'); wait(1)
    ctrlType('w'); wait(1)
示例#30
0
def psEdit():
    """Helper function to prepare and exit Photoshop before and after drawing on the opened panel"""
    # use 'tab' to hide side panels to have the panel centered
    type(sikuli.Key.TAB); wait(1)

    # make photoshop full screen
    type('f'); wait(.5)
    type('f'); wait(1)

    # make sure the panel's size is 100%
    ctrlType('1'); wait(1)

    # create a new layer
    # type('n', sikuli.KeyModifier.CTRL | sikuli.KeyModifier.SHIFT); wait(1)
    ctrlType('n', sikuli.KeyModifier.SHIFT); wait(1)
    type(sikuli.Key.ENTER)

    drawCircle()

    # exit photoshop full screen
    type('f')

    # restore the side panels
    type(sikuli.Key.TAB)

    wait(1)
    # type('s', sikuli.KeyModifier.CTRL); wait(5)
    ctrlType('s'); wait(5)
    ctrlType('w'); wait(1)
示例#31
0
def createShotgunSequence(testInfo):
    """Method to create a sequence in Shotgun from scratch, via their website"""
    if testInfo.show == 'qa_test':
        url = 'https://abo.shotgunstudio.com/page/1801'
        seqImage = 'sgFlx.png'
    elif testInfo.show == 'cl2':
        url = 'https://abo.shotgunstudio.com/page/1985'
        seqImage = 'sgEp001_flx.png'
    else:
        log('createShotgunSequence: Show %s not setup in Shotgun, plugin will probably fail.' % testInfo.show, 'error')
        return

    newChromeTab(url)

    # Log in if needed (assumes Chrome remembered credentials)
    if exists('sgLogin.png', 3):
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.ENTER); wait(.5)

    if exists(seqImage):
        sikuli.rightClick(seqImage); wait(.5)
        click('sgDeleteSeq.png'); wait(1)
        type(sikuli.Key.ENTER); wait(1)
    else:
        log('createShotgunSequence: Could not find sequence %s in shotgun.' % testInfo.sequence)

    # Create the sequence from scratch
    click('sgCreateSeq.png'); wait(1)
    type(testInfo.sequence); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type('basic_sequence'); wait(.5)
    type(sikuli.Key.ENTER); wait(.5)
    type(sikuli.Key.TAB); wait(.5)
    type(sikuli.Key.ENTER); wait(.5)

    if exists(seqImage):
        log('createShotgunSequence: Sequence %s successfully created in Shotgun.' % testInfo.sequence)
    else:
        log('createShotgunSequence: Sequence %s probably not created in Shotgun.' % testInfo.sequence)

    closeChromeTab()