-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathreact-native-fetch.feature
213 lines (205 loc) · 11.1 KB
/
react-native-fetch.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
Feature: React native source map fetch mode
Scenario Outline: Basic success case
When I start the service "react-native-<version>-bundler"
And I wait for 2 seconds
And I run the service "react-native-<version>-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-<version>-bundler:9449
--platform <platform>
<flags>
"""
And I wait to receive 1 sourcemap
Then the last run docker command exited successfully
And the Content-Type header is valid multipart form-data
And the sourcemap payload field "apiKey" equals "123"
And the sourcemap payload field "appVersion" equals "2.0.0"
And the sourcemap payload field "overwrite" equals "true"
And the sourcemap payload field "dev" equals "<dev>"
And the sourcemap payload field "platform" equals "<platform>"
And the sourcemap payload field "sourceMap" matches the expected source map for "<expected directory>"
And the sourcemap payload field "bundle" matches the expected bundle for "<expected directory>"
Examples:
| platform | dev | flags | version | expected directory |
| ios | true | --dev | 0-60 | fetch-react-native-0-60-ios-dev |
| ios | true | --dev | 0-61 | fetch-react-native-0-61-ios-dev |
| ios | true | --dev | 0-62 | fetch-react-native-0-62-ios-dev |
| ios | true | --dev | 0-63 | fetch-react-native-0-63-ios-dev |
| ios | false | | 0-60 | fetch-react-native-0-60-ios |
| ios | false | | 0-61 | fetch-react-native-0-61-ios |
| ios | false | | 0-62 | fetch-react-native-0-62-ios |
| ios | false | | 0-63 | fetch-react-native-0-63-ios |
| android | true | --dev | 0-60 | fetch-react-native-0-60-android-dev |
| android | true | --dev | 0-61 | fetch-react-native-0-61-android-dev |
| android | true | --dev | 0-62 | fetch-react-native-0-62-android-dev |
| android | true | --dev | 0-63 | fetch-react-native-0-63-android-dev |
| android | false | | 0-60 | fetch-react-native-0-60-android |
| android | false | | 0-61 | fetch-react-native-0-61-android |
| android | false | | 0-62 | fetch-react-native-0-62-android |
| android | false | | 0-63 | fetch-react-native-0-63-android |
Scenario: A request will be retried on a server failure (500 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code for the next request to 500
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 2 sourcemaps
Then the last run docker command exited successfully
And the Content-Type header is valid multipart form-data for all requests
And the sourcemap payload field "apiKey" equals "123" for all requests
And the sourcemap payload field "appVersion" equals "2.0.0" for all requests
And the sourcemap payload field "overwrite" equals "true" for all requests
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios" for all requests
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios" for all requests
Scenario: A request will be retried up to 5 times on a server failure (500 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code to 500
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 5 sourcemaps
Then the last run docker command did not exit successfully
And the last run docker command output "A server side error occurred while processing the upload."
And the last run docker command output "HTTP status 500 received from upload API"
And the Content-Type header is valid multipart form-data for all requests
And the sourcemap payload field "apiKey" equals "123" for all requests
And the sourcemap payload field "appVersion" equals "2.0.0" for all requests
And the sourcemap payload field "overwrite" equals "true" for all requests
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios" for all requests
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios" for all requests
Scenario: A request will not be retried if the API key is invalid (401 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code for the next request to 401
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 1 sourcemap
Then the last run docker command did not exit successfully
And the last run docker command output "The provided API key was invalid."
And the last run docker command output "HTTP status 401 received from upload API"
And the sourcemap payload field "apiKey" equals "123"
And the sourcemap payload field "appVersion" equals "2.0.0"
And the sourcemap payload field "overwrite" equals "true"
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios"
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios"
And the Content-Type header is valid multipart form-data
Scenario: A request will not be retried if the source map is a duplicate (409 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code for the next request to 409
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 1 sourcemap
Then the last run docker command did not exit successfully
And the last run docker command output "A source map matching the same criteria has already been uploaded. If you want to replace it, remove the \"no-overwrite\" flag."
And the last run docker command output "HTTP status 409 received from upload API"
And the sourcemap payload field "apiKey" equals "123"
And the sourcemap payload field "appVersion" equals "2.0.0"
And the sourcemap payload field "overwrite" equals "true"
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios"
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios"
And the Content-Type header is valid multipart form-data
Scenario: A request will not be retried if the bundle or source map is empty (422 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code for the next request to 422
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 1 sourcemap
Then the last run docker command did not exit successfully
And the last run docker command output "The uploaded source map was empty."
And the last run docker command output "HTTP status 422 received from upload API"
And the sourcemap payload field "apiKey" equals "123"
And the sourcemap payload field "appVersion" equals "2.0.0"
And the sourcemap payload field "overwrite" equals "true"
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios"
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios"
And the Content-Type header is valid multipart form-data
Scenario: A request will not be retried if request is bad (400 status code)
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the HTTP status code for the next request to 400
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
"""
And I wait to receive 1 sourcemap
Then the last run docker command did not exit successfully
And the last run docker command output "The request was rejected by the server as invalid."
And the last run docker command output "HTTP status 400 received from upload API"
And the sourcemap payload field "apiKey" equals "123"
And the sourcemap payload field "appVersion" equals "2.0.0"
And the sourcemap payload field "overwrite" equals "true"
And the sourcemap payload field "sourceMap" matches the expected source map for "fetch-react-native-0-60-ios"
And the sourcemap payload field "bundle" matches the expected bundle for "fetch-react-native-0-60-ios"
And the Content-Type header is valid multipart form-data
Scenario: A request can set a timeout using the --idle-timeout flag
When I start the service "react-native-0-60-bundler"
And I wait for 2 seconds
And I set the response delay to 5000 milliseconds
And I run the service "react-native-0-60-fetch" with the command
"""
bugsnag-source-maps upload-react-native
--api-key 123
--app-version 2.0.0
--endpoint http://maze-runner:9339
--fetch
--bundler-url http://react-native-0-60-bundler:9449
--platform ios
--idle-timeout 0.0008 # approx 50ms in minutes
"""
Then the last run docker command did not exit successfully
And the last run docker command output "The request to http://react-native-0-60-bundler:9449 timed out."
# this is fetch mode so no sourcemaps should be uploaded because the request
# to the RN bundle server should timeout due to the idle-timeout
And I should receive no requests