Class: Fastlane::Actions::AllureRunTestplanAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb', line 45

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      env_name: 'ALLURE_TOKEN',
      key: :token,
      description: 'Allure API Token'
    ),
    FastlaneCore::ConfigItem.new(
      key: :url,
      description: 'Testops URL'
    ),
    FastlaneCore::ConfigItem.new(
      key: :release_version,
      description: 'Release version',
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :testplan,
      description: 'Testplan name in Allure Testops'
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_id,
      description: 'Project identifier in Allure Testops'
    ),
    FastlaneCore::ConfigItem.new(
      key: :jira,
      description: 'Jira link',
      default_value: 'Default'
    )
  ]
end

.descriptionObject



41
42
43
# File 'lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb', line 41

def self.description
  'Sync and run testplan on Allure Testops'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb', line 77

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb', line 4

def self.run(params)
  response = other_action.allure_api(
    url: params[:url],
    token: params[:token],
    path: "testplan/?projectId=#{params[:project_id]}",
    http_method: 'GET'
  )

  testplan_id = response['content'].find { |plan| plan['name'] == params[:testplan] }['id']

  other_action.allure_api(
    url: params[:url],
    token: params[:token],
    path: "testplan/#{testplan_id}/sync",
    http_method: 'POST'
  )
  UI.success("Testplan with id #{testplan_id} synced successfully 🎉")

  body = {
    launchName: "#{params[:testplan]} #{params[:release_version]}",
    links: [{ name: 'Jira', url: params[:jira] }]
  }.to_json

  other_action.allure_api(
    url: params[:url],
    token: params[:token],
    path: "testplan/#{testplan_id}/run",
    http_method: 'POST',
    request_body: body
  )
  UI.success("Testplan with id #{testplan_id} launched successfully 🎉")
end