You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/test-implementations/README.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,22 +45,28 @@ Currently, the following phrases are implemented:
45
45
-`given the actor implementation doesn't throw itself`
46
46
-`given the following input provided via standard input`
47
47
- Example:
48
+
48
49
```
49
50
Given the following input provided via standard input
50
51
"""
51
52
{"foo":"bar"}
52
53
"""
53
54
```
55
+
54
56
- This step supports providing input to the CLI via stdin. This is useful for testing CLI commands that can optionally accept standard input.
57
+
55
58
-`given the following input provided via file \`<filename>\``
56
59
- Example:
60
+
57
61
```
58
62
Given the following input provided via file `input.json`
59
63
"""
60
64
{"foo":"bar"}
61
65
"""
62
66
```
67
+
63
68
- This step supports providing input to the CLI via a file.
69
+
64
70
-`given a logged in apify console user`
65
71
- This step ensures the test is ran assuming a logged in user on the Apify console.
66
72
-`given the local actor is pushed to the apify platform`
@@ -76,22 +82,28 @@ Currently, the following phrases are implemented:
76
82
77
83
-`when I run:` followed by a code block consisting of a CLI command (optionally prefixed with `$`)
78
84
- Example:
85
+
79
86
```
80
87
When I run:
81
88
```
82
89
$ apify actor run --input='{"foo":"bar"}'
83
90
```
84
91
```
92
+
85
93
- This step supports running only CLI commands. It also expects only **one** command to be ran. Any more than one command will result in an error (this is done for simplicity sake)
86
94
- When referring to the CLI, you should mention the `apify` binary (as if you'd write this in a terminal). For testing sake, when we actually run the command, it will instead call the `tsx ./bin/dev.js` script, meaning changes that you do to the CLI will be reflected in the tests without needing a rebuild.
95
+
87
96
-`when i capture the <type> id`
88
97
- Example:
98
+
89
99
```
90
100
When I capture the build ID
91
101
```
102
+
92
103
- This step captures the ID of the specified type and stores it in the world. This is useful for checking the output of the CLI, as some variables may be needed to check the output of the actor run.
93
104
- Currently, the following types are implemented:
94
105
-`build`: captures the ID of the build that was created
106
+
95
107
-`when i run with captured data`
96
108
- Identical to `when I run`, with the only difference being that you can use it in conjunction with `when i capture the <type> id` to run the CLI with the captured data.
97
109
@@ -103,40 +115,52 @@ Currently, the following phrases are implemented:
103
115
104
116
-`then the local run has an input JSON:` followed by a code block consisting of a JSON object
105
117
- Example:
118
+
106
119
```
107
120
Then the local run has an input JSON:
108
121
```
109
122
{"foo":"bar"}
110
123
```
111
124
```
125
+
112
126
- This step checks the input of the actor run. It expects the input to be a JSON object. If the input is not a JSON object, an error will be thrown. This will ensure the overridden input is correctly passed to the actor run.
127
+
113
128
-`then the local actor run has started`
114
129
- This step checks if the actor run has actually started.
115
130
-`then the local actor run hasn't even started`
116
131
- This step checks if the actor run hasn't started. If the actor run has started, an error will be thrown.
117
132
-``then the exit status code is `<number>```
118
133
- Example:
134
+
119
135
```
120
136
Then the exit status code is `0`
121
137
```
138
+
122
139
- This step checks the exit status code of the CLI. If the exit status code is not the same as the one provided, an error will be thrown.
140
+
123
141
-``then the exit status code is not `<number>```
124
142
- Example:
143
+
125
144
```
126
145
Then the exit status code is not `0`
127
146
```
147
+
128
148
- This step checks the exit status code of the CLI. If the exit status code is the same as the one provided, an error will be thrown.
149
+
129
150
-`then I don't see any Node.js exception`
130
151
- This step checks if there are any Node.js exceptions in the output. If there are any, an error will be thrown.
131
152
-`then I can read text on stderr:` followed by a code block consisting of a string
132
153
- Example:
154
+
133
155
```
134
156
Then I can read text on stderr:
135
157
```
136
158
use "--input-file=" flag instead
137
159
```
138
160
```
161
+
139
162
- This step checks if the text provided is in the stderr output. If the text is not in the stderr output, an error will be thrown.
163
+
140
164
-`then i can read text on stdout:` followed by a code block consisting of a string
0 commit comments