def addPlayblastCheck(self, duration): """After sending a playblast from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param duration: Duration in frames of the playblast sent from Maya :return: None """ log('## addPlayblastCheck') # Need to wait until Flix is done processing, assuming 2 sec/frame for timeout timeout = 2*duration checkUtils.doneProcessing(self.fromMaya.testInfo, timeout, methodName="addPlayblastCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Sent a playblast from Maya.') # Check there's 1 more panel in the current shotEdit newPanel = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': 1}, beats=['a'], methodName='addPlayblastCheck') checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanel, ['multitrack', 'jpg', 'xml', 'json'], 'addPlayblastCheck') expectedDur = self.fromMaya.testInfo.editDuration + duration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addPlayblastCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration increased by %s frames as expected.' % duration) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for addPlayblast.')
def importPanelsCheck(self, ext, nPanels, panelList, checkImage=True, replace=0): log('## importPanelsCheck') if checkImage: self.__checkImage(ext, nPanels, panelList) else: self.__checkDoneProcessing(ext, nPanels) sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported %s %ss.' % (nPanels, ext)) # Check there's nPanels more panels in the current shotEdit if ext == 'mov': beat = 'a' else: beat = 'p' newPanels = checkUtils.newPanelsInShotEdit(self.importDrawing.testInfo, {beat: nPanels}, replace, beats=[beat], methodName='importPanelsCheck') checkUtils.checkPanelDir(self.importDrawing.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'importPanelsCheck') # Check the pose for each panel was copied checkUtils.checkPanelPose(self.importDrawing.testInfo, newPanels, 'importPanelsCheck') if not replace: self.__checkDuration(ext, nPanels, panelList) log('All checks performed for importPanels.')
def openInPhotoshopCheck(testInfo, panel): """Checker function to verify if the panel in Flix was edited properly panel -- Image (.png) of the original panel that was edited """ log('## openInPhotoshopCheck:') panelName = panel.split('.')[0] if not exists(panelName + '_edited.png', 5): testInfo.failed('openInPhotoshopCheck: Could not find %s edited in Flix.' % panelName) else: log('- %s was edited.' % panelName) sikuliUtils.saveVersion(testInfo, 'Edited 1 panel in Photoshop.') """ # Check there's one more panel in the beats directory allPanels = pythonHelper.findBeat(testInfo, 'p') if (allPanels - len(testInfo.allPanels['p'])) != 1: testInfo.failed('openInPhotoshopCheck: Could not find 1 new panel in the beats directory.') else: log('- Found all 1 new panel in the beats directory.') #testInfo.allPanels['p'] = allPanels """ # Check it didn't create more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(testInfo, {'p': 0}, methodName='openInPhotoshopCheck', beats=['p']) checkUtils.checkPanelDir(testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'openInPhotoshopCheck') log('All checks performed for openInPhotoshop.')
def addStillsCheck(self, frames): """After sending a still from Maya to Flix, this method checks the thumbnail has stopped processing, the new panel(s) are present in the saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param frames: List of all the frames to be sent from Maya to Flix :return: None """ log('## addStillsCheck') # Need to wait until Flix is done processing checkUtils.doneProcessing(self.fromMaya.testInfo, 10, methodName="addStillsCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Sent %s stills from Maya.' % len(frames)) # Check there's len(frames) more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'s': len(frames)}, beats=['s'], methodName='addStillsCheck') checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml', 'json'], 'addStillsCheck') expectedDur = self.fromMaya.testInfo.editDuration + (12*len(frames)) foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addStillsCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration increased by %s frames as expected.' % (12*len(frames))) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for addStills.')
def replaceStillCheck(self): """After replacing a panel from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :return: None """ log('## replaceStillCheck') # Need to wait until Flix is done processing checkUtils.doneProcessing(self.fromMaya.testInfo, 10, methodName="replaceStillCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Replaced a panel by a still from Maya.') # Check there's not more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'s': 0}, methodName='replaceStillCheck', beats=['s']) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml', 'json'], 'replaceStillCheck') expectedDur = self.fromMaya.testInfo.editDuration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('replaceStillCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration unchanged as expected.') self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for replaceStill.')
def replaceSequencerShotCheck(self, duration): """After replacing a Flix panel with a shot from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param duration: Total duration in frames of the shot sent from Maya :return: None """ log('## replaceSequencerShotCheck') # Need to wait until Flix is done processing, assuming 2 sec/frame for timeout timeout = 2*duration checkUtils.doneProcessing(self.fromMaya.testInfo, timeout, methodName="replaceSequencerShotCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Replaced a panel by an animated panel from Maya.') # Check there's not more panels in the current shotEdit newPanel = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': 0}, methodName='replaceSequencerShotCheck', beats=['a']) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanel, ['multitrack', 'jpg', 'xml', 'json'], 'replaceSequencerShotCheck') expectedDur = self.fromMaya.testInfo.editDuration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('replaceSequencerShotCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration unchanged as expected.') self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for replaceSequencerShot.')
def duplicatePanelCheck(self, panel): log('## duplicatePanelCheck') # Make sure the duplicated panel is found twice on screen try: matches = list(sikuli.findAll(panel)) n = len(matches) if n != 2: self.editTools.testInfo.failed('duplicatePanelCheck: Expected 2 instances of %s, found %s instead.' % (panel, n)) else: log('- Found both instances of the duplicated panel on screen.') except FindFailed: self.editTools.testInfo.failed('duplicatePanelCheck: Could not find any instance of %s on screen.' % panel) sikuliUtils.saveVersion(self.editTools.testInfo, 'Duplicated one panel.') # Check there's 1 more panel in the new shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.editTools.testInfo, {'p': 1}, beats=['p'], methodName='copyPastePanelCheck') # Check the new panel has everything in its directory checkUtils.checkPanelDir(self.editTools.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'duplicatePanelCheck') log('All checks performed for duplicatePanelCheck.')
def createNewPanelsCheck(self, n): """Checker function to verify the n new panels were created n -- Number of panels created """ log('## createNewPanelsCheck') if not exists('%sblankPanels.png' % n): self.editTools.testInfo.failed('createNewPanelsCheck: Could not find the %s new created panels on screen.' % n) else: log('- Found all %s new panels on screen.' % n) sikuliUtils.saveVersion(self.editTools.testInfo, 'Created %s new blank panels.' % n) """ # Check there's n more panels in the beats directory allPanels = pythonHelper.findBeat(self.editTools.testInfo, 'p') if (allPanels - len(self.editTools.testInfo.allPanels['p'])) != n: self.editTools.testInfo.failed('createNewPanelsCheck: Expected %s new panels in the beats directory, found %s instead.' % (n, allPanels - len(self.editTools.testInfo.allPanels['p']))) else: log('- Found all %s new panels in the beats directory.' % n) """ # Check there's n more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.editTools.testInfo, {'p': n}, beats=['p'], methodName='createNewPanelsCheck') checkUtils.checkPanelDir(self.editTools.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'createNewPanelsCheck') log('All checks performed for createNewPanels.')
def toAvidCheck(self, timeout): """Method to check the Avid publish was successful :param timeout: Time in sec before assuming the publish failed if there was no popup :return: None """ log('## toAvidCheck') if not self.__waitPopup(timeout, "toAvidCheck"): return # Check all the PNGs have been created editPanels = self.toEditorial.testInfo.getPanelsFromShotEdit(perBeat=False) checkUtils.checkPanelDir(self.toEditorial.testInfo, editPanels, ['hdPng'], 'toAvidCheck') ale = self.__checkAleExists() if ale: self.__checkAleContents(ale, editPanels) self.__checkAafs() self.__checkMarkersTxt() # TODO: Check the html email for details of what failed log('All checks performed for toAvid.')
def __checkNewPanels(self, editPanels): # Check the multitrack, jpeg and recipe have been created successfully for each new panel newPanels = {'p': [], 'a': []} for beat in newPanels: for panel in editPanels[beat]: if panel not in self.fromSbp.testInfo.allPanels[beat]: newPanels[beat].append(panel) log('sbpToFlixCheck: newPanels: %s' % newPanels) checkUtils.checkPanelDir(self.fromSbp.testInfo, newPanels, thingsToCheck=['multitrack', 'jpg', 'xml'], methodName='sbpToFlixCheck') # Check the pose for each new panel exists checkUtils.checkPanelPose(self.fromSbp.testInfo, newPanels, 'sbpToFlixCheck')
def toPremiereCheck(self, timeout): """Checks the publish to Premiere was successful :param timeout: Time in sec before assuming the publish failed if there was no popup :return: None """ log('## toPremiereCheck:') if not self.__waitPopup(timeout, "toPremiereCheck"): return editPanels = self.toEditorial.testInfo.getPanelsFromShotEdit() checkUtils.checkPanelDir(self.toEditorial.testInfo, editPanels, ['hdJpg', 'hdMov'], 'toPremiereCheck') fcpNew = self.__getFcpNewPanels() # TODO: Check the extra_data XML generated by Flix if edit contains SBP panels for whichXML in ['all', 'new']: xml = self.__checkFcpXml(whichXML) if not xml: if whichXML == 'all' or (whichXML == 'new' and fcpNew != 0): self.toEditorial.testInfo.failed('toPremiereCheck: Could not find the %s XML.' % whichXML) return elif whichXML == 'new' and fcpNew == 0: log('- No new XML was generated, as expected.') continue else: log('- Found the %s XML.' % whichXML) self.__checkPanelsInFcpXml(xml, fcpNew) # TODO: Check for the dialogue for each panel # TODO: it'd be cool to return the path of the audio file if found to check it's correct self.__checkAudioFcpXml(xml) self.__checkMarkersFcpXml(xml) # TODO: Check the html email for details of what failed log('All checks performed for the %s XML.' % whichXML) self.__checkPublishedFcpDir(fcpNew) log('All checks performed for toPremiere.')
def __checkPanels(self, stillRefs, animatedRefs, existing): """Checks the right number of still ref, animated ref and existing panels exist in the current Shot Edit and that their multitrack, thumbnail and recipe files were created :param stillRefs: Array of still ref panel names that should exist in the current edit :param animatedRefs: Array of animated ref panel names that should exist in the current edit :param existing: Array of existing panel names that should exist in the current edit :return: None """ # Check the expected panels came in editPanels = self.fromEditorial.testInfo.getPanelsFromShotEdit() foundRefs = [] foundExisting = [] for beat in editPanels: if beat == "ref": for panel in editPanels[beat]: foundRefs.append(panel) else: for panel in editPanels[beat]: foundExisting.append(panel) if len(foundExisting) != existing: self.fromEditorial.testInfo.failed( "publishToFlix: Expected %s existing panels, found %s instead." % (existing, len(foundExisting)) ) else: log("- Found the expected number of existing panels.") if len(foundRefs) != (stillRefs + animatedRefs): self.fromEditorial.testInfo.failed( "publishToFlix: Expected %s ref panels, found %s instead." % ((stillRefs + animatedRefs), len(foundRefs)) ) else: log("- Found the expected number of refs.") checkUtils.checkPanelDir( self.fromEditorial.testInfo, {"refs": foundRefs}, ["multitrack", "jpg", "xml"], "publishToFlixCheck" )
def publishSequencerCheck(self, mayaSettings): """After publishing a Maya sequencer to Flix, this methods checks that there's a new version of the sequence, there's a new audio file from the publish, there's a new movie for each new shot from the sequencer, all the new panels are in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for each new panel. :param mayaSettings: Dictionary created using readMayaSettings method :return: None """ log('## publishSequencerCheck') expectedDur = 0 for shotDuration in mayaSettings["shotDurations"]: expectedDur += shotDuration # Assume 2sec/frame as a timeout timeout = 2*expectedDur # Right now there's no popup or nothing processing, so no way to know until it's done # The best thing to do is wait until a new shotEdit gets created! currentShotEdit = self.fromMaya.testInfo.getShotEdit() currentVersion = self.fromMaya.testInfo.getEditVersion() newShotEdit = currentShotEdit.replace('_v%s.xml' % currentVersion, '_v%s.xml' % (currentVersion+1)) if pyUtils.waitForFile('/'.join(newShotEdit.split('/')[0:-1]) + '/', newShotEdit.split('/')[-1], timeout) == 0: self.fromMaya.testInfo.failed('publishSequencerCheck: Could not find v%s of the shotEdit after %s seconds.' % (currentVersion+1, timeout)) return else: log('- Found shotEdit for the new version of the edit.') self.fromMaya.testInfo.incrementEditVersion() self.fromMaya.testInfo.resetEdit() # Load latest version editorialDir = self.fromMaya.testInfo.getEditorialDir() # Check there's audio checkUtils.newAudioFile(self.fromMaya.testInfo, methodName="publishSequencerCheck") # Check the movie was copied movDir = '%smov/' % editorialDir nMovies = pyUtils.countFiles(movDir, '*.mov') if nMovies != (self.fromMaya.testInfo.publishedMovs + 1): self.fromMaya.testInfo.failed('publishSequencerCheck: Could not find the movie copied to the editorial/mov/ directory.' 'Expected %s movies, found %s instead.' % (self.fromMaya.testInfo.publishedMovs+1, nMovies)) else: log('- Found the movie copied in the editorial/mov directory.') self.fromMaya.testInfo.publishedMovs += 1 # Check there's nShot panels in the shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': mayaSettings["nShots"]}, methodName='publishSequencerCheck', beats=['a']) # Jpegs finish rendering after the shotEdit XML is created, so we need to wait some more before checking every # panel has its jpeg. Assuming 0.5 sec/frame for this sikuli.wait(int(expectedDur/2)) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'publishSequencerCheck') foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addSequencerShotsCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration found to be %s as expected.' % foundDur) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for publishSequencer.')