nukadoko 0.3.0 → 0.5.0
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/CHANGELOG.md +93 -0
- data/README.ja.md +11 -1
- data/README.md +10 -2
- data/lib/nukadoko/check.rb +73 -5
- data/lib/nukadoko/claim_sides.rb +12 -0
- data/lib/nukadoko/cli.rb +9 -1
- data/lib/nukadoko/command.rb +22 -4
- data/lib/nukadoko/error_frames.rb +44 -0
- data/lib/nukadoko/features.rb +3 -1
- data/lib/nukadoko/fixtures.rb +108 -7
- data/lib/nukadoko/parameter_types.rb +54 -0
- data/lib/nukadoko/pattern.rb +52 -2
- data/lib/nukadoko/run.rb +134 -28
- data/lib/nukadoko/run_record.rb +9 -5
- data/lib/nukadoko/scaffold.rb +2 -2
- data/lib/nukadoko/schema.rb +165 -37
- data/lib/nukadoko/step_fixtures.rb +225 -0
- data/lib/nukadoko/trace_actions.rb +4 -2
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +1 -1
- data/lib/nukadoko.rb +4 -0
- data/llms.txt +10 -8
- data/sig/generated/nukadoko/check.rbs +10 -0
- data/sig/generated/nukadoko/claim_sides.rbs +13 -4
- data/sig/generated/nukadoko/command.rbs +13 -4
- data/sig/generated/nukadoko/error_frames.rbs +24 -0
- data/sig/generated/nukadoko/fixtures.rbs +38 -2
- data/sig/generated/nukadoko/parameter_types.rbs +27 -0
- data/sig/generated/nukadoko/pattern.rbs +25 -1
- data/sig/generated/nukadoko/run.rbs +32 -4
- data/sig/generated/nukadoko/schema.rbs +91 -27
- data/sig/generated/nukadoko/step_fixtures.rbs +129 -0
- data/sig/generated/nukadoko/trace_actions.rbs +3 -1
- data/skills/nukadoko/SKILL.md +1 -1
- data/skills/nukadoko/references/ruby.md +80 -0
- metadata +12 -5
|
@@ -4,8 +4,19 @@
|
|
|
4
4
|
# a value must pass at run time, the RBS a Steep user checks the step body
|
|
5
5
|
# against, and the Data class the body receives. A type is a symbol for a
|
|
6
6
|
# scalar, `[:array, type]` for a list, or a nested Schema for an object.
|
|
7
|
+
# `[:checked, type, checks]` is an array item with bounds of its own.
|
|
8
|
+
#
|
|
9
|
+
# Each field method takes the options zod spells as methods: `null: true`
|
|
10
|
+
# (`.nullable()`), `optional: true` (`.optional()`: the key may be absent,
|
|
11
|
+
# and the body reads nil), `default:` (`.default(x)`: an absent key reads
|
|
12
|
+
# as the value), and bounds: `min:` and `max:` (a number's value, a
|
|
13
|
+
# string's length, an array's item count), `positive: true` (> 0) and
|
|
14
|
+
# `negative: true` (< 0).
|
|
7
15
|
module Nukadoko
|
|
8
16
|
class Schema
|
|
17
|
+
# The value of `default` when the field declares none.
|
|
18
|
+
NONE: untyped
|
|
19
|
+
|
|
9
20
|
class Field < Data
|
|
10
21
|
attr_reader name(): Symbol
|
|
11
22
|
|
|
@@ -13,14 +24,31 @@ module Nukadoko
|
|
|
13
24
|
|
|
14
25
|
attr_reader description(): String?
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
attr_reader optional(): bool
|
|
28
|
+
|
|
29
|
+
attr_reader default(): untyped
|
|
30
|
+
|
|
31
|
+
attr_reader checks(): Hash[Symbol, untyped]
|
|
18
32
|
|
|
19
|
-
def self.
|
|
33
|
+
def self.new: (Symbol name, untyped type, String? description, bool optional, untyped default, Hash[Symbol, untyped] checks) -> instance
|
|
34
|
+
| (name: Symbol, type: untyped, description: String?, optional: bool, default: untyped, checks: Hash[Symbol, untyped]) -> instance
|
|
20
35
|
|
|
21
|
-
def members: () -> [ :name, :type, :description ]
|
|
36
|
+
def self.members: () -> [ :name, :type, :description, :optional, :default, :checks ]
|
|
37
|
+
|
|
38
|
+
def members: () -> [ :name, :type, :description, :optional, :default, :checks ]
|
|
22
39
|
end
|
|
23
40
|
|
|
41
|
+
class Field
|
|
42
|
+
# An absent key passes: the field is optional or has a default.
|
|
43
|
+
# : () -> bool
|
|
44
|
+
def absent_ok?: () -> bool
|
|
45
|
+
|
|
46
|
+
# : () -> bool
|
|
47
|
+
def default?: () -> bool
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
CHECKS: untyped
|
|
51
|
+
|
|
24
52
|
# : () ?{ () [self: Schema] -> void } -> Schema
|
|
25
53
|
def self.build: () ?{ () [self: Schema] -> void } -> Schema
|
|
26
54
|
|
|
@@ -29,33 +57,45 @@ module Nukadoko
|
|
|
29
57
|
# : (?Array[Field]) -> void
|
|
30
58
|
def initialize: (?Array[Field]) -> void
|
|
31
59
|
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
60
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
61
|
+
def string: (Symbol, ?String?, **untyped) -> void
|
|
62
|
+
|
|
63
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
64
|
+
def boolean: (Symbol, ?String?, **untyped) -> void
|
|
35
65
|
|
|
36
|
-
# : (Symbol, ?String?,
|
|
37
|
-
def
|
|
66
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
67
|
+
def integer: (Symbol, ?String?, **untyped) -> void
|
|
38
68
|
|
|
39
|
-
# : (Symbol, ?String?,
|
|
40
|
-
def
|
|
69
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
70
|
+
def number: (Symbol, ?String?, **untyped) -> void
|
|
41
71
|
|
|
42
|
-
# : (Symbol, ?String?,
|
|
43
|
-
def
|
|
72
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
73
|
+
def unknown: (Symbol, ?String?, **untyped) -> void
|
|
44
74
|
|
|
45
|
-
# : (Symbol, ?String
|
|
46
|
-
def
|
|
75
|
+
# : (Symbol, Array[String | Symbol], ?String?, **untyped) -> void
|
|
76
|
+
def enum: (Symbol, Array[String | Symbol], ?String?, **untyped) -> void
|
|
47
77
|
|
|
48
|
-
# : (Symbol,
|
|
49
|
-
def
|
|
78
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
79
|
+
def strings: (Symbol, ?String?, **untyped) -> void
|
|
50
80
|
|
|
51
|
-
# : (Symbol, ?String?,
|
|
52
|
-
def
|
|
81
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
82
|
+
def numbers: (Symbol, ?String?, **untyped) -> void
|
|
53
83
|
|
|
54
|
-
# : (Symbol, ?String?,
|
|
55
|
-
def
|
|
84
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
85
|
+
def integers: (Symbol, ?String?, **untyped) -> void
|
|
56
86
|
|
|
57
|
-
# : (Symbol, ?String?,
|
|
58
|
-
def
|
|
87
|
+
# : (Symbol, ?String?, **untyped) -> void
|
|
88
|
+
def table: (Symbol, ?String?, **untyped) -> void
|
|
89
|
+
|
|
90
|
+
# : (Symbol, ?String?, **untyped) { () [self: Schema] -> void } -> void
|
|
91
|
+
def object: (Symbol, ?String?, **untyped) { () [self: Schema] -> void } -> void
|
|
92
|
+
|
|
93
|
+
# A list: of objects the block declares (`array :todos do string :id end`),
|
|
94
|
+
# or of `of:` (:string, :number, :integer, :boolean, or a Schema).
|
|
95
|
+
# `each:` holds bounds every item meets (`each: { positive: true }`);
|
|
96
|
+
# `min:` and `max:` bound the item count.
|
|
97
|
+
# : (Symbol, ?String?, ?of: untyped, ?each: Hash[Symbol, untyped], **untyped) ?{ () [self: Schema] -> void } -> void
|
|
98
|
+
def array: (Symbol, ?String?, ?of: untyped, ?each: Hash[Symbol, untyped], **untyped) ?{ () [self: Schema] -> void } -> void
|
|
59
99
|
|
|
60
100
|
# Reuses a field another step declared, so two contracts that must agree
|
|
61
101
|
# on one shape are written once: `field :created, AnItemExists.returns[:body]`.
|
|
@@ -65,6 +105,10 @@ module Nukadoko
|
|
|
65
105
|
# : (Symbol | String) -> Field?
|
|
66
106
|
def []: (Symbol | String) -> Field?
|
|
67
107
|
|
|
108
|
+
# The keys a value must hold: neither optional nor defaulted.
|
|
109
|
+
# : () -> Array[String]
|
|
110
|
+
def required_names: () -> Array[String]
|
|
111
|
+
|
|
68
112
|
# : (Array[String]) -> Schema
|
|
69
113
|
def without: (Array[String]) -> Schema
|
|
70
114
|
|
|
@@ -122,6 +166,15 @@ module Nukadoko
|
|
|
122
166
|
# : (untyped, untyped, String) -> Array[String]
|
|
123
167
|
def self.type_problems: (untyped, untyped, String) -> Array[String]
|
|
124
168
|
|
|
169
|
+
# A bound zod reports in its own words, once the type passed: a number's
|
|
170
|
+
# value, a string's length in UTF-16 units, an array's item count.
|
|
171
|
+
# : (Hash[Symbol, untyped], untyped, String) -> Array[String]
|
|
172
|
+
def self.check_problems: (Hash[Symbol, untyped], untyped, String) -> Array[String]
|
|
173
|
+
|
|
174
|
+
# A number as JavaScript prints it: 2.0 is 2.
|
|
175
|
+
# : (Numeric) -> String
|
|
176
|
+
def self.js: (Numeric) -> String
|
|
177
|
+
|
|
125
178
|
# zod's int: a finite whole number within Number.MAX_SAFE_INTEGER.
|
|
126
179
|
# : (untyped) -> String?
|
|
127
180
|
def self.integer_problem: (untyped) -> String?
|
|
@@ -132,8 +185,15 @@ module Nukadoko
|
|
|
132
185
|
# : (?root: bool, ?output: bool) -> Hash[Symbol, untyped]
|
|
133
186
|
def json_schema: (?root: bool, ?output: bool) -> Hash[Symbol, untyped]
|
|
134
187
|
|
|
135
|
-
#
|
|
136
|
-
|
|
188
|
+
# As z.toJSONSchema writes it, bounds included and in its key order.
|
|
189
|
+
# : (untyped, ?bool, ?Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
190
|
+
def self.json_type: (untyped, ?bool, ?Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
191
|
+
|
|
192
|
+
# : (Hash[Symbol, untyped], Integer?, Integer?) -> Hash[Symbol, untyped]
|
|
193
|
+
def self.number_bounds: (Hash[Symbol, untyped], Integer?, Integer?) -> Hash[Symbol, untyped]
|
|
194
|
+
|
|
195
|
+
# : (Hash[Symbol, untyped], Symbol, Symbol) -> Hash[Symbol, untyped]
|
|
196
|
+
def self.length_bounds: (Hash[Symbol, untyped], Symbol, Symbol) -> Hash[Symbol, untyped]
|
|
137
197
|
|
|
138
198
|
# : () -> Array[String]
|
|
139
199
|
def rbs_fields: () -> Array[String]
|
|
@@ -141,13 +201,17 @@ module Nukadoko
|
|
|
141
201
|
# : () -> String
|
|
142
202
|
def rbs_record: () -> String
|
|
143
203
|
|
|
204
|
+
# An optional key reads as nil when it is absent.
|
|
205
|
+
# : (Field) -> String
|
|
206
|
+
def self.rbs_field: (Field) -> String
|
|
207
|
+
|
|
144
208
|
# : (untyped) -> String
|
|
145
209
|
def self.rbs_type: (untyped) -> String
|
|
146
210
|
|
|
147
211
|
private
|
|
148
212
|
|
|
149
|
-
# : (Symbol, untyped, String?, ?bool) -> void
|
|
150
|
-
def add: (Symbol, untyped, String?, ?bool) -> void
|
|
213
|
+
# : (Symbol, untyped, String?, ?null: bool, ?optional: bool, ?default: untyped, **untyped) -> void
|
|
214
|
+
def add: (Symbol, untyped, String?, ?null: bool, ?optional: bool, ?default: untyped, **untyped) -> void
|
|
151
215
|
|
|
152
216
|
# : (String?, Symbol | String) -> String
|
|
153
217
|
def join: (String?, Symbol | String) -> String
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/step_fixtures.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The fixtures a step body uses to say where it went, to wait for a state
|
|
4
|
+
# that is not there yet, and to keep evidence only it can produce. The
|
|
5
|
+
# TypeScript engine gives the same three on ctx. Each one fills a list the
|
|
6
|
+
# engine writes into the step record, also when the step raises, because a
|
|
7
|
+
# failed step is the one whose record a reader opens.
|
|
8
|
+
module Nukadoko
|
|
9
|
+
# poll gave up: the budget ended before the block returned a value.
|
|
10
|
+
class PollTimeoutError < StandardError
|
|
11
|
+
attr_reader timeout_ms: Numeric
|
|
12
|
+
|
|
13
|
+
attr_reader description: String?
|
|
14
|
+
|
|
15
|
+
# : (Numeric, String?) -> void
|
|
16
|
+
def initialize: (Numeric, String?) -> void
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# A timeout or interval that cannot be a budget. Raised before the first
|
|
20
|
+
# attempt, so it is not in the record: there is no attempt to count.
|
|
21
|
+
class InvalidPollOptionsError < ArgumentError
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# An evidence name that would land outside the step's directory.
|
|
25
|
+
class InvalidEvidenceNameError < ArgumentError
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An evidence name the engine itself writes into the step's directory.
|
|
29
|
+
class ReservedEvidenceNameError < ArgumentError
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# A pageAs name that cannot be part of a file name.
|
|
33
|
+
class InvalidContextNameError < ArgumentError
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# A pageAs call that asks an open context for options it was not made with.
|
|
37
|
+
class ContextOptionsConflictError < ArgumentError
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
module Engine
|
|
41
|
+
# : () -> String
|
|
42
|
+
def self.now_iso: () -> String
|
|
43
|
+
|
|
44
|
+
# `section.("label")` marks that the body reached a stage. It is a bare
|
|
45
|
+
# marker, not a block wrapper, so nesting and an early return need no
|
|
46
|
+
# meaning: the record answers where the body stopped.
|
|
47
|
+
class Sections
|
|
48
|
+
attr_reader entries: Array[Hash[Symbol, String]]
|
|
49
|
+
|
|
50
|
+
# : () -> void
|
|
51
|
+
def initialize: () -> void
|
|
52
|
+
|
|
53
|
+
# : (String | Symbol) -> nil
|
|
54
|
+
def call: (String | Symbol) -> nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# `poll.(description:, timeout:, interval:) { value or nil }` calls the
|
|
58
|
+
# block until it gives a value other than nil. The budget holds the
|
|
59
|
+
# attempt in flight too, so a value that arrives after it is not
|
|
60
|
+
# returned. Every finished call is kept, so the record tells a wait that
|
|
61
|
+
# did nothing from one that took seconds.
|
|
62
|
+
class Polls
|
|
63
|
+
DEFAULT_TIMEOUT_MS: ::Integer
|
|
64
|
+
|
|
65
|
+
DEFAULT_INTERVAL_MS: ::Integer
|
|
66
|
+
|
|
67
|
+
# The longest timer Node accepts, kept so both engines refuse the same values.
|
|
68
|
+
MAX_MS: ::Integer
|
|
69
|
+
|
|
70
|
+
# An Exception, not a StandardError, so a block that rescues its own
|
|
71
|
+
# errors cannot swallow the end of its budget.
|
|
72
|
+
class AttemptOver < Exception
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
attr_reader entries: Array[Hash[Symbol, untyped]]
|
|
76
|
+
|
|
77
|
+
# : () -> void
|
|
78
|
+
def initialize: () -> void
|
|
79
|
+
|
|
80
|
+
# : [T] (?description: String?, ?timeout: Numeric?, ?interval: Numeric?) { () -> T? } -> T
|
|
81
|
+
def call: [T] (?description: String?, ?timeout: Numeric?, ?interval: Numeric?) { () -> T? } -> T
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
# The budget in seconds, from milliseconds.
|
|
86
|
+
# : (untyped, String) -> Float
|
|
87
|
+
def budget: (untyped, String) -> Float
|
|
88
|
+
|
|
89
|
+
# : () -> Float
|
|
90
|
+
def monotonic: () -> Float
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# `evidence.attach(name, body)` writes a file into the step's own
|
|
94
|
+
# directory, and `evidence.path(name)` gives a path there without
|
|
95
|
+
# writing. A name used twice keeps both files. A name that differs only
|
|
96
|
+
# by case counts as the same, since a case-insensitive volume would put
|
|
97
|
+
# the two on one file.
|
|
98
|
+
class Evidence
|
|
99
|
+
# The files and directories the engine writes into the same directory.
|
|
100
|
+
HARNESS: untyped
|
|
101
|
+
|
|
102
|
+
PROCESS_FILE: ::Regexp
|
|
103
|
+
|
|
104
|
+
NAMED_FILE: ::Regexp
|
|
105
|
+
|
|
106
|
+
MAX_ATTACHMENTS: ::Integer
|
|
107
|
+
|
|
108
|
+
# : (String, ?reserved: Array[String]) -> void
|
|
109
|
+
def initialize: (String, ?reserved: Array[String]) -> void
|
|
110
|
+
|
|
111
|
+
# : (String | Symbol, String) -> nil
|
|
112
|
+
def attach: (String | Symbol, String) -> nil
|
|
113
|
+
|
|
114
|
+
# : (String | Symbol) -> String
|
|
115
|
+
def path: (String | Symbol) -> String
|
|
116
|
+
|
|
117
|
+
# What the step left: its attachments, and each path it wrote to, by
|
|
118
|
+
# time, at most MAX_ATTACHMENTS of them, with the whole count when
|
|
119
|
+
# there were more.
|
|
120
|
+
# : () -> [Array[Hash[Symbol, String]], Integer?]
|
|
121
|
+
def snapshot: () -> [ Array[Hash[Symbol, String]], Integer? ]
|
|
122
|
+
|
|
123
|
+
private
|
|
124
|
+
|
|
125
|
+
# : (String) -> String
|
|
126
|
+
def allocate: (String) -> String
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
module Nukadoko
|
|
12
12
|
module Engine
|
|
13
13
|
module TraceActions
|
|
14
|
-
# Version 8 as the TypeScript engine measured it,
|
|
14
|
+
# Version 8 as the TypeScript engine measured it, version 9 as
|
|
15
|
+
# Playwright 1.63.0 writes it (the same fields and the same actions as
|
|
16
|
+
# version 8), and version 10 as
|
|
15
17
|
# Playwright 1.65.1 writes it for the Ruby client: the same `before`
|
|
16
18
|
# and `after` fields, with a number for `callId`.
|
|
17
19
|
KNOWN_VERSIONS: untyped
|
data/skills/nukadoko/SKILL.md
CHANGED
|
@@ -44,7 +44,7 @@ never commits, pushes, or publishes. Keep the narration short.
|
|
|
44
44
|
Run `nuka` from the directory that holds the config, and `nuka init` first
|
|
45
45
|
when there is none (`references/running.md`, "Setting up"); an app to start
|
|
46
46
|
needs the program in `nukadoko.config.ts` (`references/program.md`). A Ruby project
|
|
47
|
-
writes steps as
|
|
47
|
+
writes steps as `references/ruby.md` says. Pick one line:
|
|
48
48
|
|
|
49
49
|
1. **Prose only** (a ticket, a request, a conversation):
|
|
50
50
|
`references/from-prose.md`, then line 2.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Writing steps in Ruby
|
|
2
|
+
|
|
3
|
+
The other references show steps in TypeScript. A Ruby project (the
|
|
4
|
+
`nukadoko` gem) reads the same feature files, runs the same loop, and
|
|
5
|
+
writes the same records; only the step files and the config differ. This
|
|
6
|
+
page says how each TypeScript shape in the other references reads in Ruby.
|
|
7
|
+
The full surface is the gem's README
|
|
8
|
+
(<https://github.com/meganemura/nukadoko/blob/main/ruby/README.md>), and
|
|
9
|
+
`conformance/cases/` in the repository holds the same projects in both
|
|
10
|
+
languages (`steps-ts/` beside `steps-rb/`), which both engines must judge
|
|
11
|
+
the same way.
|
|
12
|
+
|
|
13
|
+
Run every command as `bundle exec nuka`.
|
|
14
|
+
|
|
15
|
+
## A step
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# features/steps/add_todo.rb is the step add-todo.
|
|
19
|
+
class AddTodo < Nukadoko::Step
|
|
20
|
+
pattern "a todo titled {title:string} is added"
|
|
21
|
+
description "Create a todo via POST /todos and return the created record"
|
|
22
|
+
args { string :title, "The title of the todo to create" }
|
|
23
|
+
returns do
|
|
24
|
+
string :id, "The id the server assigned"
|
|
25
|
+
boolean :done, "Whether the todo is done; false for a new one"
|
|
26
|
+
end
|
|
27
|
+
mutates true
|
|
28
|
+
|
|
29
|
+
def run(request:, args:)
|
|
30
|
+
request.post("/todos", data: { title: args.title }).json
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| TypeScript | Ruby |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `defineStep({ ... })` in `add-todo.ts` | `class AddTodo < Nukadoko::Step` in `add_todo.rb` |
|
|
38
|
+
| `z.object({ title: z.string().describe("...") })` | `args { string :title, "..." }` |
|
|
39
|
+
| `.optional()`, `.default(10)`, `.min(1)`, `.positive()` | `optional: true`, `default: 10`, `min: 1`, `positive: true` |
|
|
40
|
+
| `z.array(z.object({ ... }))` | `array :todos, "..." do ... end` |
|
|
41
|
+
| `async run({ request }, { title })` | `def run(request:, args:)`, reading `args.title` |
|
|
42
|
+
| `from: { id: [createTodo, "id"] }` | `from id: [CreateTodo, :id]` |
|
|
43
|
+
| `claims: [...]` and `observe` | `claims [...]` and `def observe(...)` |
|
|
44
|
+
| `parts: [createTodo]`, `await call(createTodo, args)` | `parts [CreateTodo]`, `call.(CreateTodo, title: "x")` |
|
|
45
|
+
|
|
46
|
+
The keyword arguments of `run` name the fixtures, as the destructured
|
|
47
|
+
first argument does in TypeScript; `nuka check` reads them without
|
|
48
|
+
calling the body. `args:` is there only when the body reads it.
|
|
49
|
+
|
|
50
|
+
## Fixtures
|
|
51
|
+
|
|
52
|
+
Each fixture has the TypeScript name. Four of them also take a snake_case
|
|
53
|
+
name, which passes RuboCop's naming cops and reaches the same fixture:
|
|
54
|
+
`base_url`, `require_env`, `page_as`, and `result_of`.
|
|
55
|
+
|
|
56
|
+
A fixture that TypeScript calls as a function is a lambda in Ruby, called
|
|
57
|
+
with `.()`: `section.("checkout")`, `require_env.("API_KEY")`,
|
|
58
|
+
`page_as.("aki")`, `result_of.(CreateTodo)`, and
|
|
59
|
+
`poll.(description: "the order", interval: 200) { value or nil }`, whose
|
|
60
|
+
block stands for the function TypeScript passes. `evidence.attach`,
|
|
61
|
+
`evidence.path`, `scratch.dir`, and `scratch.copy` are methods.
|
|
62
|
+
|
|
63
|
+
A project fixture goes in `nukadoko.config.rb`:
|
|
64
|
+
`Nukadoko.fixture(:store) { |use| use.(Store.new) }`, its keyword
|
|
65
|
+
arguments naming what it needs.
|
|
66
|
+
|
|
67
|
+
`Nukadoko.run_command(command, args, cwd:, env:, timeout:)` is the Ruby
|
|
68
|
+
form of `runCommand`. `unbundled: true` runs a command in another Ruby
|
|
69
|
+
project without nuka's Bundler environment.
|
|
70
|
+
|
|
71
|
+
## Playwright from Ruby
|
|
72
|
+
|
|
73
|
+
`page`, `context`, and `page_as` give playwright-ruby-client's objects,
|
|
74
|
+
whose method names are snake_case (`page.get_by_role`, `page.goto`). Two
|
|
75
|
+
calls do not behave as their TypeScript names suggest:
|
|
76
|
+
|
|
77
|
+
- `page.wait_for_url` takes a String or a Regexp. A Proc never matches, so
|
|
78
|
+
the wait runs to its timeout.
|
|
79
|
+
- `context.expect_page` raises ArgumentError. Wait for a new tab with
|
|
80
|
+
`context.expect_event("page") { page.get_by_text("Open").click }`.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nukadoko
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- meganemura
|
|
@@ -41,16 +41,16 @@ dependencies:
|
|
|
41
41
|
name: playwright-ruby-client
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
|
-
- -
|
|
44
|
+
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 1.
|
|
46
|
+
version: 1.63.0
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- -
|
|
51
|
+
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 1.
|
|
53
|
+
version: 1.63.0
|
|
54
54
|
executables:
|
|
55
55
|
- nuka
|
|
56
56
|
extensions: []
|
|
@@ -79,6 +79,7 @@ files:
|
|
|
79
79
|
- lib/nukadoko/criteria.rb
|
|
80
80
|
- lib/nukadoko/definition.rb
|
|
81
81
|
- lib/nukadoko/env_check.rb
|
|
82
|
+
- lib/nukadoko/error_frames.rb
|
|
82
83
|
- lib/nukadoko/features.rb
|
|
83
84
|
- lib/nukadoko/fixtures.rb
|
|
84
85
|
- lib/nukadoko/http_recording.rb
|
|
@@ -91,6 +92,7 @@ files:
|
|
|
91
92
|
- lib/nukadoko/literal.rb
|
|
92
93
|
- lib/nukadoko/measured.rb
|
|
93
94
|
- lib/nukadoko/order.rb
|
|
95
|
+
- lib/nukadoko/parameter_types.rb
|
|
94
96
|
- lib/nukadoko/parts.rb
|
|
95
97
|
- lib/nukadoko/pattern.rb
|
|
96
98
|
- lib/nukadoko/poll.rb
|
|
@@ -111,6 +113,7 @@ files:
|
|
|
111
113
|
- lib/nukadoko/skill.rb
|
|
112
114
|
- lib/nukadoko/spaces.rb
|
|
113
115
|
- lib/nukadoko/step.rb
|
|
116
|
+
- lib/nukadoko/step_fixtures.rb
|
|
114
117
|
- lib/nukadoko/summary.rb
|
|
115
118
|
- lib/nukadoko/table.rb
|
|
116
119
|
- lib/nukadoko/text_fit.rb
|
|
@@ -141,6 +144,7 @@ files:
|
|
|
141
144
|
- sig/generated/nukadoko/criteria.rbs
|
|
142
145
|
- sig/generated/nukadoko/definition.rbs
|
|
143
146
|
- sig/generated/nukadoko/env_check.rbs
|
|
147
|
+
- sig/generated/nukadoko/error_frames.rbs
|
|
144
148
|
- sig/generated/nukadoko/features.rbs
|
|
145
149
|
- sig/generated/nukadoko/fixtures.rbs
|
|
146
150
|
- sig/generated/nukadoko/http_recording.rbs
|
|
@@ -153,6 +157,7 @@ files:
|
|
|
153
157
|
- sig/generated/nukadoko/literal.rbs
|
|
154
158
|
- sig/generated/nukadoko/measured.rbs
|
|
155
159
|
- sig/generated/nukadoko/order.rbs
|
|
160
|
+
- sig/generated/nukadoko/parameter_types.rbs
|
|
156
161
|
- sig/generated/nukadoko/parts.rbs
|
|
157
162
|
- sig/generated/nukadoko/pattern.rbs
|
|
158
163
|
- sig/generated/nukadoko/poll.rbs
|
|
@@ -173,6 +178,7 @@ files:
|
|
|
173
178
|
- sig/generated/nukadoko/skill.rbs
|
|
174
179
|
- sig/generated/nukadoko/spaces.rbs
|
|
175
180
|
- sig/generated/nukadoko/step.rbs
|
|
181
|
+
- sig/generated/nukadoko/step_fixtures.rbs
|
|
176
182
|
- sig/generated/nukadoko/summary.rbs
|
|
177
183
|
- sig/generated/nukadoko/table.rbs
|
|
178
184
|
- sig/generated/nukadoko/text_fit.rbs
|
|
@@ -205,6 +211,7 @@ files:
|
|
|
205
211
|
- skills/nukadoko/references/perturbed-worlds.md
|
|
206
212
|
- skills/nukadoko/references/program.md
|
|
207
213
|
- skills/nukadoko/references/reviewing.md
|
|
214
|
+
- skills/nukadoko/references/ruby.md
|
|
208
215
|
- skills/nukadoko/references/running.md
|
|
209
216
|
- skills/nukadoko/references/scenario-rules.md
|
|
210
217
|
- skills/nukadoko/references/states.md
|