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

Connect to Chrome Remote Interface when launching Chrome and record video #4628

Merged
merged 108 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
1b28a34
try connecting to chrome remote interface
bahmutov Jul 1, 2019
8b74d1e
linting
bahmutov Jul 1, 2019
ea24c39
print CRI targets for better debugging
bahmutov Jul 1, 2019
3e78b8f
linting
bahmutov Jul 1, 2019
fb8c0ff
load empty tab first when connecting to CRI
bahmutov Jul 1, 2019
7ba253f
first load blank page, then navigate
bahmutov Jul 1, 2019
ec06d65
Page.navigate is working
bahmutov Jul 3, 2019
3c76042
Merge branch 'develop' into add-cri-4608
bahmutov Jul 16, 2019
ff02745
linting
bahmutov Jul 16, 2019
ab11757
remove title
bahmutov Jul 16, 2019
3f7df04
add mocha banner
bahmutov Jul 16, 2019
b8fc8cf
more banners
bahmutov Jul 16, 2019
9bc5333
update some server unit tests
bahmutov Jul 16, 2019
b999dfc
update integration test
bahmutov Jul 16, 2019
054f589
document how to run single driver spec file
bahmutov Jul 17, 2019
1cab130
set the focus back on the page before navigating from blank chrome tab
bahmutov Jul 17, 2019
b842f23
update server unit test
bahmutov Jul 17, 2019
05bb2c4
Merge branch 'develop' into add-cri-4608
bahmutov Jul 18, 2019
6d20ab5
do not store Chrome remote interface reference for now
bahmutov Jul 18, 2019
4aaeb5f
record video of the Chrome tab using screencast API
bahmutov Jul 18, 2019
a7ec58c
use dynamic port to connect to Chrome remote interface
bahmutov Jul 23, 2019
4899902
update unit tests
bahmutov Jul 23, 2019
a09be50
merged latest add-cri-4608
bahmutov Jul 23, 2019
901272e
refactoring
bahmutov Jul 24, 2019
97e0f0d
wrap chrome remote interface in our interface, limit access to send
bahmutov Jul 24, 2019
f6250c5
Merge branch 'develop' into add-cri-4608
bahmutov Jul 30, 2019
0e1ff8b
resolved merge
bahmutov Jul 30, 2019
34dc56c
fix reference
bahmutov Jul 30, 2019
78e42e2
passing run unit spec
bahmutov Jul 30, 2019
bb51a0d
stub canary search for CI to pass
bahmutov Jul 30, 2019
59fb1b4
add build step to packages/server
bahmutov Jul 30, 2019
ed46cf6
update chrome spec
bahmutov Jul 30, 2019
eaf0aa3
do not build js on install for server
bahmutov Jul 30, 2019
8a2e24e
updated spec snapshots
bahmutov Jul 30, 2019
11805c9
update 6_visit_spec snapshot
bahmutov Jul 30, 2019
6cf87c1
update snapshot for 6_web_security_spec
bahmutov Jul 30, 2019
4594fba
update snapshot for 3_plugins_spec
bahmutov Jul 30, 2019
35aeb61
update snapshot for 3_user_agent_spec
bahmutov Jul 30, 2019
bbf6d4f
update snapshot for 5_stdout_spec
bahmutov Jul 30, 2019
77144e0
update snapshot for 2_browser_path_spec
bahmutov Jul 30, 2019
14676c4
Merge branch 'develop' into add-cri-4608
brian-mann Aug 1, 2019
b00f753
do not git ignore js files, add note why
bahmutov Aug 2, 2019
519fef3
Merge branch 'develop' into add-cri-4608
bahmutov Aug 12, 2019
d39f113
merged latest develop code into this branch
bahmutov Sep 10, 2019
5f5d4b0
update several snapshots with video on Chrome
bahmutov Sep 10, 2019
36a69a3
Merge branch 'develop' into add-cri-4608
bahmutov Sep 10, 2019
787c236
update visit performance snapshot
bahmutov Sep 10, 2019
53ac190
add chrome-remote-interface dependency
bahmutov Sep 11, 2019
6a7ec4f
Merge branch 'develop' into add-cri-4608
bahmutov Sep 26, 2019
c2a5839
Merge branch 'develop' into add-cri-4608
brian-mann Sep 29, 2019
7a56d43
cleanup coffeescript conversion to JS, fix some type errors, make par…
brian-mann Sep 29, 2019
96b56d6
fix failing tests
brian-mann Sep 29, 2019
0a258c0
Merge branch 'develop' into add-cri-4608
jennifer-shehane Oct 1, 2019
5f6b9a7
Fix snapshot - now we do record in Chrome, so warning message is no l…
jennifer-shehane Oct 1, 2019
506589b
remove chrome warnings about not recording from snapshot
jennifer-shehane Oct 1, 2019
e3a93c7
Remove performance tests from 6_visit_spec snapshot
flotwig Oct 2, 2019
629da2e
Remove error from snapshot
flotwig Oct 2, 2019
12195bc
Add newline back to cy_visit_performance_spec snapshot
flotwig Oct 2, 2019
9f2760e
Merge branch 'develop' into add-cri-4608
flotwig Oct 4, 2019
66d28ae
Navigate to about:blank
flotwig Oct 7, 2019
7216585
Merge branch 'develop' into add-cri-4608
bahmutov Oct 7, 2019
1100b5a
look for blank page url
bahmutov Oct 7, 2019
9755bc6
add note about avoiding Prettier
bahmutov Oct 7, 2019
cbe32b8
disable prettier a little more
bahmutov Oct 7, 2019
06d3f81
call chrome remote interface close after each spec
bahmutov Oct 7, 2019
15ecc5c
return promise when starting screencast
bahmutov Oct 7, 2019
af4b072
update failing unit tests, add cri client close test
bahmutov Oct 8, 2019
1c35680
update integration test
bahmutov Oct 8, 2019
17e0421
Add verbose debug statements to cri-client
flotwig Oct 8, 2019
2285b95
Merge branch 'add-cri-4608' of github.com:cypress-io/cypress into add…
flotwig Oct 8, 2019
5f56b63
Use connect.createRetryingSocket for CDP connection
flotwig Oct 8, 2019
fef98de
record video from chrome browsers
bahmutov Oct 8, 2019
d0794c1
add method for validating browser family
bahmutov Oct 8, 2019
22b2d62
update e2e spec snapshot
bahmutov Oct 8, 2019
87716ff
update 4_request_spec snapshot
bahmutov Oct 8, 2019
896eb6a
update snapshot for spec 1_commands_outside_of_test_spec
bahmutov Oct 8, 2019
edb1e7d
update snapshot for 3_plugins_spec
bahmutov Oct 8, 2019
0530c8e
update snapshot for spec 3_user_agent_spec
bahmutov Oct 8, 2019
70bdc7d
try: Always log video capturing errors
flotwig Oct 8, 2019
0ef525b
update snapshot for 2_browser_path_spec
bahmutov Oct 8, 2019
07024b9
update snapshot for 2_cookies_spec
bahmutov Oct 8, 2019
cdacbd0
better browser family test
bahmutov Oct 8, 2019
c1b00e9
update snapshot for 5_stdout_spec
bahmutov Oct 8, 2019
7a66da4
update snapshot for 5_subdomain_spec
bahmutov Oct 8, 2019
ddb168d
Add protocol_spec tests
flotwig Oct 8, 2019
dd0b727
do not capture video during performance test
bahmutov Oct 8, 2019
9c64847
Add test for VIDEO_POST_PROCESSING_FAILED warning
flotwig Oct 8, 2019
80d70c6
Merge branch 'develop' into add-cri-4608
bahmutov Oct 9, 2019
9eb37c1
use client.on to register screencast callback
bahmutov Oct 9, 2019
a8e6266
cleanup prettier, extract some functions, switch to browser.family
brian-mann Oct 10, 2019
92c50d8
moar cleanup and fixes
brian-mann Oct 10, 2019
0632635
add logging to the cri-client so we can see every message sent + rece…
brian-mann Oct 10, 2019
0e0013b
bump bluebird to 3.7.0 for .tapCatch addition
brian-mann Oct 10, 2019
e741d1d
Fix unit tests
flotwig Oct 10, 2019
0bdf678
WIP: update e2e test to ensure that duration of the video matches wha…
brian-mann Oct 10, 2019
ed25ffa
Test duration of recorded video
flotwig Oct 10, 2019
6fa7492
Run 6_video_compression in chrome + electron
flotwig Oct 10, 2019
324e7eb
Cleanup
flotwig Oct 10, 2019
3783a49
finish ffmpeg duration verification
brian-mann Oct 10, 2019
c8c3891
Merge branch 'develop' into add-cri-4608
flotwig Oct 11, 2019
5df252d
Update 8_reporters_spec snapshot
flotwig Oct 11, 2019
dcb2a48
Update CRI close logic to monkey-patch browser.kill
flotwig Oct 11, 2019
4d04eb8
add isBrowserFamily back
flotwig Oct 11, 2019
1003598
Merge branch 'develop' into add-cri-4608
flotwig Oct 11, 2019
0631585
make it possible for remote-debugging-port to get overridden
flotwig Oct 11, 2019
bda0e4f
Make CDP timeout 5s; add unit, e2e tests for CDP failure; add user-fr…
flotwig Oct 11, 2019
63d2474
Update tests
flotwig Oct 11, 2019
4e6bd31
Use CYPRESS_REMOTE_DEBUGGING_PORT to set CDP port; update CDP error m…
flotwig Oct 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@
},
],
"eslint.enable": true,
// this project does not use Prettier
// thus set all settings to disable accidentally running Prettier
"prettier.requireConfig": true,
"prettier.disableLanguages": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json"
]
}
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ npm run lint-changed-fix
When committing files, we run a Git pre-commit hook to lint the staged JS files. See the [`lint-staged` project](https://github.com/okonet/lint-staged).
If this command fails, you may need to run `npm run lint-changed-fix` and commit those changes.

We **DO NOT** use Prettier to format code. You can find [.prettierignore](.prettierignore) file that ignores all files in this repository. To ensure this file is loaded, please always open _the root repository folder_ in your text editor, otherwise your code formatter might execute, reformatting lots of source files.

### Tests

For most packages there are typically unit and some integration tests.
Expand Down
22 changes: 22 additions & 0 deletions packages/driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ cd packages/driver
npm start
```

For working with a single spec file, use `testFiles` configuration option. For example, to only show the `e2e/focus_blur_spec.js` spec file when Cypress is opened use (path is relative to `test/cypress/integration` folder)

```bash
npm run cypress:open -- --config testFiles=e2e/focus_blur_spec.js
```

Or to run that single spec headlessly

```bash
npm run cypress:run -- --config testFiles=e2e/focus_blur_spec.js
```

Alternative: use `--spec`, but pass the path from the current folder, for example

```bash
npm run cypress:run -- --spec test/cypress/integration/issues/1939_1940_2190_spec.js --browser chrome
```

If you want to run tests in Chrome and keep it open after the spec finishes, you can do

```bash
npm run cypress:run -- --config testFiles=e2e/focus_blur_spec.js --browser chrome --no-exit
If you would like to run a particular integration test, see the GUI and poke around during the test, you can an exclusive test like:

```bash
Expand Down
6 changes: 4 additions & 2 deletions packages/server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
lib/util/ensure-url.js
lib/util/proxy.js
# we do not explicitly ignore JavaScript files in "lib/browsers" folder
# because when we add TS files we do not transpile them as a build step
# instead always use require hooks to transpile TS files on the fly

.http-mitm-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ exports['e2e commands outside of test [chrome] fails on cy commands 1'] = `

Running: commands_outside_of_test_spec.coffee... (1 of 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.


1) An uncaught error was detected outside of a test

Expand Down Expand Up @@ -123,7 +117,7 @@ We dynamically generated a new test to display this failure.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: commands_outside_of_test_spec.coffee │
└────────────────────────────────────────────────────┘
Expand All @@ -134,6 +128,12 @@ We dynamically generated a new test to display this failure.
- /foo/bar/.projects/e2e/cypress/screenshots/commands_outside_of_test_spec.coffee/An uncaught error was detected outside of a test (failed).png (YYYYxZZZZ)


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down Expand Up @@ -166,12 +166,6 @@ exports['e2e commands outside of test [chrome] fails on failing assertions 1'] =

Running: assertions_failing_outside_of_test_spec.coffee... (1 of 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.


1) An uncaught error was detected outside of a test

Expand Down Expand Up @@ -202,7 +196,7 @@ We dynamically generated a new test to display this failure.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: assertions_failing_outside_of_test_spec.coffee │
└──────────────────────────────────────────────────────────────┘
Expand All @@ -213,6 +207,12 @@ We dynamically generated a new test to display this failure.
- /foo/bar/.projects/e2e/cypress/screenshots/assertions_failing_outside_of_test_spec.coffee/An uncaught error was detected outside of a test (failed).png (YYYYxZZZZ)


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/2_browser_path_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ exports['e2e launching browsers by path works with an installed browser path 1']

Running: simple_spec.coffee... (1 of 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.


✓ is true

Expand All @@ -37,12 +31,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: simple_spec.coffee │
└──────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/2_cookies_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ exports['e2e cookies passes in chrome 1'] = `

Running: cookies_spec.coffee... (1 of 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.


cookies
with whitelist
Expand Down Expand Up @@ -49,12 +43,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: cookies_spec.coffee │
└───────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/3_plugins_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ exports['e2e plugins works with user extensions 1'] = `

Running: app_spec.coffee... (1 of 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.


✓ can inject text from an extension

Expand All @@ -218,12 +212,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: app_spec.coffee │
└───────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/plugin-extension/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/3_user_agent_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ exports['e2e user agent passes on chrome 1'] = `

Running: user_agent_spec.coffee... (1 of 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.


user agent
✓ is set on visits
Expand All @@ -40,12 +34,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: user_agent_spec.coffee │
└──────────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/4_request_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ exports['e2e requests passes in chrome 1'] = `

Running: request_spec.coffee... (1 of 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.


redirects + requests
✓ gets and sets cookies from cy.request
Expand Down Expand Up @@ -122,12 +116,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: request_spec.coffee │
└───────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/5_stdout_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,6 @@ exports['e2e stdout logs that chrome cannot be recorded 1'] = `

Running: simple_spec.coffee... (1 of 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.


✓ is true

Expand All @@ -376,12 +370,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: simple_spec.coffee │
└──────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/5_subdomain_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ exports['e2e subdomain passes in chrome 1'] = `

Running: subdomain_spec.coffee... (1 of 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.


subdomains
✓ can swap to help.foobar.com:2292
Expand All @@ -118,12 +112,18 @@ A video will not be recorded when using this browser.
│ Pending: 2 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: subdomain_spec.coffee │
└─────────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
14 changes: 7 additions & 7 deletions packages/server/__snapshots__/6_web_security_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ exports['e2e web security when disabled passes 1'] = `

Running: web_security_spec.coffee... (1 of 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.


web security
✓ fails when clicking <a> to another origin
Expand All @@ -210,12 +204,18 @@ A video will not be recorded when using this browser.
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false
│ Video: true
│ Duration: X seconds │
│ Spec Ran: web_security_spec.coffee │
└────────────────────────────────────────┘


(Video)

- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)


====================================================================================================

(Run Finished)
Expand Down
Loading