air_test 0.1.5.1 → 0.1.5.2
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 +4 -4
- data/lib/air_test/notion_parser.rb +26 -27
- data/lib/air_test/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2e98274b6a895b0b6c0e39108f32114b56456f4ed10e9f8dddc82a5e0ea1dfe
|
4
|
+
data.tar.gz: 9d839e439c871bb5a1e88b89420da3e28ca1baec3f8771c682aab7a8b703e2eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aea7c921c0941b905f6e25613b1c32b7105543337ff185020c2cd55609be468daaf190a41fdc2580c0e5d00388e54edf5eeb43be214f10df7fa1fc41aea05e2
|
7
|
+
data.tar.gz: 919f4c97ed47103ba86ce3d7bacc63feb473e8f7ceb1667e60daa59e171780f3a7a807b8e0ba10484791445689302cc36792fe690581cc15a520407762241094
|
@@ -83,10 +83,14 @@ module AirTest
|
|
83
83
|
in_scenario_block = false
|
84
84
|
in_background_block = false
|
85
85
|
background_steps = []
|
86
|
+
|
86
87
|
blocks.each_with_index do |block, idx|
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
block_type = block["type"]
|
89
|
+
text = extract_text(block[block_type]["rich_text"]) rescue ""
|
90
|
+
|
91
|
+
# Detect headings for feature, background, and scenario
|
92
|
+
if %w[heading_1 heading_2 heading_3].include?(block_type)
|
93
|
+
heading_text = text.strip
|
90
94
|
if heading_text.downcase.include?("feature")
|
91
95
|
in_feature_block = true
|
92
96
|
in_scenario_block = false
|
@@ -107,10 +111,15 @@ module AirTest
|
|
107
111
|
in_scenario_block = false
|
108
112
|
in_background_block = false
|
109
113
|
end
|
110
|
-
|
111
|
-
|
114
|
+
elsif block_type == "paragraph" && text.strip.downcase.start_with?("scenario:")
|
115
|
+
# Also detect scenario in paragraphs (for robustness)
|
116
|
+
in_scenario_block = true
|
117
|
+
in_feature_block = false
|
118
|
+
in_background_block = false
|
119
|
+
current_scenario = { title: text.strip, steps: [] }
|
120
|
+
parsed_data[:scenarios] << current_scenario
|
121
|
+
elsif %w[paragraph bulleted_list_item numbered_list_item].include?(block_type)
|
112
122
|
next if text.empty?
|
113
|
-
|
114
123
|
if in_feature_block
|
115
124
|
parsed_data[:feature] += "\n#{text}"
|
116
125
|
elsif in_background_block
|
@@ -118,18 +127,7 @@ module AirTest
|
|
118
127
|
elsif in_scenario_block && current_scenario
|
119
128
|
current_scenario[:steps] << text
|
120
129
|
end
|
121
|
-
|
122
|
-
text = extract_text(block[block["type"]]["rich_text"])
|
123
|
-
next if text.empty?
|
124
|
-
|
125
|
-
if in_feature_block
|
126
|
-
parsed_data[:feature] += "\n• #{text}"
|
127
|
-
elsif in_background_block
|
128
|
-
background_steps << text
|
129
|
-
elsif in_scenario_block && current_scenario
|
130
|
-
current_scenario[:steps] << text
|
131
|
-
end
|
132
|
-
when "callout"
|
130
|
+
elsif block_type == "callout"
|
133
131
|
text = extract_text(block["callout"]["rich_text"])
|
134
132
|
next if text.empty?
|
135
133
|
|
@@ -145,21 +143,23 @@ module AirTest
|
|
145
143
|
end
|
146
144
|
end
|
147
145
|
end
|
146
|
+
|
148
147
|
# Prepend background steps to each scenario
|
149
148
|
if background_steps.any?
|
150
149
|
parsed_data[:scenarios].each do |scenario|
|
151
150
|
scenario[:steps] = background_steps + scenario[:steps]
|
152
151
|
end
|
153
152
|
end
|
154
|
-
|
153
|
+
|
154
|
+
# Fallback: If no scenarios found, treat all steps after feature as a single scenario
|
155
155
|
if parsed_data[:scenarios].empty?
|
156
|
-
# Try to find steps after the feature heading
|
157
156
|
steps = []
|
158
157
|
in_steps = false
|
159
158
|
blocks.each do |block|
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
block_type = block["type"]
|
160
|
+
text = extract_text(block[block_type]["rich_text"] || block["paragraph"]["rich_text"]) rescue ""
|
161
|
+
if %w[heading_1 heading_2 heading_3].include?(block_type)
|
162
|
+
heading_text = text.strip
|
163
163
|
if heading_text.downcase.include?("feature")
|
164
164
|
in_steps = true
|
165
165
|
elsif heading_text.downcase.include?("scenario")
|
@@ -167,16 +167,15 @@ module AirTest
|
|
167
167
|
else
|
168
168
|
in_steps = false
|
169
169
|
end
|
170
|
-
|
171
|
-
text
|
172
|
-
next if text.empty?
|
173
|
-
steps << text if in_steps
|
170
|
+
elsif %w[paragraph bulleted_list_item numbered_list_item].include?(block_type)
|
171
|
+
steps << text if in_steps && !text.empty?
|
174
172
|
end
|
175
173
|
end
|
176
174
|
if steps.any?
|
177
175
|
parsed_data[:scenarios] << { title: "Scenario", steps: steps }
|
178
176
|
end
|
179
177
|
end
|
178
|
+
|
180
179
|
parsed_data[:feature] = parsed_data[:feature].strip
|
181
180
|
parsed_data[:meta][:tags] = parsed_data[:meta][:tags].uniq
|
182
181
|
parsed_data
|
data/lib/air_test/version.rb
CHANGED