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 importAudioCheck(self, timeout): log('## importAudioCheck') if not exists('importAudioOK.png', timeout): self.importDrawing.testInfo.failed('importAudioCheck: No popup found after %s seconds.' % timeout) else: log('- Found popup after importing audio.') click('importAudioOK.png') sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported audio.') # Check mp3 file is in the editorial directory checkUtils.newAudioFile(self.importDrawing.testInfo, methodName='importAudioCheck') # Check mp3 is in the shotEdit shotEdit = self.importDrawing.testInfo.getShotEdit() if shotEdit: mp3Found = pyUtils.findOccurences('.mp3', shotEdit) if mp3Found != 1: self.importDrawing.testInfo.failed('importAudioCheck: Expected 1 audio file in the shotEdit, ' 'found %s instead.' % mp3Found) else: log('- Found imported audio file in the current shotEdit.') self.importDrawing.testInfo.editAudio = 1 else: self.importDrawing.testInfo.failed('importAudioCheck: shotEdit not found, cannot check for audio.') log('All checks performed for importAudio.')
def __checkPanelsInSbpXml(self, xml): expectedAnyClips = self.toEditorial.testInfo.getEditPanels(True) foundAnyClips = pyUtils.findOccurences('<mastercomment1>', xml) if foundAnyClips != expectedAnyClips: self.toEditorial.testInfo.failed('toSBPCheck: Expected %s clips in the XML, ' 'found %s instead.' % (expectedAnyClips, foundAnyClips)) else: log('- Found all expected clips in the XML.')
def __checkAudioSbpXml(self, xml): audioFound = pyUtils.findOccurences('.mp3</pathurl>', xml) if self.toEditorial.testInfo.editAudio == 1: if audioFound != 1: self.toEditorial.testInfo.failed('toSBPCheck: There\'s no audio file referenced in the XML.') else: log('- Found audio file referenced in the XML.') else: if audioFound != 0: self.toEditorial.testInfo.failed('toSBPCheck: There should not be an audio file referenced in the XML.') else: log('- No audio in the XML as expected.')
def __checkMarkersFcpXml(self, xml): if len(self.toEditorial.testInfo.editMarkers) != 0: nMarkers = len(self.toEditorial.testInfo.editMarkers) foundMarkers = pyUtils.findOccurences('<marker>', xml) if foundMarkers != nMarkers: self.toEditorial.testInfo.failed('toPremiereCheck: Did not find ' '%s markers in the XML, found %s instead.' % (nMarkers, foundMarkers)) else: log('- Found all %s markers in the XML.' % nMarkers) noName = 0 # Check marker names are in the XML for marker in self.toEditorial.testInfo.editMarkers: if pyUtils.findOccurences('<name>%s</name>' % marker, xml) != 1: log('Did not find marker %s in the XML.' % marker, 'debug') noName += 1 if noName != 0: self.toEditorial.testInfo.failed('toPremiereCheck: Did not find the right ' 'marker names in the XML.') else: log('- Found all the right marker names in the XML.') else: log("- No marker in the XML as expected.")
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 __checkPanelsInFcpXml(self, xml, fcpNew): if 'all.xml' in xml: whichXML = 'all' panels = self.toEditorial.testInfo.getEditPanels(ref=True) else: whichXML = 'new' panels = len(fcpNew) # Check for panels in the XML # Check for HD images in the XML hdFoundPanels = pyUtils.findOccurences('.hd.', xml) if hdFoundPanels != panels: self.toEditorial.testInfo.failed('toPremiereCheck: Expected %s HD panels ' 'in the %s XML, found %s instead.' % (panels, whichXML, hdFoundPanels)) else: log('- Found all %s HD panels in the %s XML.' % (panels, whichXML))
def __checkSbpIds(self, xml): expectedSbpClips = [] refClips = os.listdir('%s/referenceClips' % self.toEditorial.testInfo.getEditorialDir()) # log('toSBPCheck: refClips: %s' % refClips, 'debug') for refClip in refClips: for still in self.toEditorial.testInfo.editPanels['p']: if still in refClip: expectedSbpClips.append(still) for anim in self.toEditorial.testInfo.editPanels['a']: if anim in refClip: expectedSbpClips.append(anim) log('toSBPCheck: expectedSbpClips: %s' % expectedSbpClips, 'debug') foundSbpClips = pyUtils.findOccurences('SB_PSOBJID', xml) if foundSbpClips != len(expectedSbpClips): self.toEditorial.testInfo.failed('toSBPCheck: Expected %s SBP unique IDs, ' 'found %s instead.' % (len(expectedSbpClips), foundSbpClips)) else: log('- Found all expected SBP unique IDs in the XML.')
def __checkShotEdit(self, comment): """Checks Shot Edit file was created after a publish and it contains the publish comment :param comment: Comment entered when publishing to Flix :return: 1 if the shotEdit was found, 0 otherwise """ shotEditFile = self.fromEditorial.testInfo.getShotEdit() if not shotEditFile: self.fromEditorial.testInfo.failed("publishToFlixCheck: Could not find the XML in the FLE directory.") return 0 else: log("- Found the shotEdit XML in the editorial branch.") # Check the comment is in the shotEdit if pyUtils.findOccurences('note="Editorial:%s' % urllib.quote(comment, ","), shotEditFile) != 1: self.fromEditorial.testInfo.failed( "publishToFlixCheck: Could not find the publish comment (%s) in the shotEdit XML." % comment ) else: log("- Found the publish comment in the shotEdit XML.") return 1