Exemple #1
0
 def init_resources(self, context):
     super(Googlephotos, self).init_resources(context)
     # Only accept certain image formats
     for image in self.test_images:
         if os.path.splitext(
                 image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
             raise ValidationError(
                 '{} must be a JPEG or PNG file'.format(image))
Exemple #2
0
 def init_resources(self, context):
     super(AdobeReader, self).init_resources(context)
     # Only accept certain file formats
     if os.path.splitext(self.document_name.lower())[1] not in ['.pdf']:
         raise ValidationError('{} must be a PDF file'.format(
             self.document_name))
     self.gui.uiauto_params['filename'] = self.document_name
     self.gui.uiauto_params['search_string_list'] = self.search_string_list
Exemple #3
0
 def init_resources(self, context):
     super(GoogleSlides, self).init_resources(context)
     # Allows for getting working directory regardless if path ends with a '/'
     work_dir = self.target.working_directory
     work_dir = work_dir if work_dir[-1] != os.sep else work_dir[:-1]
     self.gui.uiauto_params['workdir_name'] = self.target.path.basename(
         work_dir)
     self.gui.uiauto_params['test_file'] = self.test_file
     self.gui.uiauto_params['slide_count'] = self.slide_count
     self.gui.uiauto_params['do_text_entry'] = self.do_text_entry
     self.gui.uiauto_params['new_doc_name'] = self.new_doc_name
     # Only accept certain image formats
     if os.path.splitext(
             self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(
             self.test_image))
     # Only accept certain presentation formats
     if os.path.splitext(self.test_file.lower())[1] not in ['.pptx']:
         raise ValidationError('{} must be a PPTX file'.format(
             self.test_file))
Exemple #4
0
 def init_resources(self, context):
     super(Gmail, self).init_resources(context)
     # Allows for getting working directory regardless if path ends with a '/'
     work_dir = self.target.working_directory
     work_dir = work_dir if work_dir[-1] != os.sep else work_dir[:-1]
     self.gui.uiauto_params['workdir_name'] = self.target.path.basename(work_dir)
     self.gui.uiauto_params['recipient'] = self.recipient
     self.gui.uiauto_params['offline_mode'] = self.offline_mode
     self.gui.uiauto_params['test_image'] = self.test_image
     # Only accept certain image formats
     if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(self.test_image))
Exemple #5
0
    def validate(self):
        """
        Perform basic validation to ensure that this plugin is capable of
        running.  This is intended as an early check to ensure the plugin has
        not been mis-configured, rather than a comprehensive check (that may,
        e.g., require access to the execution context).

        This method may also be used to enforce (i.e. set as well as check)
        inter-parameter constraints for the plugin (e.g. if valid values for
        parameter A depend on the value of parameter B -- something that is not
        possible to enfroce using ``Parameter``\ 's ``constraint`` attribute.

        """
        if self.name is None:
            raise ValidationError('Name not set for {}'.format(self._classname))
        for param in self.parameters:
            param.validate(self)
Exemple #6
0
 def init_resources(self, context):
     super(Gmail, self).init_resources(context)
     if self.target.get_sdk_version(
     ) >= 24 and 'com.google.android.apps.photos' not in self.target.list_packages(
     ):
         raise WorkloadError(
             'gmail workload requires Google Photos to be installed for Android N onwards'
         )
     # Allows for getting working directory regardless if path ends with a '/'
     work_dir = self.target.working_directory
     work_dir = work_dir if work_dir[-1] != os.sep else work_dir[:-1]
     self.gui.uiauto_params['workdir_name'] = self.target.path.basename(
         work_dir)
     self.gui.uiauto_params['recipient'] = self.recipient
     self.gui.uiauto_params['offline_mode'] = self.offline_mode
     # Only accept certain image formats
     if os.path.splitext(
             self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
         raise ValidationError('{} must be a JPEG or PNG file'.format(
             self.test_image))