Skip to content

Commit

Permalink
Add test to check parameters for errors and httpErrorCodes (#125)
Browse files Browse the repository at this point in the history
* Add test for error fields

* Add test exceptions

* Fix test value

* Update error desc

* More updates to test

* Skip description encoding test on macOS

* More exceptions

* More exceptions

* Update error test cases

* Parameter name

* Update expected test value

* Update broken-site-reporting/README.md

* Update broken-site-reporting/README.md

---------

Co-authored-by: Ben Moon <software@guiltydolphin.com>
  • Loading branch information
SlayterDev and GuiltyDolphin committed Feb 23, 2024
1 parent 438faf5 commit a603ff9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
2 changes: 2 additions & 0 deletions broken-site-reporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Test suite specific fields:
- `model` - string - name of the device model (native apps only)
- `os` - string - operating system name (native apps only)
- `gpcEnabled` - boolean - if GPC is enabled or not (native apps only) - GPC can be disabled by user or by remote config
- `errorDescriptions` - array of strings - optional field containing descriptions from errors generated by failed page loads
- `httpErrorCodes` - array of int - optional field containing the HTTP status codes returned by the page load
- `expectReportURLPrefix` - string - resulting report URL should be prefixed with this string
- `expectReportURLParams` - Array of `{name: '', value: ''}` objects - resulting report URL should have the following set of URL parameters with matching values
- `value` is an optional check for an exact value match.
Expand Down
42 changes: 39 additions & 3 deletions broken-site-reporting/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
{"name": "protectionsState", "value": "true"}
],
"exceptPlatforms": [
"ios-browser"
"ios-browser",
"macos-browser"
]
},
{
Expand Down Expand Up @@ -134,7 +135,8 @@
{"name": "protectionsState", "value": "true"}
],
"exceptPlatforms": [
"ios-browser"
"ios-browser",
"macos-browser"
]
},
{
Expand Down Expand Up @@ -162,7 +164,8 @@
{"name": "protectionsState", "value": "true"}
],
"exceptPlatforms": [
"ios-browser"
"ios-browser",
"macos-browser"
]
},
{
Expand Down Expand Up @@ -211,6 +214,7 @@
],
"exceptPlatforms": [
"ios-browser",
"macos-browser",
"safari-extension"
]
},
Expand Down Expand Up @@ -421,6 +425,38 @@
"safari-extension",
"windows-browser"
]
},
{
"name": "Test error information and HTTP status code are included",
"siteURL": "https://example.test/",
"wasUpgraded": true,
"category": "content",
"blockedTrackers": ["bad.tracker.test", "tracking.test"],
"surrogates": ["surrogate.domain.test", "domain2.test"],
"atb": "v123-456g",
"blocklistVersion": "abc123",
"remoteConfigEtag": "abd142",
"remoteConfigVersion": "1234",
"protectionsEnabled": true,
"expectReportURLPrefix": "https://improving.duckduckgo.com/t/epbf",
"errorDescriptions": ["net::ERR_NAME_NOT_RESOLVED","net::ERR_ABORTED"],
"httpErrorCodes": [304, 200],
"expectReportURLParams": [
{"name": "category", "value": "content"},
{"name": "siteUrl", "value": "https%3A%2F%2Fexample.test%2F"},
{"name": "upgradedHttps", "value": "true"},
{"name": "tds", "value": "abc123"},
{"name": "blockedTrackers", "value": "bad.tracker.test,tracking.test"},
{"name": "surrogates", "value": "surrogate.domain.test,domain2.test"},
{"name": "protectionsState", "value": "true"},
{"name": "errorDescriptions", "value": "%5B%22net%3A%3AERR_NAME_NOT_RESOLVED%22%2C%22net%3A%3AERR_ABORTED%22%5D"},
{"name": "httpErrorCodes", "value": "304,200"}
],
"exceptPlatforms": [
"android-browser",
"safari-extension",
"windows-browser"
]
}
]
}
Expand Down

0 comments on commit a603ff9

Please sign in to comment.