air_test 0.1.5.0 → 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 +43 -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
|
@@ -81,43 +81,53 @@ module AirTest
|
|
81
81
|
current_scenario = nil
|
82
82
|
in_feature_block = false
|
83
83
|
in_scenario_block = false
|
84
|
-
|
84
|
+
in_background_block = false
|
85
|
+
background_steps = []
|
86
|
+
|
85
87
|
blocks.each_with_index do |block, idx|
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
89
94
|
if heading_text.downcase.include?("feature")
|
90
95
|
in_feature_block = true
|
91
96
|
in_scenario_block = false
|
97
|
+
in_background_block = false
|
92
98
|
parsed_data[:feature] = heading_text
|
99
|
+
elsif heading_text.strip.downcase == "background:"
|
100
|
+
in_background_block = true
|
101
|
+
in_feature_block = false
|
102
|
+
in_scenario_block = false
|
93
103
|
elsif heading_text.downcase.include?("scenario")
|
94
104
|
in_scenario_block = true
|
95
105
|
in_feature_block = false
|
106
|
+
in_background_block = false
|
96
107
|
current_scenario = { title: heading_text, steps: [] }
|
97
108
|
parsed_data[:scenarios] << current_scenario
|
98
109
|
else
|
99
110
|
in_feature_block = false
|
100
111
|
in_scenario_block = false
|
112
|
+
in_background_block = false
|
101
113
|
end
|
102
|
-
|
103
|
-
|
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)
|
104
122
|
next if text.empty?
|
105
|
-
|
106
123
|
if in_feature_block
|
107
124
|
parsed_data[:feature] += "\n#{text}"
|
125
|
+
elsif in_background_block
|
126
|
+
background_steps << text
|
108
127
|
elsif in_scenario_block && current_scenario
|
109
128
|
current_scenario[:steps] << text
|
110
129
|
end
|
111
|
-
|
112
|
-
text = extract_text(block[block["type"]]["rich_text"])
|
113
|
-
next if text.empty?
|
114
|
-
|
115
|
-
if in_feature_block
|
116
|
-
parsed_data[:feature] += "\n• #{text}"
|
117
|
-
elsif in_scenario_block && current_scenario
|
118
|
-
current_scenario[:steps] << text
|
119
|
-
end
|
120
|
-
when "callout"
|
130
|
+
elsif block_type == "callout"
|
121
131
|
text = extract_text(block["callout"]["rich_text"])
|
122
132
|
next if text.empty?
|
123
133
|
|
@@ -132,17 +142,24 @@ module AirTest
|
|
132
142
|
parsed_data[:meta][:assignee] = extract_assignee(text)
|
133
143
|
end
|
134
144
|
end
|
135
|
-
last_block_type = block["type"]
|
136
145
|
end
|
137
|
-
|
146
|
+
|
147
|
+
# Prepend background steps to each scenario
|
148
|
+
if background_steps.any?
|
149
|
+
parsed_data[:scenarios].each do |scenario|
|
150
|
+
scenario[:steps] = background_steps + scenario[:steps]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Fallback: If no scenarios found, treat all steps after feature as a single scenario
|
138
155
|
if parsed_data[:scenarios].empty?
|
139
|
-
# Try to find steps after the feature heading
|
140
156
|
steps = []
|
141
157
|
in_steps = false
|
142
158
|
blocks.each do |block|
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
146
163
|
if heading_text.downcase.include?("feature")
|
147
164
|
in_steps = true
|
148
165
|
elsif heading_text.downcase.include?("scenario")
|
@@ -150,16 +167,15 @@ module AirTest
|
|
150
167
|
else
|
151
168
|
in_steps = false
|
152
169
|
end
|
153
|
-
|
154
|
-
text
|
155
|
-
next if text.empty?
|
156
|
-
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?
|
157
172
|
end
|
158
173
|
end
|
159
174
|
if steps.any?
|
160
175
|
parsed_data[:scenarios] << { title: "Scenario", steps: steps }
|
161
176
|
end
|
162
177
|
end
|
178
|
+
|
163
179
|
parsed_data[:feature] = parsed_data[:feature].strip
|
164
180
|
parsed_data[:meta][:tags] = parsed_data[:meta][:tags].uniq
|
165
181
|
parsed_data
|
data/lib/air_test/version.rb
CHANGED