Skip to content

Commit

Permalink
Merge branch '10.0-release' into lmiller1990/saved-state-graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
marktnoonan committed Nov 29, 2021
2 parents 3481bbe + b9f8364 commit be5e79a
Show file tree
Hide file tree
Showing 94 changed files with 7,507 additions and 1,986 deletions.
14 changes: 10 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
- Closes <!-- link to the issue here, if there is one -->

### User facing changelog
<!-- Explain the change(s) for every user to read in our changelog. Examples: https://on.cypress.io/changelog -->
<!--
Explain the change(s) for every user to read in our changelog. Examples: https://on.cypress.io/changelog
If the change is not user-facing, write "n/a".
-->

### Additional details
<!-- Examples:
Expand All @@ -22,11 +25,14 @@
Screenshots or GIFs are preferred. -->

### PR Tasks
<!-- These tasks must be completed before a PR is merged.
Delete tasks if they are not applicable. -->
<!--
These tasks must be completed before a PR is merged.
If a task does not apply, write [na] instead of checking the box.
DO NOT DELETE the PR checklist.
-->

- [ ] Have tests been added/updated?
- [ ] Has the original issue or this PR been tagged with a release in ZenHub? <!-- (internal team only)-->
- [ ] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
- [ ] Has a PR for user-facing changes been opened in [`cypress-documentation`](https://github.com/cypress-io/cypress-documentation)? <!-- Link to PR here -->
- [ ] Have API changes been updated in the [`type definitions`](https://github.com/cypress-io/cypress/blob/develop/cli/types/cypress.d.ts)?
- [ ] Have new configuration options been added to the [`cypress.schema.json`](https://github.com/cypress-io/cypress/blob/develop/cli/schema/cypress.schema.json)?
86 changes: 67 additions & 19 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,55 @@ commands:
name: Restore all node_modules to proper workspace folders
command: node scripts/circle-cache.js --action unpack

restore_cached_system_tests_deps:
description: 'Restore the cached node_modules for projects in "system-tests/projects/**"'
steps:
- run:
name: Generate Circle Cache key for system tests
command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key
- restore_cache:
name: Restore system tests node_modules cache
keys:
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-

update_cached_system_tests_deps:
description: 'Update the cached node_modules for projects in "system-tests/projects/**"'
steps:
- run:
name: Generate Circle Cache key for system tests
command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key
- restore_cache:
name: Restore cache state, to check for known modules cache existence
keys:
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-state-{{ checksum "system_tests_cache_key" }}
- run:
name: Bail if specific cache exists
command: |
if [[ -f "system_tests_node_modules_installed" ]]; then
echo "No updates to system tests node modules, exiting"
circleci-agent step halt
fi
- restore_cache:
name: Restore system tests node_modules cache
keys:
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-
- run:
name: Update system-tests node_modules cache
command: yarn workspace @tooling/system-tests projects:yarn:install
- save_cache:
name: Save system tests node_modules cache
key: v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-{{ checksum "system_tests_cache_key" }}
paths:
- ~/.cache/cy-system-tests-node-modules
- run: touch system_tests_node_modules_installed
- save_cache:
name: Save system tests node_modules cache state key
key: v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache-state-{{ checksum "system_tests_cache_key" }}
paths:
- system_tests_node_modules_installed

caching-dependency-installer:
description: 'Installs & caches the dependencies based on yarn lock & package json dependencies'
parameters:
Expand Down Expand Up @@ -468,6 +517,7 @@ commands:
type: string
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
- run:
name: Run system tests
command: |
Expand Down Expand Up @@ -1154,6 +1204,12 @@ jobs:
path: /tmp/artifacts
- store-npm-logs

system-tests-node-modules-install:
<<: *defaults
steps:
- restore_cached_workspace
- update_cached_system_tests_deps

system-tests-chrome:
<<: *defaults
resource_class: medium
Expand Down Expand Up @@ -1991,17 +2047,6 @@ jobs:
repo: cypress-example-todomvc
browser: firefox

"test-binary-against-documentation-firefox":
<<: *defaults
resource_class: medium
steps:
- test-binary-against-repo:
repo: cypress-documentation
browser: firefox
command: "yarn cypress run"
wait-on: http://localhost:3000
server-start-command: yarn serve:dist

"test-binary-against-conduit-chrome":
<<: *defaults
resource_class: medium
Expand Down Expand Up @@ -2136,19 +2181,22 @@ linux-workflow: &linux-workflow
- server-performance-tests:
requires:
- build
- system-tests-chrome:
- system-tests-node-modules-install:
requires:
- build
- system-tests-chrome:
requires:
- system-tests-node-modules-install
- system-tests-electron:
requires:
- build
- system-tests-node-modules-install
- system-tests-firefox:
requires:
- build
- system-tests-node-modules-install
- system-tests-non-root:
executor: non-root-docker-user
requires:
- build
- system-tests-node-modules-install
- driver-integration-tests-chrome:
requires:
- build
Expand Down Expand Up @@ -2368,16 +2416,16 @@ linux-workflow: &linux-workflow

- test-binary-against-kitchensink-chrome:
<<: *onlyMainBranches
- test-binary-against-conduit-chrome:
<<: *onlyMainBranches
# Re-enable when the cypress-example-conduit-app project is fixed.
# https://github.com/cypress-io/cypress-example-conduit-app/issues/346
# - test-binary-against-conduit-chrome:
# <<: *onlyMainBranches
- test-binary-against-recipes-firefox:
<<: *onlyMainBranches
- test-binary-against-kitchensink-firefox:
<<: *onlyMainBranches
- test-binary-against-todomvc-firefox:
<<: *onlyMainBranches
- test-binary-against-documentation-firefox:
<<: *onlyMainBranches
- test-binary-against-api-testing-firefox:
<<: *onlyMainBranches
- test-binary-against-piechopper-firefox:
Expand Down
Binary file modified npm/create-cypress-tests/demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion npm/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Spec | Description
[css modules](cypress/component/basic/css-modules) | Shows that component that using css modules styles works
[network](cypress/component/basic/network) | Confirms we can use `cy.route` to stub / spy on component's network calls
[no-visit](cypress/component/basic/no-visit) | Component specs cannot call `cy.visit`
[re-render](cypress/component/basic/re-render) | Checking how the component re-renders when its props change
[rerender](cypress/component/basic/rerender) | Checking how the component re-renders when its props change
[react-book-by-chris-noring](cypress/component/basic/react-book-by-chris-noring) | Copied test examples from [React Book](https://softchris.github.io/books/react) and adapted for Cypress component tests
[react-tutorial](cypress/component/basic/react-tutorial) | Tests from official [ReactJS tutorial](https://reactjs.org/tutorial/tutorial.html) copied and adapted for Cypress component tests
[stub-example](cypress/component/basic/stub-example) | Uses `cy.stub` as component props
Expand Down
7 changes: 7 additions & 0 deletions npm/vite-dev-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [@cypress/vite-dev-server-v2.2.1](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.2.0...@cypress/vite-dev-server-v2.2.1) (2021-11-19)


### Bug Fixes

* compile npm packages for node 12 ([#18989](https://github.com/cypress-io/cypress/issues/18989)) ([30b3eb2](https://github.com/cypress-io/cypress/commit/30b3eb2376bc1ed69087ba96f60448687e8489e6))

# [@cypress/vite-dev-server-v2.2.0](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.1.1...@cypress/vite-dev-server-v2.2.0) (2021-10-15)


Expand Down
10 changes: 9 additions & 1 deletion npm/webpack-preprocessor/lib/typescript-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ export const overrideSourceMaps = (sourceMap: boolean, typescriptPath?: string)
return
}

const typescript = require(typescriptPath || 'typescript') as typeof import('typescript')
// when using webpack-preprocessor as a local filesystem dependency (`file:...`),
// require(typescript) will resolve to this repo's `typescript` devDependency, not the
// targeted project's `typescript`, which breaks monkeypatching. resolving from the
// CWD avoids this issue.
const projectTsPath = require.resolve(typescriptPath || 'typescript', {
paths: [process.cwd()],
})

const typescript = require(projectTsPath) as typeof import('typescript')
const { createProgram } = typescript

debug('typescript found, overriding typescript.createProgram()')
Expand Down
2 changes: 1 addition & 1 deletion npm/webpack-preprocessor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"react": "16.13.1",
"react-dom": "16.13.1",
"react-scripts": "3.2",
"semantic-release": "17.0.4",
"semantic-release": "17.2.3",
"shx": "0.3.3",
"sinon": "^9.0.0",
"sinon-chai": "^3.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('./lib/typescript-overrides', () => {
const err = typescriptOverrides.overrideSourceMaps(true)

expect(err).to.be.instanceOf(Error)
expect(err.message).to.eq(`Cannot find module 'typescript'`)
expect(err.message).to.match(/Cannot find module '.*typescript\.js'/)
})
})
})
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "9.0.0",
"version": "9.1.0",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
Expand Down Expand Up @@ -48,7 +48,7 @@
"npm-release": "node scripts/npm-release.js",
"prestart": "yarn ensure-deps",
"start": "cypress open --dev --global",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__ --exclude e2e.ts,cypress-tests.ts",
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__ --exclude e2e.ts,cypress-tests.ts,*only_spec.js",
"stop-only-all": "yarn stop-only --folder packages",
"pretest": "yarn ensure-deps",
"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{config,electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,runner-shared,socket}'\"",
Expand Down Expand Up @@ -127,7 +127,7 @@
"arg": "4.1.2",
"ascii-table": "0.0.9",
"autobarrel": "^1.1.0",
"aws-sdk": "2.447.0",
"aws-sdk": "2.814.0",
"babel-eslint": "10.1.0",
"bluebird": "3.5.3",
"bluebird-retry": "0.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = {
options,

