@@ -103,10 +103,151 @@ message GenericResultV1 {
103103 GenericError generic_error = 2 ;
104104}
105105
106+ // A status to accept. Either a status code class like "2xx", or an
107+ // integer status code like "200".
108+ message ResponseStatusCode {
109+ // An HTTP status code class.
110+ enum StatusClass {
111+ // Default value that matches no status codes.
112+ STATUS_CLASS_UNSPECIFIED = 0 ;
113+ // The class of status codes between 100 and 199.
114+ STATUS_CLASS_1XX = 100 ;
115+ // The class of status codes between 200 and 299.
116+ STATUS_CLASS_2XX = 200 ;
117+ // The class of status codes between 300 and 399.
118+ STATUS_CLASS_3XX = 300 ;
119+ // The class of status codes between 400 and 499.
120+ STATUS_CLASS_4XX = 400 ;
121+ // The class of status codes between 500 and 599.
122+ STATUS_CLASS_5XX = 500 ;
123+ // The class of all status codes.
124+ STATUS_CLASS_ANY = 1000 ;
125+ }
126+ // Either a specific value or a class of status codes.
127+ oneof status_code {
128+ // A status code to accept.
129+ int32 status_value = 1 ;
130+ // A class of status codes to accept.
131+ StatusClass status_class = 2 ;
132+ }
133+ }
134+
135+ // Aggregate and individual results of a Broken Link Synthetic execution
136+ message BrokenLinksResultV1 {
137+ // the total number of links checked as part of the execution
138+ optional int64 link_count = 1 ;
139+ // the total number of links that passed as part of the execution
140+ optional int64 passing_link_count = 2 ;
141+ // the total number of links that failed
142+ optional int64 failing_link_count = 3 ;
143+ // the total number of links that count not be reached
144+ optional int64 unreachable_count = 4 ;
145+ // the total number of links that returned 2xx status codes
146+ optional int64 status2xx_count = 5 ;
147+ // the total number of links that returned 3xx status codes
148+ optional int64 status3xx_count = 6 ;
149+ // the total number of links that returned 4xx status codes
150+ optional int64 status4xx_count = 7 ;
151+ // the total number of links that returned 5xx status codes
152+ optional int64 status5xx_count = 8 ;
153+
154+ message BrokenLinkCheckerOptions {
155+ // Origin uri from which to scrape all other links, this is the only
156+ // required field.
157+ string origin_uri = 1 ;
158+ // Number of links to follow, default 50.
159+ optional int64 link_limit = 2 ;
160+ // HTML elements to scrape from origin_uri, default 'a'.
161+ string query_selector_all = 3 ;
162+ // Attributes to scrape from queried HTML elements, default ['href'].
163+ repeated string get_attributes = 4 ;
164+
165+ // Possible orders for checking links that have been scraped.
166+ enum LinkOrder {
167+ // Default value that indicates no order.
168+ LINK_ORDER_UNSPECIFIED = 0 ;
169+ // First "n" number of links scraped.
170+ FIRST_N = 1 ;
171+ // Random selection of links scraped.
172+ RANDOM = 2 ;
173+ }
174+
175+ // order to check links scraped
176+ LinkOrder link_order = 5 ; // default FIRST_N
177+ // Maximum amount of time to wait for HTTP response to complete per link,
178+ // default 30000 milliseconds.
179+ optional int64 link_timeout_millis = 6 ;
180+ // Maximum number of times to retry a link that does not return the
181+ // “expected_status_code”.
182+ optional int64 max_retries = 7 ;
183+
184+ reserved 8 ;
185+ reserved "max_redirects" ;
186+
187+ // HTML element to wait for before scraping links on origin_uri.
188+ // Method documentation:
189+ // https://pptr.dev/api/puppeteer.page.waitforselector. Type documentation:
190+ // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors
191+ string wait_for_selector = 9 ;
192+
193+ // Individual link options.
194+ message PerLinkOption {
195+ // The expected status code or class.
196+ ResponseStatusCode expected_status_code = 1 ;
197+ // Maximum amount of time to wait for HTTP response to complete, for
198+ // the given specified link passed in "per_link_options" map.
199+ optional int64 link_timeout_millis = 2 ;
200+ }
201+ // individual link options, default None. string must be formatted as a
202+ // fully qualified url
203+ map <string , PerLinkOption > per_link_options = 10 ;
204+ }
205+
206+ // Options set for broken link synthetic.
207+ BrokenLinkCheckerOptions options = 9 ;
208+
209+ // Result of a single link checked / network request
210+ message SyntheticLinkResult {
211+ // Whether or not the status code is the same as "expected_status_code".
212+ optional bool link_passed = 1 ;
213+ // The expected status code or status class.
214+ ResponseStatusCode expected_status_code = 2 ;
215+ // Source_uri from which the target_uri is navigated from.
216+ string source_uri = 3 ;
217+ // target_uri navigated to from the source_uri.
218+ string target_uri = 4 ;
219+ // Anchor text on the source URI.
220+ string anchor_text = 5 ;
221+ // HTML element from which target_uri was scraped.
222+ string html_element = 6 ;
223+ // Status code returned by the target_uri.
224+ optional int64 status_code = 7 ;
225+ // 'BrokenLinksSynthetic_IncorrectStatusCode' if the expected and actual
226+ // status codes differ. Otherwise, the class of the error thrown, eg
227+ // 'connectionaborted', docs: https://pptr.dev/api/puppeteer.errorcode.
228+ string error_type = 8 ;
229+ // Error Message, if any
230+ string error_message = 9 ;
231+ // The start time of the link navigation in iso format.
232+ string link_start_time = 10 ;
233+ // The end time of the link navigation in iso format.
234+ string link_end_time = 11 ;
235+
236+ // These fields only apply to the origin link.
237+ optional bool is_origin = 12 ;
238+ }
239+
240+ // link result for origin_uri
241+ SyntheticLinkResult origin_link_result = 10 ;
242+ // link results for all scraped and followed links
243+ repeated SyntheticLinkResult followed_link_results = 11 ;
244+ }
245+
106246message SyntheticResult {
107247 oneof result {
108248 TestFrameworkResultV1 synthetic_test_framework_result_v1 = 1 ;
109249 GenericResultV1 synthetic_generic_result_v1 = 2 ;
250+ BrokenLinksResultV1 synthetic_broken_links_result_v1 = 3 ;
110251 }
111252
112253 // Used to determine information about the runtime environment that the
0 commit comments