Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(driver): add filtering API for request logs #22458

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7422394
build this branch
flotwig Jun 22, 2022
8fe8670
feat(driver): add filtering API for proxy logs
flotwig Jun 22, 2022
202ccec
tests etc
flotwig Jun 22, 2022
7f145a4
add matchedIntercept
flotwig Jul 13, 2022
5426fda
ProxyLogging => NetworkLogs
flotwig Jul 13, 2022
39ed44e
fixes
flotwig Jul 13, 2022
51b31d6
Merge remote-tracking branch 'origin/develop' into issue-9358-ignore-…
flotwig Jul 13, 2022
e9f1157
Merge remote-tracking branch 'origin/develop' into issue-9358-ignore-…
flotwig Jul 25, 2022
ffab23d
Merge remote-tracking branch 'origin/release/12.0.0' into issue-9358-…
flotwig Nov 8, 2022
c62d2f1
finish merge
flotwig Nov 8, 2022
440a118
tests
flotwig Nov 9, 2022
a8d55b5
sendtodriver before intercepting
flotwig Nov 9, 2022
81bc2b7
wip: fixing proxy after splitting request-middleware
flotwig Nov 14, 2022
d486526
Merge remote-tracking branch 'origin/release/12.0.0' into issue-9358-…
flotwig Nov 14, 2022
0409ec0
wip: fix resolve:url with intercept...
flotwig Nov 15, 2022
44d8cf7
finish tests
flotwig Nov 15, 2022
2e27116
Restore net_stubbing.cy.ts
flotwig Nov 15, 2022
195cb13
minor tweaks
flotwig Nov 15, 2022
e830ec4
Restore childProcessUtils.ts
flotwig Nov 15, 2022
1a1a5b1
Restore package.json
flotwig Nov 15, 2022
270ce34
fix types
flotwig Nov 15, 2022
6e0b684
Merge branch 'issue-9358-ignore-http-logs' of github.com:cypress-io/c…
flotwig Nov 15, 2022
1daffa3
Merge remote-tracking branch 'origin/release/12.0.0' into issue-9358-…
flotwig Nov 15, 2022
b4977d3
fix proxy test
flotwig Nov 15, 2022
b8e6161
add links to docs
flotwig Nov 16, 2022
72b0cc5
updates from last meeting
flotwig Nov 23, 2022
b935643
NetworkLogs -> RequestLogs
flotwig Nov 23, 2022
0764346
ProxyLog => RequestLog
flotwig Nov 23, 2022
d13e45a
Merge remote-tracking branch 'origin/release/12.0.0' into issue-9358-…
flotwig Nov 24, 2022
a9c4136
run ci
flotwig Nov 24, 2022
b45adb1
Update packages/driver/src/cypress/error_messages.ts
flotwig Nov 30, 2022
a79b943
review feedback
flotwig Nov 30, 2022
584570f
Merge branch 'release/12.0.0' into issue-9358-ignore-http-logs
flotwig Nov 30, 2022
7ec4ac9
RequestLogs -> NetworkLogs
flotwig Dec 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions cli/types/cypress.d.ts
Expand Up @@ -263,6 +263,16 @@ declare namespace Cypress {
*/
type Config = ResolvedConfigOptions & RuntimeConfigOptions & RuntimeServerConfigOptions

type NetworkLogsFilterFn = (req: {
requestId: string
method: HttpMethod
url: string
headers: { [key: string]: string | string[] }
resourceType: 'document' | 'fetch' | 'xhr' | 'websocket' | 'stylesheet' | 'script' | 'image' | 'font' | 'cspviolationreport' | 'ping' | 'manifest' | 'other'
originalResourceType: string | undefined
matchedIntercept: boolean
}) => boolean

/**
* Several libraries are bundled with Cypress by default.
*
Expand Down Expand Up @@ -715,6 +725,27 @@ declare namespace Cypress {
defaults(options: Partial<KeyboardDefaultsOptions>): void
}

NetworkLogs: {
/**
* If true, all XHRs and fetch requests will be displayed in the command log. Set to false to disable.
* @default true
*/
showAllXhrFetch: boolean
/**
* If true, all requests that match a `cy.intercept()` rule will be displayed in the command log. Set to false to disable.
* @default true
*/
showAllIntercepts: boolean
/**
* Set custom filtering rules for network logs.
* `filter` is only called if `showXhrFetch` and `showIntercepts` do not apply to the request.
* @default undefined
* @param filterFn a function that returns true if the request should be logged and false otherwise
* @see https://on.cypress.io/network-logs
*/
filter: NetworkLogsFilterFn | undefined
}

/**
* @see https://on.cypress.io/screenshot-api
*/
Expand Down