air_test 0.1.5.7 → 0.1.6.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 +4 -4
- data/README.md +170 -33
- data/exe/air_test +53 -46
- data/lib/air_test/cli.rb +522 -0
- data/lib/air_test/configuration.rb +37 -4
- data/lib/air_test/github_client.rb +4 -4
- data/lib/air_test/jira_ticket_parser.rb +86 -0
- data/lib/air_test/monday_ticket_parser.rb +99 -0
- data/lib/air_test/{notion_parser.rb → notion_ticket_parser.rb} +38 -30
- data/lib/air_test/runner.rb +21 -6
- data/lib/air_test/ticket_parser.rb +26 -0
- data/lib/air_test/version.rb +1 -1
- data/lib/air_test.rb +4 -1
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76572704e0d1a8c3abc7e274def6c51611efba858a6f434b6bbfd5f871aedf12
|
4
|
+
data.tar.gz: 11235311464e8fe0db11323d3f0fee3fb156c676ab4b3b56f7c02abf410a71d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 793c1fd212fcbd747c85abd0130f69dafa849035d4ce69595b72342f119c73f69c9be5f88fe8375e9c439a8be12e96c487f7e93f733f36957163df49d3647d8a
|
7
|
+
data.tar.gz: dca493fc7c39853ae784be49e4b187e3d8b752b2d0e7306f2532b4b7d71584e185130f922527598b2e07e64633a256173a5c1fb8dca2053aedcc7a53eac9ff6d
|
data/README.md
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
# air_test
|
2
2
|
|
3
|
-
Automate the generation of Turnip/RSpec specs from Notion tickets, create branches, commits, pushes, and GitHub Pull Requests—all with a single
|
3
|
+
Automate the generation of Turnip/RSpec specs from Notion tickets, create branches, commits, pushes, and GitHub Pull Requests—all with a single command.
|
4
4
|
|
5
5
|
## 🚀 Features
|
6
6
|
|
7
|
-
-
|
7
|
+
- **Multi-platform support**: Works with Notion, Jira, and Monday.com
|
8
|
+
- **Interactive CLI**: Choose which tickets to process
|
9
|
+
- **Search and filtering**: Find tickets by keyword
|
10
|
+
- **Dry-run mode**: Preview changes before applying them
|
11
|
+
- **Flexible PR creation**: Generate specs with or without automatic PRs
|
12
|
+
- Fetches tickets (Gherkin format)
|
8
13
|
- Parses and extracts features/scenarios
|
9
14
|
- Generates Turnip/RSpec spec files and matching step definitions
|
10
15
|
- Creates a dedicated branch, commits, pushes
|
@@ -31,9 +36,96 @@ bundle install
|
|
31
36
|
|
32
37
|
---
|
33
38
|
|
39
|
+
## 🛠 Quick Start
|
40
|
+
|
41
|
+
### 1. Initialize Configuration
|
42
|
+
|
43
|
+
Set up your project configuration interactively:
|
44
|
+
|
45
|
+
```sh
|
46
|
+
air_test init
|
47
|
+
```
|
48
|
+
|
49
|
+
This will:
|
50
|
+
- Ask which ticketing tool you use (Notion, Jira, or Monday)
|
51
|
+
- Configure your preferences (auto PR creation, dev assignee, etc.)
|
52
|
+
- Create `.airtest.yml` configuration file
|
53
|
+
- Create example environment file
|
54
|
+
- Set up necessary directories
|
55
|
+
|
56
|
+
For silent setup with defaults:
|
57
|
+
```sh
|
58
|
+
air_test init --silent
|
59
|
+
```
|
60
|
+
|
61
|
+
### 2. Set Environment Variables
|
62
|
+
|
63
|
+
Copy the example environment file and fill in your tokens:
|
64
|
+
|
65
|
+
```sh
|
66
|
+
cp .env.air_test.example .env
|
67
|
+
# Edit .env with your actual tokens
|
68
|
+
```
|
69
|
+
|
70
|
+
### 3. Generate Specs
|
71
|
+
|
72
|
+
#### Interactive Mode (Recommended)
|
73
|
+
```sh
|
74
|
+
air_test generate --interactive
|
75
|
+
```
|
76
|
+
Shows you a list of available tickets and lets you choose which ones to process.
|
77
|
+
|
78
|
+
#### Search and Filter
|
79
|
+
```sh
|
80
|
+
air_test generate --search "webhook"
|
81
|
+
```
|
82
|
+
Only processes tickets containing "webhook" in the title or content.
|
83
|
+
|
84
|
+
#### Preview Mode
|
85
|
+
```sh
|
86
|
+
air_test generate --dry-run
|
87
|
+
```
|
88
|
+
Shows what would be generated without creating files or PRs.
|
89
|
+
|
90
|
+
#### Disable PR Creation
|
91
|
+
```sh
|
92
|
+
air_test generate --no-pr
|
93
|
+
```
|
94
|
+
Generates spec files locally without creating Pull Requests.
|
95
|
+
|
96
|
+
---
|
97
|
+
|
34
98
|
## ⚙️ Configuration
|
35
99
|
|
36
|
-
|
100
|
+
### CLI Configuration (`.airtest.yml`)
|
101
|
+
|
102
|
+
The `air_test init` command creates a `.airtest.yml` file with your preferences:
|
103
|
+
|
104
|
+
```yaml
|
105
|
+
tool: notion # Your ticketing tool (notion/jira/monday)
|
106
|
+
auto_pr: 'yes' # Enable auto PR creation
|
107
|
+
dev_assignee: 'your-name' # Default dev assignee
|
108
|
+
interactive_mode: 'yes' # Enable interactive mode by default
|
109
|
+
notion:
|
110
|
+
token: ENV["NOTION_TOKEN"]
|
111
|
+
database_id: ENV["NOTION_DATABASE_ID"]
|
112
|
+
jira:
|
113
|
+
token: ENV["JIRA_TOKEN"]
|
114
|
+
project_id: ENV["JIRA_PROJECT_ID"]
|
115
|
+
domain: ENV["JIRA_DOMAIN"]
|
116
|
+
email: ENV["JIRA_EMAIL"]
|
117
|
+
monday:
|
118
|
+
token: ENV["MONDAY_TOKEN"]
|
119
|
+
board_id: ENV["MONDAY_BOARD_ID"]
|
120
|
+
domain: ENV["MONDAY_DOMAIN"]
|
121
|
+
github:
|
122
|
+
token: ENV["GITHUB_BOT_TOKEN"]
|
123
|
+
repo: 'your-org/your-repo'
|
124
|
+
```
|
125
|
+
|
126
|
+
### Rails Initializer (Optional)
|
127
|
+
|
128
|
+
For Rails projects, you can also create an initializer:
|
37
129
|
`config/initializers/air_test.rb`
|
38
130
|
|
39
131
|
```ruby
|
@@ -45,17 +137,15 @@ AirTest.configure do |config|
|
|
45
137
|
end
|
46
138
|
```
|
47
139
|
|
48
|
-
Make sure your environment variables are set (in `.env`, your shell, or your CI/CD).
|
49
|
-
|
50
140
|
---
|
51
141
|
|
52
|
-
## 📝 Creating
|
142
|
+
## 📝 Creating Tickets with Gherkin Format
|
53
143
|
|
54
|
-
To ensure that your
|
144
|
+
To ensure that your tickets are compatible with the air_test automation, follow these guidelines when creating your tickets:
|
55
145
|
|
56
|
-
### 1. Create a New Page
|
146
|
+
### 1. Create a New Page/Ticket
|
57
147
|
|
58
|
-
- Start by creating a new page in your Notion workspace for each ticket.
|
148
|
+
- Start by creating a new page in your Notion workspace, Jira issue, or Monday.com item for each ticket.
|
59
149
|
|
60
150
|
### 2. Use the Gherkin Syntax
|
61
151
|
|
@@ -68,68 +158,117 @@ To ensure that your Notion tickets are compatible with the air_test automation,
|
|
68
158
|
|
69
159
|
### 3. Example Structure
|
70
160
|
|
71
|
-
Here
|
161
|
+
Here's an example of how to structure a ticket:
|
72
162
|
|
163
|
+
```
|
73
164
|
Feature: User Login
|
74
165
|
Scenario: Successful login with valid credentials
|
75
166
|
Given the user is on the login page
|
76
167
|
When the user enters valid credentials
|
77
168
|
Then the user should be redirected to the dashboard
|
169
|
+
|
78
170
|
Scenario: Unsuccessful login with invalid credentials
|
79
171
|
Given the user is on the login page
|
80
172
|
When the user enters invalid credentials
|
81
173
|
Then an error message should be displayed
|
174
|
+
```
|
82
175
|
|
83
176
|
### 4. Additional Tips
|
84
177
|
|
85
178
|
- Ensure that each ticket is clearly titled and contains all necessary scenarios.
|
86
|
-
- Use bullet points or toggle lists
|
179
|
+
- Use bullet points or toggle lists to organize multiple scenarios under a single feature.
|
87
180
|
- Make sure to keep the Gherkin syntax consistent across all tickets for better parsing.
|
88
181
|
|
89
|
-
By following these guidelines, you can create Notion tickets that are ready to be parsed by the air_test automation tool.
|
90
|
-
|
91
182
|
---
|
92
183
|
|
93
|
-
## 🛠
|
184
|
+
## 🛠 CLI Commands
|
185
|
+
|
186
|
+
### `air_test init [--silent]`
|
187
|
+
Initialize AirTest configuration for your project.
|
94
188
|
|
95
|
-
|
189
|
+
**Options:**
|
190
|
+
- `--silent`: Use default values without prompts
|
96
191
|
|
192
|
+
**Examples:**
|
97
193
|
```sh
|
98
|
-
|
194
|
+
air_test init # Interactive setup
|
195
|
+
air_test init --silent # Silent setup with defaults
|
99
196
|
```
|
100
197
|
|
101
|
-
|
102
|
-
|
103
|
-
- Generate Turnip/RSpec specs and step files
|
104
|
-
- Create a branch, commit, push
|
105
|
-
- Open a Pull Request on GitHub with a rich template
|
198
|
+
### `air_test generate [options]`
|
199
|
+
Generate specs from tickets with advanced filtering and selection.
|
106
200
|
|
107
|
-
|
201
|
+
**Options:**
|
202
|
+
- `--interactive`: Interactive ticket selection
|
203
|
+
- `--search "keyword"`: Search tickets by keyword
|
204
|
+
- `--dry-run`: Preview changes without creating files
|
205
|
+
- `--no-pr`: Disable PR creation
|
108
206
|
|
109
|
-
|
207
|
+
**Examples:**
|
208
|
+
```sh
|
209
|
+
air_test generate # Process all ready tickets
|
210
|
+
air_test generate --interactive # Choose tickets interactively
|
211
|
+
air_test generate --search "webhook" --dry-run
|
212
|
+
air_test generate --no-pr # Generate files only, no PRs
|
213
|
+
```
|
110
214
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
215
|
+
### `air_test create-pr --ticket-id ID`
|
216
|
+
Create a Pull Request for a specific ticket (coming soon).
|
217
|
+
|
218
|
+
**Examples:**
|
219
|
+
```sh
|
220
|
+
air_test create-pr --ticket-id 123
|
221
|
+
```
|
222
|
+
|
223
|
+
### `air_test help`
|
224
|
+
Show help information and usage examples.
|
115
225
|
|
116
226
|
---
|
117
227
|
|
118
|
-
##
|
228
|
+
## 📋 Requirements
|
119
229
|
|
230
|
+
### Environment Variables
|
231
|
+
|
232
|
+
#### For Notion:
|
120
233
|
```
|
121
234
|
NOTION_TOKEN=secret_xxx
|
122
235
|
NOTION_DATABASE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
123
236
|
GITHUB_BOT_TOKEN=ghp_xxx
|
124
237
|
```
|
125
238
|
|
239
|
+
#### For Jira:
|
240
|
+
```
|
241
|
+
JIRA_TOKEN=your_jira_token
|
242
|
+
JIRA_PROJECT_ID=your_project_id
|
243
|
+
JIRA_DOMAIN=your_domain.atlassian.net
|
244
|
+
JIRA_EMAIL=your_email@example.com
|
245
|
+
GITHUB_BOT_TOKEN=ghp_xxx
|
246
|
+
```
|
247
|
+
|
248
|
+
#### For Monday.com:
|
249
|
+
```
|
250
|
+
MONDAY_TOKEN=your_monday_token
|
251
|
+
MONDAY_BOARD_ID=your_board_id
|
252
|
+
MONDAY_DOMAIN=your_domain.monday.com
|
253
|
+
GITHUB_BOT_TOKEN=ghp_xxx
|
254
|
+
```
|
255
|
+
|
256
|
+
### System Requirements
|
257
|
+
|
258
|
+
- A ticketing tool API token with access to your tickets
|
259
|
+
- A GitHub token with push and PR creation rights
|
260
|
+
- A configured remote git repository (`git remote -v`)
|
261
|
+
- The folders `spec/features` and `spec/steps` (created automatically if needed)
|
262
|
+
|
126
263
|
---
|
127
264
|
|
128
265
|
## 🆘 Troubleshooting
|
129
266
|
|
130
|
-
- **
|
131
|
-
- **
|
132
|
-
- **
|
267
|
+
- **Configuration not found**: Run `air_test init` to set up configuration
|
268
|
+
- **Authentication error**: Check your API tokens in environment variables
|
269
|
+
- **No tickets found**: Verify your ticketing tool configuration and permissions
|
270
|
+
- **PR not created**: Make sure the branch contains commits different from `main`
|
271
|
+
- **Permission issues**: Ensure the GitHub bot has access to the repo
|
133
272
|
|
134
273
|
---
|
135
274
|
|
@@ -142,5 +281,3 @@ GITHUB_BOT_TOKEN=ghp_xxx
|
|
142
281
|
|
143
282
|
**Need an integration example or install script?**
|
144
283
|
Open an issue or contact me!
|
145
|
-
|
146
|
-
---
|
data/exe/air_test
CHANGED
@@ -2,65 +2,72 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "fileutils"
|
5
|
+
require_relative "../lib/air_test/cli"
|
5
6
|
|
7
|
+
# Color constants
|
6
8
|
GREEN = "\e[32m"
|
7
9
|
YELLOW = "\e[33m"
|
8
10
|
RED = "\e[31m"
|
9
11
|
CYAN = "\e[36m"
|
10
12
|
RESET = "\e[0m"
|
11
13
|
|
12
|
-
|
14
|
+
def show_help
|
15
|
+
puts <<~HELP
|
16
|
+
#{CYAN}AirTest CLI - Test Generation Tool#{RESET}
|
13
17
|
|
14
|
-
|
15
|
-
if File.exist?(initializer_path)
|
16
|
-
puts "#{YELLOW}⚠️ #{initializer_path} already exists. Skipping.#{RESET}"
|
17
|
-
else
|
18
|
-
FileUtils.mkdir_p(File.dirname(initializer_path))
|
19
|
-
File.write(initializer_path, <<~RUBY)
|
20
|
-
AirTest.configure do |config|
|
21
|
-
config.notion_token = ENV['NOTION_TOKEN']
|
22
|
-
config.notion_database_id = ENV['NOTION_DATABASE_ID']
|
23
|
-
config.github_token = ENV['GITHUB_BOT_TOKEN']
|
24
|
-
config.repo = 'your-org/your-repo' # format: 'organization/repo_name'
|
25
|
-
end
|
26
|
-
RUBY
|
27
|
-
puts "#{GREEN}✅ Created #{initializer_path}#{RESET}"
|
28
|
-
end
|
18
|
+
Usage: air_test [command] [options]
|
29
19
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
puts "#{GREEN}✅ Created #{dir}/#{RESET}"
|
36
|
-
end
|
37
|
-
end
|
20
|
+
Commands:
|
21
|
+
init [--silent] Initialize AirTest configuration
|
22
|
+
generate [options] Generate specs from tickets
|
23
|
+
create-pr [options] Create PR for specific ticket
|
24
|
+
help Show this help message
|
38
25
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
26
|
+
Generate Options:
|
27
|
+
--interactive Interactive ticket selection
|
28
|
+
--search "keyword" Search tickets by keyword
|
29
|
+
--dry-run Preview changes without creating files
|
30
|
+
--no-pr Disable PR creation
|
31
|
+
|
32
|
+
Create PR Options:
|
33
|
+
--ticket-id ID Ticket ID to create PR for
|
34
|
+
|
35
|
+
Global Options:
|
36
|
+
--silent Run in silent mode (use defaults)
|
37
|
+
--help Show this help message
|
38
|
+
|
39
|
+
Examples:
|
40
|
+
air_test init # Interactive initialization
|
41
|
+
air_test init --silent # Silent initialization with defaults
|
42
|
+
air_test generate --interactive # Interactive ticket selection
|
43
|
+
air_test generate --search "webhook" --dry-run
|
44
|
+
air_test create-pr --ticket-id 3 # Create PR for ticket #3
|
45
|
+
air_test help # Show this help
|
46
|
+
HELP
|
49
47
|
end
|
50
48
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
def main
|
50
|
+
command = ARGV[0]
|
51
|
+
silent = ARGV.include?('--silent')
|
52
|
+
|
53
|
+
case command
|
54
|
+
when 'init'
|
55
|
+
cli = AirTest::CLI.new
|
56
|
+
cli.init(silent: silent)
|
57
|
+
when 'generate'
|
58
|
+
cli = AirTest::CLI.new
|
59
|
+
cli.generate(ARGV[1..-1])
|
60
|
+
when 'create-pr'
|
61
|
+
cli = AirTest::CLI.new
|
62
|
+
cli.create_pr(ARGV[1..-1])
|
63
|
+
when 'help', '--help', '-h', nil
|
64
|
+
show_help
|
57
65
|
else
|
58
|
-
puts "#{
|
66
|
+
puts "#{RED}❌ Unknown command: #{command}#{RESET}"
|
67
|
+
puts "Run 'air_test help' for usage information."
|
68
|
+
exit 1
|
59
69
|
end
|
60
70
|
end
|
61
71
|
|
62
|
-
|
63
|
-
|
64
|
-
puts " 2. Add your tokens to .env or your environment"
|
65
|
-
puts " 3. Run: bundle exec rake air_test:generate_specs_from_notion"
|
66
|
-
puts "\nHappy testing! 🎉"
|
72
|
+
# Run the CLI
|
73
|
+
main
|