validate: (cfg, onErr) => {
debug('validating configuration')
debug('validating configuration', cfg)

return _.each(cfg, (value, key) => {
const validationFn = validationRules[key]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<head>
<meta http-equiv="refresh" content="0; url=/timeout?ms=100" />
<meta http-equiv="refresh" content="0; url=/redirect-timeout" />
<title>Page Redirect</title>
</head>
<body>
Expand Down
38 changes: 38 additions & 0 deletions packages/driver/cypress/fixtures/shadow-dom-button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<title>Shadow DOM Button test</title>
</head>

<body>
<cy-test-element id='element'>Click me!</cy-test-element>
<script>
class CyTestElement extends HTMLElement {
constructor() {
super();

this.attachShadow({ mode: 'open' });
const button = document.createElement('button');
const slot = document.createElement('slot');

button.setAttribute('data-test-id', 'my-button')

button.appendChild(slot);

button.addEventListener('click', () => {
const div = document.createElement('div');
div.textContent = 'Clicked'

this.shadowRoot.appendChild(div);
});

this.shadowRoot.appendChild(
button
);
}
}

customElements.define('cy-test-element', CyTestElement);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -3985,6 +3985,13 @@ describe('shadow dom', () => {

cy.get('#shadow-element-1').click()
})

// https://github.com/cypress-io/cypress/issues/18008
it('does not fail actionability check when element is covered by its shadow host', () => {
cy.visit('/fixtures/shadow-dom-button.html')

cy.get('#element').shadow().find('[data-test-id="my-button"]').click()
})
})

describe('mouse state', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/cypress/integration/commands/task_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('src/cy/commands/task', () => {
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')

expect(err.message).to.eq(`\`cy.task('bar')\` failed with the following error:\n\nThe task 'bar' was not handled in the setupNodeEvents method. The following tasks are registered: return:arg, arg:is:undefined, wait, create:long:file\n\nFix this in your setupNodeEvents method here:\n${path.join(Cypress.config('projectRoot'), Cypress.config('configFile'))}`)
expect(err.message).to.eq(`\`cy.task('bar')\` failed with the following error:\n\nThe task 'bar' was not handled in the setupNodeEvents method. The following tasks are registered: return:arg, cypress:env, arg:is:undefined, wait, create:long:file\n\nFix this in your setupNodeEvents method here:\n${path.join(Cypress.config('projectRoot'), Cypress.config('configFile'))}`)

done()
})
Expand Down
15 changes: 15 additions & 0 deletions packages/driver/cypress/integration/cypress/cy_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,5 +476,20 @@ describe('driver/src/cypress/cy', () => {
expect(cy.state('current').get('prev').get('args')[0].foo).to.equal('foo')
})
})

// https://github.com/cypress-io/cypress/issues/18892
it('passes this through to overwritten command', () => {
Cypress.Commands.add('bar', function () {
expect(this.test.title).to.exist
})

cy.bar()

Cypress.Commands.overwrite('bar', function (originalFn) {
return originalFn.call(this)
})

cy.bar()
})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const shouldNotExecute = () => {
throw new Error('Test Override validation should have failed & it block should not have executed.')
}

it('first should not run', () => {
shouldNotExecute()
})

describe('second should not run', () => {
it('test', () => {
shouldNotExecute()
})
})

describe('correctly applies overrides ', { retries: 1 }, () => {
// eslint-disable-next-line mocha/no-exclusive-tests
describe.only('when valid configuration', () => {
it('for describe.only', { baseUrl: null }, () => {
const config = Cypress.config()

expect(config.testConfigList).to.be.undefined
expect(config.unverifiedTestConfig).to.be.undefined
expect(config.baseUrl).to.be.null
expect(config.retries).to.eq(1)
})
})
})

0 comments on commit be5e79a

Please sign in to comment.