air_test 0.1.4.9 → 0.1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41ee1020896ed0182621576cb1573609558918eaf4c85d9ab8db7b614e8712ec
4
- data.tar.gz: ef767755f30717379d16dabbe6d02be580dc7eddbed31ff57d4836b869bd3743
3
+ metadata.gz: f817f7224c6f3bc2bc49607ce00e9e069701e85c2bfeab3015aff5795ce0767b
4
+ data.tar.gz: a79251b05748bdf35a4b9befaea87bdb9bf3271d4eafaded2e14403911dd3a0a
5
5
  SHA512:
6
- metadata.gz: 9f48ef1eb88057ab4d8bb8d000238b30d315e3eb10f3e28a7e7659c97a080fd9ddd9d0435adab7db69fa1ce33cfd48668fa0ddbf559ae088f7261f14820059fe
7
- data.tar.gz: 91e87b167e18552769891b65c1a2f004a8a9ea332a3a3b1591cc26ca8d4e697aab1b3f7e34930ce4d90d128c9d7e228ca5d1d11c90c527dbfe663a32c0ea2dbe
6
+ metadata.gz: 1befd0f3de325c240a0299a99ffb1e359282d57e36c1f713a2bef8d7fe1ff2ac927deb183e3dcfb23aab362a63eddb3b5eaa1207c8b7bbe6ec796e043c3e3875
7
+ data.tar.gz: 0246d8260912850bec3d9ca8391a1441bf964a92ff343b4fc5d12224f3923c883ac07bd1bcb97edbf3ae8e3d372bc508b266c19072361a38f0420ad5b0ee5901
@@ -19,7 +19,7 @@ module AirTest
19
19
  end
20
20
  # Set git user to bot
21
21
  system('git config user.name "air-test-bot"')
22
- system('git config user.email "jbarbedienne3@gmail.com"')
22
+ system('git config user.email "airtest.bot@gmail.com"')
23
23
  # Set remote to use bot token if available
24
24
  if @github_token
25
25
  repo_url = "github.com/#{@repo}.git"
@@ -81,22 +81,31 @@ module AirTest
81
81
  current_scenario = nil
82
82
  in_feature_block = false
83
83
  in_scenario_block = false
84
- blocks.each do |block|
84
+ in_background_block = false
85
+ background_steps = []
86
+ blocks.each_with_index do |block, idx|
85
87
  case block["type"]
86
88
  when "heading_1", "heading_2", "heading_3"
87
89
  heading_text = extract_text(block[block["type"]]["rich_text"])
88
90
  if heading_text.downcase.include?("feature")
89
91
  in_feature_block = true
90
92
  in_scenario_block = false
93
+ in_background_block = false
91
94
  parsed_data[:feature] = heading_text
95
+ elsif heading_text.strip.downcase == "background:"
96
+ in_background_block = true
97
+ in_feature_block = false
98
+ in_scenario_block = false
92
99
  elsif heading_text.downcase.include?("scenario")
93
100
  in_scenario_block = true
94
101
  in_feature_block = false
102
+ in_background_block = false
95
103
  current_scenario = { title: heading_text, steps: [] }
96
104
  parsed_data[:scenarios] << current_scenario
97
105
  else
98
106
  in_feature_block = false
99
107
  in_scenario_block = false
108
+ in_background_block = false
100
109
  end
101
110
  when "paragraph"
102
111
  text = extract_text(block["paragraph"]["rich_text"])
@@ -104,6 +113,8 @@ module AirTest
104
113
 
105
114
  if in_feature_block
106
115
  parsed_data[:feature] += "\n#{text}"
116
+ elsif in_background_block
117
+ background_steps << text
107
118
  elsif in_scenario_block && current_scenario
108
119
  current_scenario[:steps] << text
109
120
  end
@@ -113,6 +124,8 @@ module AirTest
113
124
 
114
125
  if in_feature_block
115
126
  parsed_data[:feature] += "\n• #{text}"
127
+ elsif in_background_block
128
+ background_steps << text
116
129
  elsif in_scenario_block && current_scenario
117
130
  current_scenario[:steps] << text
118
131
  end
@@ -132,6 +145,38 @@ module AirTest
132
145
  end
133
146
  end
134
147
  end
148
+ # Prepend background steps to each scenario
149
+ if background_steps.any?
150
+ parsed_data[:scenarios].each do |scenario|
151
+ scenario[:steps] = background_steps + scenario[:steps]
152
+ end
153
+ end
154
+ # Handle case where there is only one scenario and no explicit scenario heading
155
+ if parsed_data[:scenarios].empty?
156
+ # Try to find steps after the feature heading
157
+ steps = []
158
+ in_steps = false
159
+ blocks.each do |block|
160
+ case block["type"]
161
+ when "heading_1", "heading_2", "heading_3"
162
+ heading_text = extract_text(block[block["type"]]["rich_text"])
163
+ if heading_text.downcase.include?("feature")
164
+ in_steps = true
165
+ elsif heading_text.downcase.include?("scenario")
166
+ in_steps = true
167
+ else
168
+ in_steps = false
169
+ end
170
+ when "paragraph", "bulleted_list_item", "numbered_list_item"
171
+ text = extract_text(block[block["type"]]["rich_text"] || block["paragraph"]["rich_text"])
172
+ next if text.empty?
173
+ steps << text if in_steps
174
+ end
175
+ end
176
+ if steps.any?
177
+ parsed_data[:scenarios] << { title: "Scenario", steps: steps }
178
+ end
179
+ end
135
180
  parsed_data[:feature] = parsed_data[:feature].strip
136
181
  parsed_data[:meta][:tags] = parsed_data[:meta][:tags].uniq
137
182
  parsed_data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AirTest
4
- VERSION = "0.1.4.9"
4
+ VERSION = "0.1.5.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.9
4
+ version: 0.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - julien bouland
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-21 00:00:00.000000000 Z
10
+ date: 2025-07-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails