class Fastlane::Actions::TestinAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 31
def self.authors
  ["rudy.li"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 44
def self.available_options
  [
      FastlaneCore::ConfigItem.new(key: :email,
                                   env_name: "TESTIN_LOGIN_EMAIL",
                                   description: "email in your testin account",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :pwd,
                                   env_name: "TESTIN_LOGIN_PWD",
                                   description: "pwd in your testin account",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :path,
                                   env_name: "TESTIN_PATH",
                                   description: "Path to your apk/ipa file",
                                   default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
                                   optional: false,
                                   verify_block: proc do |value|
                                     UI.user_error!("Couldn't find apk file at path '#{value}'") unless File.exist?(value)
                                   end,
                                   conflicting_options: [:ipa],
                                   conflict_block: proc do |value|
                                     UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
                                   end),
      FastlaneCore::ConfigItem.new(key: :devices,
                                   env_name: "TESTIN_DEVICES",
                                   description: "Set up the device for script testing",
                                   optional: false,
                                   type: Array),
      FastlaneCore::ConfigItem.new(key: :project_name,
                                   env_name: "TESTIN_PROJECT_NAME",
                                   description: "Set the testin project name for testing",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :api_key,
                                   env_name: "TESTIN_API_KEY",
                                   description: "Testin api key",
                                   optional: false,
                                   type: String),
      FastlaneCore::ConfigItem.new(key: :app_version,
                                   env_name: "TESTIN_API_KEY",
                                   description: "Set up the version for script testing",
                                   optional: false,
                                   type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 27
def self.description
  "testin"
end
details() click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 39
def self.details
  # Optional:
  "testin plugin"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 91
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 35
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/testin/actions/testin_action.rb, line 7
def self.run(params)
  UI.message("The testin plugin is working!")
  require 'testin'
  begin
    global_options = {
        :email => params[:email],
        :pwd => params[:pwd],
        :path => params[:path],
        :devices => params[:devices],
        :project_name => params[:project_name],
        :api_key => params[:api_key],
        :app_version => params[:app_version]
    }
    result = ::Testin.set_task(global_options).create_task_for_normal
    UI.message("Testin Plugin Successed: #{result}")
  rescue StandardError => e
    UI.user_error!("Testin Plugin Error: #{e.to_s}")
   end
end