Skip to content

Commit 21712a5

Browse files
committed
Merge branch 'develop' into rm-appveyor
2 parents 81797b5 + f85c736 commit 21712a5

File tree

16 files changed

+290
-108
lines changed

16 files changed

+290
-108
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ Below are some guidelines Cypress uses when reviewing dependency updates.
650650

651651
## Deployment
652652

653-
We will try to review and merge pull requests quickly. If you want to know our build process or build your own Cypress binary, read [DEPLOY.md](./DEPLOY.md).
653+
We will try to review and merge pull requests quickly. If you want to know our build process or build your own Cypress binary, read [the "Release Process" guide](./guides/release-process.md).
654654

655655
Independent packages are deployed immediately upon being merged into master. You can read more [above](#independent-packages-ci-workflow).
656656

guides/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Guides
2+
3+
The `guides` directory contains information about specific things encountered *when contributing to the Cypress project* that fall outside the scope of `CONTRIBUTING.md`, which is more geared towards everyday development in this repo.
4+
5+
For information about using Cypress for testing web applications, visit [`docs.cypress.io`](https://docs.cypress.io).
6+
7+
For information related to a specific package in the monorepo, see that package's respective `README.md`.
8+
9+
For general contributor information, check out [`CONTRIBUTING.md`](../CONTRIBUTING.md).
10+
11+
## Table of Contents
12+
13+
* [Building release artifacts](./building-release-artifacts.md)
14+
* [Code signing](./code-signing.md)
15+
* [Determining the next version of Cypress to be released](./next-version.md)
16+
* [Release process](./release-process.md)
17+
* [Testing other projects](./testing-other-projects.md)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Building Release Artifacts
2+
3+
The `cypress` NPM package consists of two main parts:
4+
5+
1. The `cypress` NPM package `.tgz` (built from [`cli`](../cli))
6+
* Contains the command line tool `cypress`, type definitions, and the [Module API](https://on.cypress.io/module-api).
7+
* End users install this via NPM to the project's `node_modules`.
8+
2. The "binary" `.zip` (built from [`packages/server`](../packages/server))
9+
* Contains the Electron app, `ffmpeg`, and built versions of the [`server`](../packages/server), [`desktop-gui`](../packages/desktop-gui), [`runner`](../packages/runner), [`example` project](../packages/example), and [`extension`](../packages/extension)
10+
* Also contains all the production dependencies of the above.
11+
* This is installed when the `cli` is installed or when `cypress install` is run, to a system cache.
12+
13+
This guide has instructions for building both.
14+
15+
## Building the npm package
16+
17+
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when going through the [release process](./release-process.md).
18+
19+
Building a new npm package is two commands:
20+
21+
1. Increment the version in the root `package.json`
22+
2. `yarn build --scope cypress`
23+
24+
The steps above:
25+
26+
- Build the `cypress` npm package
27+
- Transpile the code into ES5 to be compatible with the common Node versions
28+
- Put the result into the [`cli/build`](../cli/build) folder.
29+
30+
## Building the binary
31+
32+
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when going through the [release process](./release-process.md).
33+
34+
The npm package requires a corresponding binary of the same version. In production, it will try to retrieve the binary from the Cypress CDN if it is not cached locally.
35+
36+
You can build the Cypress binary locally by running `yarn binary-build`. You can use Linux to build the Cypress binary (just like it is in CI) by running `yarn binary-build` inside of `yarn docker`.
37+
38+
`yarn binary-zip` can be used to zip the built binary together.

guides/code-signing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Code Signing
2+
3+
Code signing is done for the Windows and Mac distributions of Cypress when they are built in CI.
4+
5+
`electron-builder` handles code signing during the `create-build-artifacts` jobs. This guide assumes that the reader is already familiar with [`electron-builder`'s Code Signing documentation](https://www.electron.build/code-signing).
6+
7+
## Installing a new Mac code signing key
8+
9+
Follow the directions supplied by `electron-builder`: https://www.electron.build/code-signing#travis-appveyor-and-other-ci-servers
10+
11+
Set the environment variables `CSC_LINK` and `CSC_KEY_PASSWORD` in the `test-runner:sign-mac-binary` CircleCI context.
12+
13+
## Installing a new Windows code signing key
14+
15+
1. Obtain the private key and full certificate chain in ASCII-armored PEM format and store each in a file (`-----BEGIN PRIVATE KEY-----`, `-----BEGIN CERTIFICATE-----`)
16+
2. Using `openssl`, convert the plaintext PEM public and private key to binary PKCS#12/PFX format and encrypt it with a real strong password.
17+
```shell
18+
➜ openssl pkcs12 -export -inkey key.pem -in cert.pem -out encrypted.pfx
19+
Enter Export Password: <password>
20+
Verifying - Enter Export Password: <password>
21+
```
22+
3. Upload the `encrypted.pfx` file to the Cypress App Google Drive and obtain a [direct download link](http://www.syncwithtech.org/p/direct-download-link-generator.html).
23+
4. Within the `test-runner:sign-windows-binary` CircleCI context, set `CSC_LINK` to that URL and `CSC_KEY_PASSWORD` to the password.

guides/next-version.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Next Version
2+
3+
When the Cypress CLI and binary are built in CI, the version number they share is determined by the script in [`/scripts/get-next-version.js`](../scripts/get-next-version.js).
4+
5+
In most cases, the script will correctly determine the next version. If it needs to be overridden, the environment variable `NEXT_VERSION` can be set to the desired version (`NEXT_VERSION=1.2.3`). This is commonly desired on a release branch or when trying to force a specific major version.
6+
7+
The `get-next-version.js` script follows these steps:
8+
9+
1. If the environment variable `NEXT_VERSION` exists, print `NEXT_VERSION` and exit.
10+
2. Otherwise, analyze the commits to the current branch since the last release, using semantic commit messages. Print out the calculated version.
11+
* Only commits that touch files in `packages/*` or `cli/*` are considered.
12+
* This is done so that commits to the `npm/` packages do not necessarily bump the CLI and binary versions.
13+
* This project uses the [`angular` commit message style](https://gist.github.com/brianclements/841ea7bffdb01346392c/8e1f9b44d3fc7a4f2b448581071f9805f759c912).
14+
* The prefix `fix:` will trigger a patch version bump.
15+
* The prefix `feat:` will trigger a minor version bump.
16+
* A commit with the footer containing `BREAKING CHANGE:` should trigger a major version bump.
17+
18+
You can debug the script locally by running it using `node ./scripts/get-next-version.js`. It will analyze the commits on your current branch and print out the calculated version number.

DEPLOY.md renamed to guides/release-process.md

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,10 @@
1-
# Deployment
1+
# Release Process
22

3-
These deployment procedures mainly concern the Cypress binary and `cypress` npm module.
3+
These procedures concern the release process for the Cypress binary and `cypress` npm module.
44

5-
Independent `@cypress/` packages that live inside the [`npm`](./npm) directory are automatically published to npm (with [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/)) upon being merged into master. You can read more about this in [CONTRIBUTING.md](./CONTRIBUTING.md#committing-code)
5+
The `@cypress/`-namespaced NPM packages that live inside the [`/npm`](../npm) directory are automatically published to npm (with [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/)) upon being merged into `master`. You can read more about this in [CONTRIBUTING.md](../CONTRIBUTING.md#independent-packages-ci-workflow).
66

7-
Anyone can build the binary and npm package, but you can only deploy the Cypress application and publish the npm module `cypress` if you are a member of the `cypress` npm organization.
8-
9-
> :information_source: See the [publishing](#publishing) section for how to build, test and publish a
10-
new official version of the binary and `cypress` npm package.
11-
12-
## Building Locally
13-
14-
### Building the npm package
15-
16-
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when publishing.
17-
18-
Building a new npm package is very quick.
19-
20-
- Increment the version in the root `package.json`
21-
- `yarn build --scope cypress`
22-
23-
The steps above:
24-
25-
- Build the `cypress` npm package
26-
- Transpile the code into ES5 to be compatible with the common Node versions
27-
- Put the result into the [`cli/build`](./cli/build) folder.
28-
29-
### Building the binary
30-
31-
> :warning: Note: The steps in this section are automated in CI, and you should not need to do them yourself when publishing.
32-
33-
The npm package requires a corresponding binary of the same version. In production, it will try to retrieve the binary from the Cypress CDN if it is not cached locally.
34-
35-
You can build the Cypress binary locally by running `yarn binary-build`. You can use Linux to build the Cypress binary (just like it is in CI) by running `yarn binary-build` inside of `yarn docker`.
36-
37-
`yarn binary-zip` can be used to zip the built binary together.
7+
[Anyone can build the binary and npm package locally](./building-release-artifacts.md), but you can only deploy the Cypress application and publish the npm module `cypress` if you are a member of the `cypress` npm organization.
388

399
## Publishing
4010

@@ -60,6 +30,11 @@ You can build the Cypress binary locally by running `yarn binary-build`. You can
6030
ZENHUB_API_TOKEN="..."
6131
```
6232
- The `cypress-bot` GitHub app credentials are also needed. Ask another team member who has done a deploy for those.
33+
```text
34+
GITHUB_APP_CYPRESS_INSTALLATION_ID=
35+
GITHUB_APP_ID=
36+
GITHUB_PRIVATE_KEY=
37+
```
6338
- For purging the Cloudflare cache (part of the `move-binaries` step), you'll need `CF_ZONEID` and `CF_TOKEN` set. These can be found in 1Password. If you don't have access, ask a team member who has done a deploy.
6439
```text
6540
CF_ZONEID="..."
@@ -69,16 +44,12 @@ You can build the Cypress binary locally by running `yarn binary-build`. You can
6944
7045
### Before Publishing a New Version
7146
72-
In order to publish a new `cypress` package to the npm registry, we must build and test it across multiple platforms and test projects. This makes publishing *directly* into the npm registry impossible. Instead, we have CI set up to do the following on every commit to `develop`:
47+
In order to publish a new version of the `cypress` package to the npm registry, CI must build and test it across multiple platforms and test projects. CI is set up to do the following on every commit to `develop`:
7348
74-
1. Build the npm package with the new target version baked in.
49+
1. Build the npm package with the [next target version](./next-version.md) baked in.
7550
2. Build the Linux, Mac & Windows binaries on CircleCI.
76-
3. Upload the binaries and the new npm package to `cdn.cypress.io` under the "beta" folder.
77-
4. Launch the test projects like [cypress-test-node-versions](https://github.com/cypress-io/cypress-test-node-versions) and [cypress-test-example-repos](https://github.com/cypress-io/cypress-test-example-repos) using the newly-uploaded package & binary instead of installing from the npm registry. That installation looks like this:
78-
```shell
79-
export CYPRESS_INSTALL_BINARY=https://cdn.../binary/<new version>/<commit hash>/cypress.zip
80-
npm i https://cdn.../npm/<new version>/<commit hash>/cypress.tgz
81-
```
51+
3. Upload the binaries and the new npm package to the AWS S3 Bucket `cdn.cypress.io` under the "beta" folder.
52+
4. [Launch test projects](./testing-other-projects.md) using the newly-uploaded package & binary instead of installing from the npm registry.
8253
8354
Multiple test projects are launched for each target operating system and the results are reported
8455
back to GitHub using status checks so that you can see if a change has broken real-world usage
@@ -90,11 +61,11 @@ Once the `develop` branch for all test projects are reliably passing with the ne
9061
9162
### Steps to Publish a New Version
9263
93-
In the following instructions, "X.Y.Z" is used to denote the version of Cypress being published.
64+
In the following instructions, "X.Y.Z" is used to denote the [next version of Cypress being published](./next-version.md).
9465
9566
1. `develop` should contain all of the changes made in `master`. However, this occasionally may not be the case. Ensure that `master` does not have any additional commits that are not on `develop` and all auto-generated pull requests designed to merge master into develop have been successfully merged.
9667
97-
2. If there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version, update the corresponding dependency in [`packages/example`](./packages/example) to that new version.
68+
2. If there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version, update the corresponding dependency in [`packages/example`](../packages/example) to that new version.
9869
9970
3. Use the `move-binaries` script to move the binaries for `<commit sha>` from `beta` to the `desktop` folder for `<new target version>`. This also purges the cloudflare cache for this version.
10071
```shell
@@ -109,7 +80,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
10980
![cdn-tgz-link](https://user-images.githubusercontent.com/1157043/80608736-3791e800-8a05-11ea-8d75-e4f80128e857.png)
11081
- Publish to the npm registry straight from the URL:
11182
```shell
112-
npm publish https://cdn.../npm/X.Y.Z/<long sha>/cypress.tgz --tag dev
83+
npm publish https://cdn.cypress.io/beta/npm/X.Y.Z/<long sha>/cypress.tgz --tag dev
11384
```
11485
11586
5. Double-check that the new version has been published under the `dev` tag using `npm info cypress` or [available-versions](https://github.com/bahmutov/available-versions). `latest` should still point to the previous version. Example output:
@@ -156,7 +127,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
156127
157128
11. If needed, push out any updated changes to the links manifest to [`on.cypress.io`](https://github.com/cypress-io/cypress-services/tree/develop/packages/on).
158129
159-
12. If needed, deploy the updated [`cypress-example-kitchensink`][cypress-example-kitchensink] to `example.cypress.io` by following [these instructions under "Deployment"](./packages/example/README.md).
130+
12. If needed, deploy the updated [`cypress-example-kitchensink`][cypress-example-kitchensink] to `example.cypress.io` by following [these instructions under "Deployment"](../packages/example/README.md).
160131
161132
13. Update the releases in [ZenHub](https://app.zenhub.com/workspaces/test-runner-5c3ea3baeb1e75374f7b0708/reports/release):
162133
- Close the current release in ZenHub.

guides/testing-other-projects.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Testing other projects
2+
3+
In `develop`, `master`, and any other branch configured in [`circle.yml`](../circle.yml), the Cypress binary and npm package are built and uploaded to `cdn.cypress.io`. Then, tests are run, using a variety of real-world example repositories.
4+
5+
Two main strategies are used to spawn these test projects:
6+
7+
1. Local CI
8+
2. Remote CI
9+
10+
## Local CI
11+
12+
A number of CI jobs in `circle.yml` clone test projects and run tests as part of `cypress-io/cypress`'s CI pipeline.
13+
14+
You can find a list of test projects that do this by searching for usage of the `test-binary-against-repo` step.
15+
16+
Similarly to "Remote CI" test projects, Local CI test projects will attempt to check out a branch that is named after the [next version](./next-version.md) (`X.Y.Z`) if one exists in the test project git repo.
17+
18+
One advantage to local CI is that it does not require creating commits to another repo.
19+
20+
## Remote CI
21+
22+
After the production binary and NPM package are build and uploaded in CI, [`/scripts/test-other-projects.js`](../scripts/test-other-projects.js) is run as part of the `test-other-projects` `circle.yml` step.
23+
24+
This script creates commits inside of several test projects (hence "Remote CI") in order to trigger a realistic, continous-integration test of Cypress.
25+
26+
For a list of the projects, see the definition of `_PROVIDERS` in [`/scripts/binary/bump.js`](../scripts/binary/bump.js).
27+
28+
For each project and operating system combo in `_PROVIDERS`, the script:
29+
30+
1. Creates a commit to the test project's GitHub repo using the API. [An example of such a commit.](https://github.com/cypress-io/cypress-test-tiny/commit/5b39f3f43f6b7598f0d57cffcba71a7048d1d809)
31+
* Note the commit is specifically for `linux`, and only the `linux-tests` job runs to completion.
32+
* If a branch exists that is named after the [next version](./next-version.md) (`X.Y.Z`), the commit will be made to that branch.
33+
* This is useful to test a release's breaking changes or new features against an example project without having to have the project's main branch in a broken state.
34+
* Otherwise, the default branch is used for the commit.
35+
2. Creates a status check in this GitHub repo (`cypress-io/cypress`) and marks it `pending`.
36+
3. Waits for the test project's CI workflow to finish running.
37+
* Each test project is configured to use [`@cypress/commit-message-install`](https://github.com/cypress-io/commit-message-install) to configure the exact test required via the information in the commit message.
38+
* Each test project is configured to update the `pending` CI job in `cypress-io/cypress` to a `success` when the CI workflow successfully finishes.
39+
40+
These tests add coverage to the Cypress code base by:
41+
42+
* Providing a super-close-to-real-world usage of Cypress (i.e. installing fresh from an NPM package and running in a bare repo using the repo's CI setup)
43+
* Testing in a variety of environments
44+
* Different Node.js versions
45+
* Different operating systems
46+
* A multitude of CI providers
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<html>
2+
<body>
3+
<test-element id="element"></test-element>
4+
<div id="result"></div>
5+
</body>
6+
<script>
7+
class TestElement extends HTMLElement {
8+
constructor() {
9+
super();
10+
this._shadow = this.attachShadow({mode: "open"});
11+
12+
const input = document.createElement("input");
13+
this._shadow.appendChild(input);
14+
}
15+
}
16+
17+
customElements.define("test-element", TestElement);
18+
19+
const el = document.getElementById("element");
20+
21+
el.addEventListener('keydown', () =>{
22+
document.getElementById('result').innerText = 'typed'
23+
})
24+
</script>
25+
</html>

packages/driver/cypress/integration/commands/actions/type_spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,5 +3592,16 @@ describe('src/cy/commands/actions/type - #type', () => {
35923592
.find('input', { includeShadowDom: true })
35933593
.type('foo')
35943594
})
3595+
3596+
// https://github.com/cypress-io/cypress/issues/17531
3597+
it('text events propagate out of shadow root', () => {
3598+
cy.visit('fixtures/shadow-dom-type.html')
3599+
3600+
cy
3601+
.get('test-element').shadow()
3602+
.find('input').type('asdf')
3603+
3604+
cy.get('#result').should('have.text', 'typed')
3605+
})
35953606
})
35963607
})

packages/driver/cypress/integration/commands/clock_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ describe('src/cy/commands/clock', () => {
125125
})
126126
})
127127

128+
it('overwrites without crashing', () => {
129+
Cypress.Commands.overwrite('clock', (originalCommand, ...args) => {
130+
return originalCommand(...args)
131+
})
132+
133+
cy.clock()
134+
})
135+
128136
context('errors', () => {
129137
it('throws if now is not a number (or options object)', (done) => {
130138
cy.on('fail', (err) => {

0 commit comments

Comments
 (0)