Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ct-public-api
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 authored Feb 15, 2023
2 parents bfa2d60 + eed2b84 commit 217c104
Show file tree
Hide file tree
Showing 205 changed files with 5,038 additions and 2,610 deletions.
14 changes: 12 additions & 2 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ mainBuildFilters: &mainBuildFilters
- develop
- /^release\/\d+\.\d+\.\d+$/
- 'feature/ct-public-api'
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'update-v8-snapshot-cache-on-develop'

# usually we don't build Mac app - it takes a long time
# but sometimes we want to really confirm we are doing the right thing
Expand All @@ -38,6 +40,8 @@ macWorkflowFilters: &darwin-workflow-filters
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'feature/ct-public-api', << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -47,6 +51,8 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'feature/ct-public-api', << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -64,7 +70,8 @@ windowsWorkflowFilters: &windows-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'mschile/chrome_memory_fix', << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -201,7 +208,8 @@ commands:
name: Generate v8 snapshot
command: |
source ./scripts/ensure-node.sh
yarn build-v8-snapshot-prod
# Minification takes some time. We only really need to do that for the binary (and we regenerate snapshots separately there)
V8_SNAPSHOT_DISABLE_MINIFY=1 yarn build-v8-snapshot-prod
- prepare-modules-cache # So we don't throw these in the workspace cache
- persist_to_workspace:
root: ~/
Expand Down Expand Up @@ -1443,6 +1451,8 @@ jobs:
- update_known_hosts
- run: yarn test-npm-package-release-script
- run: node ./scripts/semantic-commits/validate-binary-changelog.js
- store_artifacts:
path: /tmp/releaseData

lint-types:
<<: *defaults
Expand Down
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ DO NOT DELETE the PR checklist.
-->

