-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fixes #364 enable user agent to be changed in cypress.json * server: fixes failing tests
- Loading branch information
1 parent
5d76163
commit 9ab2855
Showing
11 changed files
with
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
exports['e2e user agent passes on chrome 1'] = `Warning: Cypress can only record videos when using the built in 'electron' browser. | ||
|
||
You have set the browser to: 'chrome' | ||
|
||
A video will not be recorded when using this browser. | ||
(Tests Starting) | ||
|
||
|
||
user agent | ||
✓ is set on visits | ||
✓ is set on requests | ||
|
||
|
||
2 passing | ||
|
||
|
||
(Tests Finished) | ||
|
||
- Tests: 2 | ||
- Passes: 2 | ||
- Failures: 0 | ||
- Pending: 0 | ||
- Duration: 10 seconds | ||
- Screenshots: 0 | ||
- Video Recorded: false | ||
- Cypress Version: 1.2.3 | ||
|
||
|
||
(All Done) | ||
|
||
` | ||
|
||
exports['e2e user agent passes on electron 1'] = ` | ||
Started video recording: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 | ||
|
||
(Tests Starting) | ||
|
||
|
||
user agent | ||
✓ is set on visits | ||
✓ is set on requests | ||
|
||
|
||
2 passing | ||
|
||
|
||
(Tests Finished) | ||
|
||
- Tests: 2 | ||
- Passes: 2 | ||
- 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,40 @@ | ||
e2e = require("../support/helpers/e2e") | ||
|
||
onServer = (app) -> | ||
app.get "/agent", (req, res) -> | ||
agent = req.headers["user-agent"] | ||
|
||
res.send("<html><span id='agent'>#{agent}</span></html>") | ||
|
||
app.put "/agent", (req, res) -> | ||
res.json({ | ||
userAgent: req.headers["user-agent"] | ||
}) | ||
|
||
describe "e2e user agent", -> | ||
e2e.setup({ | ||
servers: { | ||
port: 4545 | ||
onServer: onServer | ||
} | ||
settings: { | ||
userAgent: "foo bar baz agent" | ||
baseUrl: "http://localhost:4545" | ||
} | ||
}) | ||
|
||
it "passes on chrome", -> | ||
e2e.exec(@, { | ||
browser: "chrome" | ||
spec: "user_agent_spec.coffee" | ||
snapshot: true | ||
expectedExitCode: 0 | ||
}) | ||
|
||
it "passes on electron", -> | ||
e2e.exec(@, { | ||
browser: "electron" | ||
spec: "user_agent_spec.coffee" | ||
snapshot: true | ||
expectedExitCode: 0 | ||
}) |
11 changes: 11 additions & 0 deletions
11
...ages/server/test/support/fixtures/projects/e2e/cypress/integration/user_agent_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,11 @@ | ||
describe "user agent", -> | ||
it "is set on visits", -> | ||
cy.visit("/agent") | ||
cy.get("#agent").should("contain", "foo bar baz agent") | ||
|
||
it "is set on requests", -> | ||
cy | ||
.request("PUT", "/agent") | ||
.its("body").should("deep.eq", { | ||
userAgent: "foo bar baz agent" | ||
}) |
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