def saveVersionCheck(testInfo, comment): """Checker function to verify the edit has been saved""" log('## saveVersionCheck:') editVersion = testInfo.getEditVersion() editorialDir = testInfo.getEditorialDir() if testInfo.currentBranch == 'main': shotEditDir = '%sfle/' % (editorialDir) else: shotEditDir = '%sfle.%s/' % (editorialDir, branch) # Check the shotEdit XML exists for the new version shotEditFile = pyUtils.waitForFile(shotEditDir, '%s_shotEdit_v%s.xml' % (testInfo.sequence, editVersion), 5) if shotEditFile == 0: testInfo.failed('saveVersionCheck: shotEdit XML was not created for version %s' % editVersion) else: log('- Found the shotEdit XML for version %s' % testInfo.getEditVersion()) # Check for the comment if pyUtils.findOccurences('note=\"%s' % urllib.quote(comment, ''), shotEditFile) != 1: testInfo.failed('saveVersionCheck: Could not find the save comment (%s) in the shotEdit XML.' % comment) log('shotEditFile: %s' % shotEditFile) else: log('- Found the save comment in the shotEdit XML.') # Check there's no shotEdit XML for a more recent version if pyUtils.waitForFile(shotEditDir, '%s_shotEdit_v%s.xml' % (testInfo.sequence, editVersion + 1), 1) != 0: testInfo.failed('saveVersionCheck: Found a shotEdit XML for a newer version (%s).' % editVersion + 1) else: log('- No shotEdit XML was found for a newer version.') # Check the shotEdits XML exists shotEditsFile = pyUtils.waitForFile(shotEditDir, '%s_shotEdits.xml' % testInfo.sequence, 5) if shotEditsFile == 0: testInfo.failed('saveVersionCheck: The shotEdits XML was not found.') else: log('- Found the shotEdits XML.') # Check the latest version is in the shotEdits XML if pyUtils.findOccurences('version=\"%s\"' % editVersion, shotEditsFile) != 1: testInfo.failed('saveVersionCheck: Could not find version %s inside the shotEdits XML.' % editVersion) else: log('- Found the new version in the shotEdits XML.') # Check that there's no newer version in the shotEdits XML if pyUtils.findOccurences('version=\"%s\"' % (editVersion + 1), shotEditsFile) == 1: testInfo.failed('saveVersionCheck: Found a newer version (%s) inside the shotEdits XML.' % editVersion + 1) else: log('- No newer version in the shotEdits XML.') # Check for the comment if pyUtils.findOccurences('note=\"%s' % urllib.quote(comment, ''), shotEditsFile) != 1: testInfo.failed('saveVersionCheck: Could not find the save comment (%s) in the shotEdits XML.' % comment) log('shotEditsFile: %s' % shotEditsFile) else: log('- Found the save comment in the shotEdits XML.') log('All checks performed for saveVersion.')
def createSequenceCheck(self): """Checker function to verify a new sequence has been created""" log('## createSequenceCheck') if exists('flixPopupOK.png', 3): self.projectBrowser.testInfo.failed('createSequenceCheck: Got ' 'the \'Sequence already exists\' error message.') click('flixPopupOK.png') return 1 # if not exists('%sSequence.png' % self.projectBrowser.testInfo.sequence, 5): # self.projectBrowser.testInfo.failed('createSequenceCheck: Failed to find ' # 'the \'%s/%s\' sequence in the Project Browser.' % ( # self.projectBrowser.testInfo.show, self.projectBrowser.testInfo.sequence)) # else: # log('- %s sequence found in the Project Browser.' % self.projectBrowser.testInfo.sequence) # path = self.projectBrowser.testInfo.getEditorialDir() if pyUtils.waitForFile(self.projectBrowser.editorialDir, 'fle', 10) == 0: self.projectBrowser.testInfo.failed('createSequenceCheck: Could not find the fle folder ' 'under the seq.%s.story/flix/editorial directory.' % self.projectBrowser.testInfo.sequence) return 1 else: log('- FLE directory found for the new sequence.') log('All checks performed for createSequence.')
def __checkMarkersTxt(self): if len(self.toEditorial.testInfo.editMarkers) != 0: markerPath = '%s/markers/avidImport/' % self.toEditorial.editorialDir markers = len(self.toEditorial.testInfo.editMarkers) markerFile = pyUtils.waitForFile(markerPath, '*_marker.txt', 5) if not markerFile: return foundMarkers = pyUtils.findOccurences('red', markerFile) if foundMarkers != markers: self.toEditorial.testInfo.failed('toAvidCheck: Expected %s markers, ' 'found %s instead.' % (markers, foundMarkers)) else: log('- Found all %s markers in the markers.txt file.' % markers) else: log('- No markers.txt file created as expected.')
def createBranchCheck(self, branches): """Checks whether the new branches were created successfully :param branches: Array of branch names to create :return: None """ log('## createBranchCheck') missing = [] for branch in branches: if not pyUtils.waitForFile(self.projectBrowser.editorialDir, "fle.%s" % branch, 5): missing += branch if len(missing): self.projectBrowser.testInfo.failed("createBranchCheck: Could not find the fle folder " "for the following branches: %s" % missing) else: log("- FLE directories were found for every created branch.") log("All checks performed for createBranch.")
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.')