-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
177 additions
and
14 deletions.
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
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,35 @@ | ||
exports['e2e whitelist passes 1'] = ` | ||
Started video recording: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 | ||
|
||
(Tests Starting) | ||
|
||
|
||
whitelist | ||
✓ forces non-whitelisted hosts to return 503 | ||
|
||
|
||
1 passing | ||
|
||
|
||
(Tests Finished) | ||
|
||
- Tests: 1 | ||
- Passes: 1 | ||
- Failures: 0 | ||
- Pending: 0 | ||
- Duration: 10 seconds | ||
- Screenshots: 0 | ||
- Video Recorded: true | ||
- Cypress Version: 1.2.3 | ||
|
||
|
||
(Video) | ||
|
||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (0 seconds) | ||
|
||
|
||
(All Done) | ||
|
||
` | ||
|
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
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
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
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
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,33 @@ | ||
e2e = require("../support/helpers/e2e") | ||
|
||
onServer = (app) -> | ||
app.get "/", (req, res) -> | ||
res.send("<html>hi there</html>") | ||
|
||
app.get "/req", (req, res) -> | ||
res.sendStatus(200) | ||
|
||
app.get "/status", (req, res) -> | ||
res.sendStatus(503) | ||
|
||
describe "e2e whitelist", -> | ||
e2e.setup({ | ||
servers: [{ | ||
port: 3131 | ||
onServer | ||
}, { | ||
port: 3232 | ||
onServer | ||
}] | ||
settings: { | ||
baseUrl: "http://localhost:3232" | ||
whitelistHosts: "localhost:3232" | ||
} | ||
}) | ||
|
||
it "passes", -> | ||
e2e.exec(@, { | ||
spec: "whitelist_hosts_spec.coffee" | ||
snapshot: true | ||
expectedExitCode: 0 | ||
}) |
26 changes: 26 additions & 0 deletions
26
...server/test/support/fixtures/projects/e2e/cypress/integration/whitelist_hosts_spec.coffee
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,26 @@ | ||
describe "whitelist", -> | ||
it "forces non-whitelisted hosts to return 503", -> | ||
cy | ||
.visit("http://localhost:3232") | ||
|
||
.window().then (win) -> | ||
new Promise (resolve) -> | ||
xhr = new win.XMLHttpRequest | ||
xhr.open("GET", "http://localhost:3232/req") | ||
xhr.setRequestHeader('Content-Type', 'text/plain') | ||
xhr.send() | ||
xhr.onload = -> | ||
resolve(xhr) | ||
.its("status").should("eq", 200) | ||
|
||
.window().then (win) -> | ||
new Promise (resolve) -> | ||
xhr = new win.XMLHttpRequest | ||
xhr.open("GET", "http://localhost:3131/req") | ||
xhr.setRequestHeader('Content-Type', 'text/plain') | ||
xhr.send() | ||
xhr.onerror = -> | ||
## cross origin requests which return 503 | ||
## result in a zero status code | ||
resolve(xhr) | ||
.its("status").should("eq", 0) |
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
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