-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
test: add e2e tests for proxy option #3748
Draft
snitin315
wants to merge
7
commits into
master
Choose a base branch
from
test-e2e-proxy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,435
−980
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
89284ad
test: add e2e tests for proxy option
snitin315 06fad1d
test: add e2e tests for proxy option
snitin315 bf7fff4
test: add e2e tests for proxy option
snitin315 245a6a1
test: add e2e tests for proxy option
snitin315 5aabcd2
test: add e2e tests for proxy option
snitin315 de13b6a
test: add e2e tests for proxy option
snitin315 f2d6da3
test: refactor
snitin315 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,335 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`proxy option as an array respects a proxy option of function: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array respects a proxy option of function: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array respects a proxy option of function: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an array respects a proxy option of function: response text 1`] = `"from proxy2"`; | ||
|
||
exports[`proxy option as an array respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an array respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an array should allow req, res, and next: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array should allow req, res, and next: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array should allow req, res, and next: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an array should allow req, res, and next: response text 1`] = `"foo+next+function"`; | ||
|
||
exports[`proxy option as an array without the \`route\` option respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array without the \`route\` option respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an array without the \`route\` option respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an array without the \`route\` option respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a pathRewrite option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a pathRewrite option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a pathRewrite option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a pathRewrite option: response text 1`] = `"from proxy2"`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a proxy option when a request path is matched: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a proxy option when a request path is matched: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a proxy option when a request path is matched: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an object of paths with properties respects a proxy option when a request path is matched: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an option is an object with \`context\` and \`target\` as string respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with \`context\` and \`target\` as string respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with \`context\` and \`target\` as string respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an option is an object with \`context\` and \`target\` as string respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an option is an object with the \`context\` option respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`context\` option respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`context\` option respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an option is an object with the \`context\` option respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an option is an object with the \`path\` option (\`context\` alias) respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`path\` option (\`context\` alias) respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`path\` option (\`context\` alias) respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an option is an object with the \`path\` option (\`context\` alias) respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option as an option is an object with the \`router\` option respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`router\` option respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option as an option is an object with the \`router\` option respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option as an option is an object with the \`router\` option respects a proxy option: response text 1`] = `"from proxy1"`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path regardless of the target defined a bypass option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path regardless of the target defined a bypass option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path regardless of the target defined a bypass option: response status 1`] = `200`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path regardless of the target defined a bypass option: response text 1`] = ` | ||
"Hello | ||
" | ||
`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path: response status 1`] = `200`; | ||
|
||
exports[`proxy option proxy with byPass can rewrite a request path: response text 1`] = ` | ||
"Hello | ||
" | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should not pass through a proxy when a bypass function returns false: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should not pass through a proxy when a bypass function returns false: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should not pass through a proxy when a bypass function returns false: response status 1`] = `404`; | ||
|
||
exports[`proxy option proxy with byPass should not pass through a proxy when a bypass function returns false: response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /proxyfalse</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should pass through a proxy when a bypass function returns null: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should pass through a proxy when a bypass function returns null: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should pass through a proxy when a bypass function returns null: response status 1`] = `200`; | ||
|
||
exports[`proxy option proxy with byPass should pass through a proxy when a bypass function returns null: response text 1`] = ` | ||
"\\"use strict\\"; | ||
|
||
console.log(\\"Hey.\\"); | ||
" | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should wait if bypass returns promise: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should wait if bypass returns promise: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should wait if bypass returns promise: response status 1`] = `200`; | ||
|
||
exports[`proxy option proxy with byPass should wait if bypass returns promise: response text 1`] = `"proxy async response"`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option #2: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option #2: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option #2: response status 1`] = `200`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option #2: response text 1`] = ` | ||
"Hello | ||
" | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option: response status 1`] = `404`; | ||
|
||
exports[`proxy option proxy with byPass should work with the 'target' option: response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /bypass-with-target/foo.js</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: sockjs Should receive response: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 426 (Upgrade Required)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: sockjs Should receive response: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: sockjs Should receive response: response status 1`] = `426`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: sockjs Should receive response: response text 1`] = `"Upgrade Required"`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: ws Should receive response: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 426 (Upgrade Required)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: ws Should receive response: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: ws Should receive response: response status 1`] = `426`; | ||
|
||
exports[`proxy option should handles external websocket upgrade with webSocketServerType: ws Should receive response: response text 1`] = `"Upgrade Required"`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy1 option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy1 option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy1 option: response status 1`] = `200`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy1 option: response text 1`] = `"from proxy"`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy2 option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy2 option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy2 option: response status 1`] = `200`; | ||
|
||
exports[`proxy option should sharing a proxy option respects proxy2 option: response text 1`] = `"from proxy"`; | ||
|
||
exports[`proxy option should supports http methods DELETE method: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods DELETE method: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods DELETE method: response status 1`] = `200`; | ||
|
||
exports[`proxy option should supports http methods DELETE method: response text 1`] = `"DELETE method from proxy"`; | ||
|
||
exports[`proxy option should supports http methods GET method: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods GET method: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods GET method: response status 1`] = `200`; | ||
|
||
exports[`proxy option should supports http methods GET method: response text 1`] = `"GET method from proxy"`; | ||
|
||
exports[`proxy option should supports http methods HEAD method: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods HEAD method: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods HEAD method: response status 1`] = `200`; | ||
|
||
exports[`proxy option should supports http methods HEAD method: response text 1`] = `""`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/json): console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/json): page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/json): response headers content-type 1`] = `"application/json; charset=utf-8"`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/json): response status 1`] = `200`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/json): response text 1`] = `"{\\"answer\\":\\"POST method from proxy (id: 1)\\"}"`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/x-www-form-urlencoded): console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/x-www-form-urlencoded): page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/x-www-form-urlencoded): response headers content-type 1`] = `"text/html; charset=utf-8"`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/x-www-form-urlencoded): response status 1`] = `200`; | ||
|
||
exports[`proxy option should supports http methods POST method (application/x-www-form-urlencoded): response text 1`] = `"POST method from proxy (id: 1)"`; | ||
|
||
exports[`proxy option should supports http methods errors: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 500 (Internal Server Error)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should supports http methods errors: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should supports http methods errors: response status 1`] = `500`; | ||
|
||
exports[`proxy option should supports http methods errors: response text 1`] = `"error from proxy"`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options target respects a proxy option when a request path is matched: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 504 (Gateway Timeout)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options target respects a proxy option when a request path is matched: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options target respects a proxy option when a request path is matched: response status 1`] = `504`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options target respects a proxy option when a request path is matched: response text 1`] = `"Error occured while trying to proxy: localhost:8123/my-path"`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options with \`silent\` value target respects a proxy option when a request path is matched: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 504 (Gateway Timeout)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options with \`silent\` value target respects a proxy option when a request path is matched: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options with \`silent\` value target respects a proxy option when a request path is matched: response status 1`] = `504`; | ||
|
||
exports[`proxy option should work and respect \`logProvider\` and \`logLevel\` options with \`silent\` value target respects a proxy option when a request path is matched: response text 1`] = `"Error occured while trying to proxy: localhost:8123/my-path"`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option target respects a proxy option when a request path is matched: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 504 (Gateway Timeout)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option target respects a proxy option when a request path is matched: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option target respects a proxy option when a request path is matched: response status 1`] = `504`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option target respects a proxy option when a request path is matched: response text 1`] = `"Error occured while trying to proxy: localhost:8123/my-path"`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option with \`none\` value target respects a proxy option when a request path is matched: console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 504 (Gateway Timeout)", | ||
] | ||
`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option with \`none\` value target respects a proxy option when a request path is matched: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option with \`none\` value target respects a proxy option when a request path is matched: response status 1`] = `504`; | ||
|
||
exports[`proxy option should work and respect the \`infrastructureLogging.level\` option with \`none\` value target respects a proxy option when a request path is matched: response text 1`] = `"Error occured while trying to proxy: localhost:8123/my-path"`; | ||
|
||
exports[`proxy option should work in multi compiler mode respects a proxy option: console messages 1`] = `Array []`; | ||
|
||
exports[`proxy option should work in multi compiler mode respects a proxy option: page errors 1`] = `Array []`; | ||
|
||
exports[`proxy option should work in multi compiler mode respects a proxy option: response status 1`] = `200`; | ||
|
||
exports[`proxy option should work in multi compiler mode respects a proxy option: response text 1`] = `"from proxy1"`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, need to fix it