air_test 0.1.5.4 β†’ 0.1.5.7

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: ec50dc985e53dbbb63a785aee66594b94387384039f7db14677004ee2fce3178
4
- data.tar.gz: bf0a4675e548c04c695059e949674c9b6ca2d67ce1135471a56ff09072fe1aa5
3
+ metadata.gz: 8174f558c0b41c33acc6d4a468ad38c36e621c188a6ea022b7dc2ae500fcee3c
4
+ data.tar.gz: d84cc877b0841689de2f62e7055b68955fcf7352bbda10f65cc60969f959a1ac
5
5
  SHA512:
6
- metadata.gz: f9321031cb35c3c6bac0f6400edb9efb8f8305247c64a9a6cf3136931dcbcd908ccf3b80feca89bb550744359f679addd6b0f84c2fd03794f3dba7dc78544bc4
7
- data.tar.gz: 2521991e2cbe8dd447a4192436c1b2123d2e5313fbf04ce7a81f27a81a12e26f719f3ce8dfb880a39334d658cd105cfe73d0f91c74f6cf2a71ce285ae6b55f25
6
+ metadata.gz: f2089f266b3606af5c05f5153305a56e1e695391642c3b5775c81ba55b8d4752748628d74ec6e30f3a3b0df0d02cd2aca856fcf8b8d4350eaaa0fc3833b9cb44
7
+ data.tar.gz: c41e1ca2dfeb4e694126276a262dded5e62e1e0252024ecca5a6a9cbcb46a39d61e80754a0488cfee83b4e844604bba1362ad790e1f009b83df30f48b7e75b1f
data/README.md CHANGED
@@ -49,6 +49,47 @@ Make sure your environment variables are set (in `.env`, your shell, or your CI/
49
49
 
50
50
  ---
51
51
 
52
+ ## πŸ“ Creating Notion Tickets with Gherkin Format
53
+
54
+ To ensure that your Notion tickets are compatible with the air_test automation, follow these guidelines when creating your tickets:
55
+
56
+ ### 1. Create a New Page in Notion
57
+
58
+ - Start by creating a new page in your Notion workspace for each ticket.
59
+
60
+ ### 2. Use the Gherkin Syntax
61
+
62
+ - Each ticket should follow the Gherkin syntax, which includes the following keywords:
63
+ - **Feature**: A high-level description of the feature being implemented.
64
+ - **Scenario**: A specific situation or case that describes how the feature should behave.
65
+ - **Given**: The initial context or state before the scenario starts.
66
+ - **When**: The action that triggers the scenario.
67
+ - **Then**: The expected outcome or result of the action.
68
+
69
+ ### 3. Example Structure
70
+
71
+ Here’s an example of how to structure a ticket in Notion:
72
+
73
+ Feature: User Login
74
+ Scenario: Successful login with valid credentials
75
+ Given the user is on the login page
76
+ When the user enters valid credentials
77
+ Then the user should be redirected to the dashboard
78
+ Scenario: Unsuccessful login with invalid credentials
79
+ Given the user is on the login page
80
+ When the user enters invalid credentials
81
+ Then an error message should be displayed
82
+
83
+ ### 4. Additional Tips
84
+
85
+ - Ensure that each ticket is clearly titled and contains all necessary scenarios.
86
+ - Use bullet points or toggle lists in Notion to organize multiple scenarios under a single feature.
87
+ - Make sure to keep the Gherkin syntax consistent across all tickets for better parsing.
88
+
89
+ By following these guidelines, you can create Notion tickets that are ready to be parsed by the air_test automation tool.
90
+
91
+ ---
92
+
52
93
  ## πŸ›  Usage
53
94
 
54
95
  Run the automated workflow from your Rails project terminal:
@@ -74,17 +115,6 @@ bundle exec rake air_test:generate_specs_from_notion
74
115
 
75
116
  ---
76
117
 
77
- ## 🧩 Gem Structure
78
-
79
- - `lib/air_test/configuration.rb`: centralized configuration
80
- - `lib/air_test/notion_parser.rb`: Notion extraction and parsing
81
- - `lib/air_test/spec_generator.rb`: spec and step file generation
82
- - `lib/air_test/github_client.rb`: git and GitHub PR management
83
- - `lib/air_test/runner.rb`: workflow orchestrator
84
- - `lib/tasks/air_test.rake`: Rake task to launch the automation
85
-
86
- ---
87
-
88
118
  ## πŸ“ Example .env
89
119
 
90
120
  ```
@@ -103,17 +133,6 @@ GITHUB_BOT_TOKEN=ghp_xxx
103
133
 
104
134
  ---
105
135
 
106
- ## πŸ“¦ Publishing the Gem (optional)
107
-
108
- To publish the gem on RubyGems:
109
-
110
- ```sh
111
- gem build air_test.gemspec
112
- gem push air_test-x.y.z.gem
113
- ```
114
-
115
- ---
116
-
117
136
  ## πŸ‘¨β€πŸ’» Author & License
118
137
 
119
138
  - Author: [Airtest]
@@ -26,9 +26,16 @@ module AirTest
26
26
 
27
27
  def parse_ticket_content(page_id)
28
28
  blocks = get_page_content(page_id)
29
+ # puts "\n===== RAW NOTION BLOCKS ====="
30
+ # puts JSON.pretty_generate(blocks)
29
31
  return nil unless blocks
30
-
31
- parse_content(blocks)
32
+ normalized_blocks = normalize_blocks(blocks)
33
+ # puts "\n===== NORMALIZED BLOCKS ====="
34
+ # puts JSON.pretty_generate(normalized_blocks)
35
+ parsed_data = parse_content(normalized_blocks)
36
+ # puts "\n===== PARSED DATA ====="
37
+ # puts JSON.pretty_generate(parsed_data)
38
+ parsed_data
32
39
  end
33
40
 
34
41
  def extract_ticket_title(ticket)
@@ -220,6 +227,31 @@ module AirTest
220
227
  ""
221
228
  end
222
229
  end
230
+
231
+ # Normalize Notion blocks: split multi-line blocks into one-line synthetic paragraph blocks
232
+ def normalize_blocks(blocks)
233
+ normalized = []
234
+ blocks.each do |block|
235
+ block_type = block["type"]
236
+ text = if block[block_type] && block[block_type]["rich_text"]
237
+ block[block_type]["rich_text"].map { |rt| rt["plain_text"] }.join("")
238
+ else
239
+ ""
240
+ end
241
+ lines = text.split("\n").map(&:strip).reject(&:empty?)
242
+ if lines.size > 1
243
+ lines.each do |line|
244
+ normalized << {
245
+ "type" => "paragraph",
246
+ "paragraph" => { "rich_text" => [{ "plain_text" => line }] }
247
+ }
248
+ end
249
+ else
250
+ normalized << block
251
+ end
252
+ end
253
+ normalized
254
+ end
223
255
  end
224
256
  end
225
257
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AirTest
4
- VERSION = "0.1.5.4"
4
+ VERSION = "0.1.5.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.4
4
+ version: 0.1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - julien bouland