Commit Graph

1040 Commits

Author SHA1 Message Date
Zach Bloomquist 6960f7cd78 Rewrite JS/HTML using AST-based approach (#5273)
* Add winPropAccessor to security.js, remove other replacers

* Add start of Cypress.resolveWindowReference

* Add regexes for dot and bracket access

* Some security_spec tests pass with new injection

* Add resolveWindowReference unit tests

* Old security_spec now passes with resolveWindowReference

* Inject stub resolveWindowReference so proxy still works outside of Cypress

* wip: rewrite HTML + JS with tokenizer

* Move to using esprima + hyntax to rewrite JS + HTML

* remove comment; oneLine makes the whole thing commented

* Fix tests, apple.com edge case

* wip: add getOrSet

* Revert "wip: add getOrSet"

This reverts commit a5c647c00f.

* release 3.5.0 [skip ci]

* use recast to replace window property accesses

* replace assignments to top properly

* fix yarn.lock

* bump deps

* update integration tests

* remove old security ts?

* fix integration spec

* always ignore js interception failure

* use globalThis instead of window

* add experimentalSourceRewriting flag

* restore regex-writer spec

* fix types

* update config_spec

* add source rewriting spec

* cleanup

* simplify rewriting logic, move rules into rewriter package

* create threaded rewriting tool for non-streaming use

* update @packages/rewriter to use threads for async

* use async rewriting where convenient

* add worker-shim.js

* add performance info to debug logs

* properly handle +=, -=, ...

* add proxy, rewriter to unit-tests stage

* cleanup

* use parse5 to rewrite HTML, strip SRI

* update tests

* reorganization, cleanup

* rewrite ALL parent, top identifiers except in a few cases

* handle many JS edge cases

* ensure parse5@5.1.1 is installed

* update yarn.lock

* update tests

* add debugging, add tests

* add attempted repro for .href issue

* implement source maps + extending inline source maps

* update opts passing in proxy layer

* fix sourcemap naming structure

* update tests to account for sourcemaps

* sourcemap tests

* remote source maps work

* comment

* update rewriter tests

* clean up TODOs in resolveWindowReference

* remove @types/nock

* clean up todos in deferred-source-map-cache

* fix rewriter build script

* fix concatStream import

* bump expectedresultcount

* clean up js-rules

* threading improvements, workaround for Electron segfault

* no visit_spec for now

* fix 6_visit_spec

* update MAX_WORKER_THREADS

* add repro for #3975

* cleanup

* cleanup

* make better use of namedTypes and builders

* get rid of the horrific closureDetectionTernary

ast-types keeps track of scope, so it is unneeded

* fix #3975, #3994

* add x-sourcemap, sourcemap header support

* snap-shot-it 7.9.3

* add deferred-source-map-cache-spec

* add tests

* Throw error in driver if AST rewriting fails

* Fix "location = 'relative-url'"

* fix max recursion depth

* slim down some fixtures

* fix window.location usage

* don't mess with `frames` at all

* no integration tests

* skip testing apple.com for now

* update wording: regex-based vs. ast-based

* skip real-world tests for now

* add some padding to process.exit workaround

* fix resolvers_spec

* fix html-spec

* cleanup

* Update packages/rewriter/lib/js-rules.ts

* Update packages/driver/src/cypress/resolvers.ts

* just import find by itself

* privatize typedefs for Cypress.state, remove .gitignore, remove dead code

Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2020-05-11 12:54:14 -04:00
Chris Breiding 9ab4db80de Improve cy.task errors (#7264) 2020-05-11 10:50:45 -04:00
renovate[bot] bfeac4058b fix(deps): update dependency @cypress/browserify-preprocessor to version 2.2.3 🌟 (#7291) 2020-05-11 21:15:43 +06:30
renovate[bot] 8b5401056e fix(deps): update dependency return-deep-diff to version 0.4.0 🌟 (#7292) 2020-05-11 21:08:12 +06:30
renovate[bot] 885fb352bf chore(deps): Update dependency snap-shot-it to version 7.9.3 🌟 (#7283) 2020-05-11 14:21:18 +06:30
Gleb Bahmutov d284269daa watch spec file without assuming it is integration spec (#7247) 2020-05-08 11:43:27 -04:00
Chris Breiding 157d704270 Fix failing e2e test (#7260) 2020-05-07 21:05:49 +06:30
Jennifer Shehane a27bd34df3 Reporter error improvements (#3930) 2020-05-06 12:18:29 -04:00
Ben Kucera 18d71e6f55 fix firefox video record crash when too few video frames recevied (#7192) 2020-05-06 12:14:24 -04:00
Renovate Bot 554ab7ac5f chore(deps): Update @cypress/json-schemas to 5.34.2 🌟 2020-05-06 08:24:01 +00:00
Chris Breiding c6fee8f259 Fix 'onError is not function' bug (#7230) 2020-05-05 16:19:17 -04:00
Zach Bloomquist 9570e379c0 Use console.error for logging specs found in debug mode (#7191) 2020-05-04 16:27:26 -04:00
Gleb Bahmutov aae90bbbe0 Set CommonJS module format when transpiling TS code (#7197) 2020-05-04 08:57:39 -04:00
Gleb Bahmutov 4290a85875 More logs, more tests for TypeScript preprocessor (#7189) 2020-05-01 09:45:59 -04:00
Kukhyeon Heo 02964410fc Fix typescript iterator error. (#7129) 2020-04-28 12:38:45 -04:00
Jennifer Shehane f7cc3d35cd Fix typo in debug log (#7149) 2020-04-27 21:15:00 +06:30
Ben Kucera 51b23800f0 Revert "fix rerun before/after hooks on top navigation (#7035)" (#7152) 2020-04-27 10:23:04 -04:00
Gleb Bahmutov f31cb3cdc3 Add bundled endpoint (#7153) 2020-04-27 10:00:56 -04:00
Dmitriy Kovalenko 379a9e7008 feat: improve component based tests approach (#5923)
- new mode that mounts the spec iframe instead of application iframe
2020-04-26 16:25:24 -04:00
Ben Kucera 16aecbafaa [internal] watch+reload on file change for e2e tests with --no-… (#6873)
* allow watching files for e2e tests with --no-exit
2020-04-23 10:45:57 -04:00
Jennifer Shehane f10a042021 Merge branch 'develop' into fix-rerun-hooks-on-navigation 2020-04-23 15:43:58 +06:30
Jennifer Shehane cda67b1b41 Merge pull request #7097 from cypress-io/decaf-request
Decaffeinate request.coffee
2020-04-23 14:35:26 +06:30
Ben Kucera 1391a4ca74 Merge remote-tracking branch 'origin/develop' into fix-rerun-hooks-on-navigation 2020-04-22 12:08:51 -04:00
Ben Kucera bbde737e5f Force custom reporters to use bundled mocha version (#6951)
* remove npmInstall logic in helper/e2e script, force custom reporters to use our mocha
* remove mocha imports specs
* use mocha 7.0.1 in server/reporter, and for custom reporters
* update snapshots for new mocha version
* fix glob in server tests
* remove unneeded e2e/package.json deps
2020-04-22 00:23:19 -04:00
Ben Kucera bccdf9db3e fix before/after hooks incorrect test reference 2020-04-21 15:46:21 -04:00
Zach Bloomquist 69cfbad06b cleanup request.js decaf 2020-04-21 15:14:09 -04:00
decaffeinate 4517888937 decaffeinate: Run post-processing cleanups on request.coffee and 1 other file 2020-04-21 14:13:44 -04:00
decaffeinate aef667d71d decaffeinate: Convert request.coffee and 1 other file to JS 2020-04-21 14:13:10 -04:00
decaffeinate 3ccb31cae2 decaffeinate: Rename request.coffee and 1 other file from .coffee to .js 2020-04-21 14:13:04 -04:00
Ben Kucera 6ce2903628 cleanup code, add better e2e tests 2020-04-20 14:07:47 -04:00
Alessandro c80fe37ca4 Strip document-domain directive from feature-policy header when… (#7007)
* 6480: Add feature-policy to problematic headers

* 6480: Create new middleware

* 6480: Fix code placement

* 6480: Add integration test

* 6480: Remove header when no directives left
2020-04-20 09:53:24 -04:00
Kukhyeon Heo d7c545223a Fix typo that made user projects include bundled typescript. (#7072) 2020-04-20 19:51:37 +06:30
Zach Bloomquist 9bfc01df02 Fix using Chromium installed via snapcraft (#7039)
* fix: chromium installed as a snap is properly detected

* add 5s timeout to browser detection

* remove .profile stuff

* use profilePath for alternative profile dirs

* rename legacyPathToProfiles

* update tests

Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2020-04-20 11:10:08 +06:30
Jennifer Shehane de58acb849 Fix sending undefined orgId during project setup (#7014)
* Move org selector into it's own component

- have state of selected Id tracked and set before render.

* update yarn.lock

* fix/refactor org selector

* Add debug logs around creating project

Co-authored-by: Chris Breiding <chrisbreiding@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-04-16 21:02:11 +06:30
Kukhyeon Heo e22b362d4c Out-of-the-box TypeScript Support (#5906)
* Out-of-the-box TypeScript support for plugins

* Out-of-the-box TypeScript Support for tests.

* Fix server unit tests.

* Don't use bundled typescript.

* Added esModuleInterop option.

* Fixed unit tests.

* Added simple_tsify to integration test.

* Added integration tests for ts spec files.

* simple_tsify to ignore transpiling json files.

* transpile on flush.

* Fix lint failure.

* Added error message.

* Add error message for restart test runner for support file.

* Added JSDoc comment.

* Remove preset-typescript.

* Fix integration test failure.

* Fix type errors.

* Add e2e test for typescript

* Fix lint error.

* Add plugin support and e2e test.

* Fix server unit test failures.

* Update snapshots.

* Migrate typescript compilation code to browserify-preprocessor

* Remove unnecessary files and test.

They're tested in preprocessor.

* Fix test failures.

* Update @types/react.

* Update yarn.lock.

* Clear name: registerTS -> tsRegistered.

* Clarify why tsRegistered = true exists.

* Add working examples for support and plugins.

* Move TypeScript tests to its own file.
2020-04-13 21:39:13 +06:30
Chris Breiding 227b2d3834 Don’t remove stack from uncaught errors (#6965)
* don’t remove stack from uncaught errors

* fix issue with navigation options scope

* replace name in stack when changing on an error

* include a useful stack with assertion failure errors

* fix replacing message on assertion errors

* ensure new line between message and stack

* fix stack replacement new line
2020-04-10 17:01:09 -04:00
Zach Bloomquist 0046cc5512 Ignore invalid Set-Cookie values (#6948)
* add invalid header char repro

* ignore tough-cookie/automation failures

see https://github.com/cypress-io/cypress/issues/6890#issuecomment-609913483

* restore snapshot

* Update packages/server/lib/request.coffee

* Update packages/server/lib/request.coffee

Co-Authored-By: Jennifer Shehane <jennifer@cypress.io>

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2020-04-08 11:26:53 -04:00
Ben Kucera cb6f0fd93f e2e tests: use snapshot instead of stdout contains assertion in… (#6961) 2020-04-07 17:57:40 -04:00
Zach Bloomquist 069b22b0d5 Fix 'This socket has been ended by the other party' (#6945) 2020-04-06 12:37:18 -04:00
Jennifer Shehane 50379024ac Update cy.task() err msg to specify necessary promise resolutio… (#6920)
* Update wording of task error message to be more specific about promise resolution value for cy.task

* update tests / snapshots to match new err msg

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-04-06 13:56:20 +06:30
Zach Bloomquist f72a542b61 tough-cookie@4.0.0 (#6936) 2020-04-06 13:55:50 +06:30
renovate[bot] d679240bd7 fix(deps): update dependency http-proxy to version 1.18.0 🌟 (#6934)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-04-03 16:00:55 -04:00
renovate[bot] a3a316a60d fix(deps): update dependency @benmalka/foxdriver to version 0.4… (#6901)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-04-01 09:26:25 -04:00
renovate[bot] 3c321f3da1 chore(deps): Update dependency @babel/core to version 7.9.0 🌟 (#6900)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-04-01 11:38:59 +06:30
Zach Bloomquist b86f1eac19 Add SameSite cookie support in network layer (#6778)
* add experimental feature for sameSite

* allow experimental descriptions to render markdown

* sameSite support mostly working

* also strip sameSite from setCookie yielded value

* don't use `unspecified` - let browser set default

* add tests

* decaffeinate: Rename cdp_automation_spec.coffee from .coffee to .js

* decaffeinate: Convert cdp_automation_spec.coffee to JS

* decaffeinate: Run post-processing cleanups on cdp_automation_spec.coffee

* cleanup cdp_automation_spec.ts

* update unit tests

* update settings_spec to not render as markdown

* user-friendly error for insecure SameSite=None

* fix styling

* fix markdown renderer

* wip: reproduce samesite conditions in e2e test

* use tough-cookie@4.0.0 from git

not on NPM yet, see issue: https://github.com/salesforce/tough-cookie/issues/182

* add more samesite proxy tests

* update types + schema

* run 2_cookies_spec also with forced samesite

* use undefined not no_restriction

* properly detect unspecified SameSite attribute

* update snapshot

* don't send sameSite on getAll calls

* don't omit null/undefined props in automation

* update comment

* clean up SetCookieRequest logic

* fix tests

* fix unit test

* update yarn.lock

* rebalance e2e tests
2020-03-30 11:59:33 -04:00
Zach Bloomquist b6703aaec7 Add support for sameSite in cookie-related commands (#6828)
* add experimental feature for sameSite

* allow experimental descriptions to render markdown

* sameSite support mostly working

* also strip sameSite from setCookie yielded value

* don't use `unspecified` - let browser set default

* add tests

* decaffeinate: Rename cdp_automation_spec.coffee from .coffee to .js

* decaffeinate: Convert cdp_automation_spec.coffee to JS

* decaffeinate: Run post-processing cleanups on cdp_automation_spec.coffee

* cleanup cdp_automation_spec.ts

* update unit tests

* update settings_spec to not render as markdown

* user-friendly error for insecure SameSite=None

* fix styling

* fix markdown renderer

* update types + schema

* use renderInline

* update experiment summary

* bind renderFn to md
2020-03-27 10:04:50 -04:00
Zach Bloomquist a09ebc50b7 Fix Domain-specific cookies set on non-public TLDs (#6821)
* use fallback customTlds regex for parse-domain

this ensures that tlds which parse-domain does not recognize can
still work as tlds for the purposes of cookie matching, etc

* add POST tests for Domain=superdomain

* add local.cypress.test to 2_cookies_spec

* move parse-domain, getSuperDomain logic from driver to network

* move test urls to variables

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2020-03-26 10:35:16 -04:00
renovate[bot] bcba08c71e fix(deps): Update dependency get-port to version 5.1.1 🌟 (#6854)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-03-26 19:06:06 +06:30
Zach Bloomquist 56bbf5c1d8 cleanup cdp_automation_spec.ts 2020-03-24 16:36:44 -04:00
decaffeinate 1432967bfc decaffeinate: Run post-processing cleanups on cdp_automation_spec.coffee 2020-03-24 16:36:02 -04:00