- [ ] Have tests been added/updated?
- [ ] 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)?
2 changes: 1 addition & 1 deletion .github/workflows/update-browser-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_ACTION_TOKEN }}
- name: Set committer info
## attribute the commit to cypress-bot: https://github.community/t/logging-into-git-as-a-github-app/115916
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/update_v8_snapshot_cache.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Update V8 Snapshot Cache
on:
schedule:
# Run everyday except Wednesday at 00:00 UTC
- cron: '0 0 * * 0,1,2,4,5,6'
# Run every Wednesday at 00:00 UTC
- cron: '0 0 * * 3'
push:
branches:
- ryanm/feature/v8-snapshots-auto-pr
- develop
- 'release/**'
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -35,7 +35,8 @@ jobs:
env:
CYPRESS_BOT_APP_ID: ${{ secrets.RAM_APP }}
BASE_BRANCH: ${{ inputs.branch || github.ref_name }}
GENERATE_FROM_SCRATCH: ${{ inputs.generate_from_scratch == true || github.event_name == 'schedule' }}
# Flex the generate from scratch option based on manual input or if we are on the weekly schedule
GENERATE_FROM_SCRATCH: ${{ inputs.generate_from_scratch == true || (github.event_name == 'schedule' && github.event.schedule == '0 0 * * 3') }}
steps:
- name: Determine snapshot files - Windows
if: ${{ matrix.platform == 'windows-latest' }}
Expand All @@ -51,7 +52,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BOT_GITHUB_ACTION_TOKEN }}
ref: ${{ env.BASE_BRANCH }}
- name: Set committer info
## attribute the commit to cypress-bot: https://github.community/t/logging-into-git-as-a-github-app/115916
Expand Down
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ We do not continuously deploy the Cypress binary, so `develop` contains all of t
- `test` - Adding missing or correcting existing tests
- For user-facing changes that will be released with the next Cypress version, be sure to add a changelog entry to the appropriate section in [`cli/CHANGELOG.md`](./cli/CHANGELOG.md). See [Writing the Cypress Changelog Guide](./guides/writing-the-cypress-changelog.md) for more details.
- Fill out the [Pull Request Template](./.github/PULL_REQUEST_TEMPLATE.md) completely within the body of the PR. If you feel some areas are not relevant add `N/A` as opposed to deleting those sections. PRs will not be reviewed if this template is not filled in.
- If the PR is a user facing change and you're a Cypress team member that has logged into [ZenHub](https://www.zenhub.com/) and downloaded the [ZenHub for GitHub extension](https://www.zenhub.com/extension), set the release the PR is intended to ship in from the sidebar of the PR. Follow semantic versioning to select the intended release. This is used to generate the changelog for the release. If you don't tag a PR for release, it won't be mentioned in the changelog.
![Select release for PR](https://user-images.githubusercontent.com/1271364/135139641-657015d6-2dca-42d4-a4fb-16478f61d63f.png)
- Please check the "Allow edits from maintainers" checkbox when submitting your PR. This will make it easier for the maintainers to make minor adjustments, to help with tests or any other changes we may need.
![Allow edits from maintainers checkbox](https://user-images.githubusercontent.com/1271181/31393427-b3105d44-ada9-11e7-80f2-0dac51e3919e.png)
- All Pull Requests require a minimum of **two** approvals.
Expand Down Expand Up @@ -561,10 +559,6 @@ Below are guidelines to help during code review. If any of the following require
- [ ] There is no irrelevant code to the issue being addressed. If there is, ask the contributor to break the work out into a separate PR.
- [ ] Tests are testing the code's intended functionality in the best way possible.

#### Internal

- [ ] The original issue has been tagged with a release in ZenHub.

### Code Review of Dependency Updates

Below are some guidelines Cypress uses when reviewing dependency updates.
Expand All @@ -579,7 +573,6 @@ Below are some guidelines Cypress uses when reviewing dependency updates.

- [ ] Code using the dependency has been updated to accommodate any breaking changes
- [ ] The dependency still supports the version of Node that the package requires.
- [ ] The PR been tagged with a release in ZenHub.
- [ ] Appropriate labels have been added to the PR (for example: label `type: breaking change` if it is a breaking change)

## Releases
Expand Down
18 changes: 11 additions & 7 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.6.0

_Released 02/14/2023 (PENDING)_

**Features:**

- It is now possible to overwrite query commands using [`Cypress.Commands.overwriteQuery`](https://on.cypress.io/api/custom-queries). Addressed in [#25674](https://github.com/cypress-io/cypress/pull/25674).
- Added the "Open in IDE" feature for failed tests reported from the Debug page. Addressed in [#25691](https://github.com/cypress-io/cypress/pull/25691).
- Added a new CLI flag, called [`--auto-cancel-after-failures`](https://docs.cypress.io/guides/guides/command-line#Options), that overrides the project-level CI ["Auto Cancellation"](https://docs.cypress.io/guides/cloud/smart-orchestration#Auto-Cancellation) value when recording to the Cloud. This gives Cloud users on Business and Enterprise plans the flexibility to alter the auto-cancellation value per run. Addressed in [#25237](https://github.com/cypress-io/cypress/pull/25237).
- Added `Cypress.require()` for including dependencies within the `cy.origin()` callback. Removed support for `require()` and `import()` within the callback. Addresses [#24976](https://github.com/cypress-io/cypress/issues/24976).

**Bugfixes:**

- Fixed an issue with the Cloud project selection modal not showing the correct prompts. Fixes [#25520](https://github.com/cypress-io/cypress/issues/25520).
- Fixed an issue in middleware where error-handling code could itself generate an error and fail to report the original issue. Fixes [#22825](https://github.com/cypress-io/cypress/issues/22825).
- Fixed an issue that could cause the Debug page to display a different number of specs for in-progress runs than shown in Cypress Cloud. Fixes [#25647](https://github.com/cypress-io/cypress/issues/25647).

**Features:**

- Added the "Open in IDE" feature for failed tests reported from the Debug page. Addressed in [#25691](https://github.com/cypress-io/cypress/pull/25691).
- Added a new CLI flag, called [`--auto-cancel-after-failures`](https://docs.cypress.io/guides/guides/command-line#Options), that overrides the project-level CI ["Auto Cancellation"](https://docs.cypress.io/guides/cloud/smart-orchestration#Auto-Cancellation) value when recording to the Cloud. This gives Cloud users on Business and Enterprise plans the flexibility to alter the auto-cancellation value per run. Addressed in [#25237](https://github.com/cypress-io/cypress/pull/25237).
- Fixed an issue introduced in Cypress 12.3.0 where custom browsers that relied on process environment variables were not found on macOS arm64 architectures. Fixed in [#25753](https://github.com/cypress-io/cypress/pull/25753).
- Fixed an issue where Cypress would fail to load any specs if the project `specPattern` included a resource that could not be accessed due to filesystem permissions. Fixes [#24109](https://github.com/cypress-io/cypress/issues/24109).

**Misc:**

Expand All @@ -29,7 +33,7 @@ _Released 02/14/2023 (PENDING)_

## 12.5.1

_Released 02/10/2023_
_Released 02/02/2023_

**Bugfixes:**

Expand Down
19 changes: 17 additions & 2 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ declare namespace Cypress {
interface QueryFn<T extends keyof ChainableMethods> {
(this: Command, ...args: Parameters<ChainableMethods[T]>): (subject: any) => any
}
interface QueryFnWithOriginalFn<T extends keyof Chainable> {
(this: Command, originalFn: QueryFn<T>, ...args: Parameters<ChainableMethods[T]>): (subject: any) => any
}
interface ObjectLike {
[key: string]: any
}
Expand Down Expand Up @@ -648,6 +651,12 @@ declare namespace Cypress {
* @see https://on.cypress.io/api/custom-queries
*/
addQuery<T extends keyof Chainable>(name: T, fn: QueryFn<T>): void

/**
* Overwrite an existing Cypress query with a new implementation
* @see https://on.cypress.io/api/custom-queries
*/
overwriteQuery<T extends keyof Chainable>(name: T, fn: QueryFnWithOriginalFn<T>): void
}

/**
Expand Down Expand Up @@ -786,14 +795,20 @@ declare namespace Cypress {
*/
off: Actions

/**
* Used to include dependencies within the cy.origin() callback
* @see https://on.cypress.io/origin
*/
require: <T = any>(id: string) => T

/**
* Trigger action
* @private
*/
action: (action: string, ...args: any[]) => any[] | void

/**
* Load files
* Load files
* @private
*/
onSpecWindow: (window: Window, specList: string[] | Array<() => Promise<void>>) => void
Expand Down Expand Up @@ -3126,7 +3141,7 @@ declare namespace Cypress {
*/
experimentalRunAllSpecs?: boolean
/**
* Enables support for require/import within cy.origin.
* Enables support for `Cypress.require()` for including dependencies within the `cy.origin()` callback.
* @default false
*/
experimentalOriginDependencies?: boolean
Expand Down
17 changes: 17 additions & 0 deletions cli/types/tests/cypress-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1164,3 +1164,20 @@ namespace CypressTraversalTests {
cy.wrap({}).parentsUntil('#myItem', 'a', { log: false, timeout: 100 }) // $ExpectType Chainable<JQuery<HTMLElement>>
cy.wrap({}).parentsUntil('#myItem', 'a', { log: 'true' }) // $ExpectError
}

namespace CypressRequireTests {
Cypress.require('lodash')

const anydep = Cypress.require('anydep')
anydep // $ExpectType any

const sinon = Cypress.require<sinon.SinonStatic>('sinon') as typeof import('sinon')
sinon // $ExpectType SinonStatic

const lodash = Cypress.require<_.LoDashStatic>('lodash')
lodash // $ExpectType LoDashStatic

Cypress.require() // $ExpectError
Cypress.require({}) // $ExpectError
Cypress.require(123) // $ExpectError
}
37 changes: 27 additions & 10 deletions guides/code-signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,37 @@ Code signing is done for the Windows and Mac distributions of Cypress when they

`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).

## Installing a new Mac code signing key
## Rotating the Mac code signing key

Follow the directions supplied by `electron-builder`: https://www.electron.build/code-signing#travis-appveyor-and-other-ci-servers
1. On a Mac, log in to Xcode using Cypress's Apple developer program identity.
2. Follow Apple's [Create, export, and delete signing certificates](https://help.apple.com/xcode/mac/current/#/dev154b28f09) instructions:
1. Follow "View signing certificates".
2. Follow "Create a signing certificate", and choose the type of "Developer ID Application" when prompted.
3. Follow "Export a signing certificate". Set a strong passphrase when prompted, which will later become `CSC_KEY_PASSWORD`.
3. Upload the exported, encrypted `.p12` file to the [Code Signing folder][code-signing-folder] in Google Drive and obtain a public [direct download link][direct-download].
4. Within the `test-runner:sign-mac-binary` CircleCI context, set `CSC_LINK` to that direct download URL and set `CSC_KEY_PASSWORD` to the passphrase used to encrypt the `p12` file.

Set the environment variables `CSC_LINK` and `CSC_KEY_PASSWORD` in the `test-runner:sign-mac-binary` CircleCI context.
## Rotating the Windows code signing key

## Installing a new Windows code signing key

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-----`)
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.
1. Generate a certificate signing request (CSR) file using `openssl`. For example:
```shell
# generate a new private key
openssl genrsa -out win-code-signing.key 4096
# create a CSR using the private key
openssl req -new -key win-code-signing.key -out win-code-signing.csr
```
2. Obtain a certificate by submitting the CSR to SSL.com using the Cypress SSL.com account.
* If renewing, follow the [renewal instructions](https://www.ssl.com/how-to/renewing-ev-ov-and-iv-certificates/).
* If rotating, contact SSL.com's support to request certificate re-issuance.
3. Obtain the full certificate chain from SSL.com's dashboard in ASCII-armored PEM format and save it as `win-code-signing.crt`. (`-----BEGIN PRIVATE KEY-----`, `-----BEGIN CERTIFICATE-----`)
4. Using `openssl`, convert the plaintext PEM public and private key to binary PKCS#12/PFX format and encrypt it with a strong passphrase, which will later become `CSC_KEY_PASSWORD`.
```shell
➜ openssl pkcs12 -export -inkey key.pem -in cert.pem -out encrypted.pfx
➜ openssl pkcs12 -export -inkey win-code-signing.key -in win-code-signing.crt -out encrypted-win-code-signing.pfx
Enter Export Password: <password>
Verifying - Enter Export Password: <password>
```
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).
4. Within the `test-runner:sign-windows-binary` CircleCI context, set `CSC_LINK` to that URL and `CSC_KEY_PASSWORD` to the password.
5. Upload the `encrypted-win-code-signing.pfx` file to the [Code Signing folder][code-signing-folder] in Google Drive and obtain a public [direct download link][direct-download].
6. Within the `test-runner:sign-windows-binary` CircleCI context, set `CSC_LINK` to that direct download URL and set `CSC_KEY_PASSWORD` to the passphrase used to encrypt the `pfx` file.

[direct-download]: https://www.syncwithtech.org/p/direct-download-link-generator.html
[code-signing-folder]: https://drive.google.com/drive/u/1/folders/1CsuoXRDmXvd3ImvFI-sChniAMJBASUW
Loading

4 comments on commit 217c104

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 217c104 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/linux-x64/feature/ct-public-api-217c1045249a31345710f4f836337e35c964740f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 217c104 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/linux-arm64/feature/ct-public-api-217c1045249a31345710f4f836337e35c964740f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 217c104 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/darwin-arm64/feature/ct-public-api-217c1045249a31345710f4f836337e35c964740f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 217c104 Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.6.0/darwin-x64/feature/ct-public-api-217c1045249a31345710f4f836337e35c964740f/cypress.tgz

Please sign in to comment.