Skip to content

Commit

Permalink
Merge branch 'develop' into fix/config-port-overriding-devserver
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthemanuel authored Aug 29, 2023
2 parents ca7bad2 + 8e23148 commit 0a0eebd
Show file tree
Hide file tree
Showing 538 changed files with 26,816 additions and 9,703 deletions.
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bump this version to force CI to re-create the cache from scratch.

08-28-23
08-28-23
32 changes: 14 additions & 18 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ mainBuildFilters: &mainBuildFilters
- /^release\/\d+\.\d+\.\d+$/
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'update-v8-snapshot-cache-on-develop'
- 'fix/resolve_browser_process_correctly_for_mjs'
- 'chore/bump_loaders_and_optimize_webpack'
- 'bump-circle-cache'
- 'publish-binary'
- 'cacie/chore/capture-metadata'

# 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 @@ -43,8 +42,7 @@ macWorkflowFilters: &darwin-workflow-filters
- equal: [ develop, << 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 >> ]
- equal: [ 'fix/resolve_browser_process_correctly_for_mjs', << pipeline.git.branch >> ]
- equal: [ 'bump-circle-cache', << pipeline.git.branch >> ]
- equal: [ cacie/chore/capture-metadata', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -55,9 +53,8 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
- equal: [ develop, << 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 >> ]
- equal: [ 'fix/resolve_browser_process_correctly_for_mjs', << pipeline.git.branch >> ]
- equal: [ 'chore/bump_loaders_and_optimize_webpack', << pipeline.git.branch >> ]
- equal: [ 'astone123/fix-get-published-artifacts', << pipeline.git.branch >> ]
- equal: [ 'publish-binary', << pipeline.git.branch >> ]
- equal: [ cacie/chore/capture-metadata', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -77,8 +74,7 @@ windowsWorkflowFilters: &windows-workflow-filters
- equal: [ develop, << 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 >> ]
- equal: [ 'fix/resolve_browser_process_correctly_for_mjs', << pipeline.git.branch >> ]
- equal: [ 'bump-circle-cache', << pipeline.git.branch >> ]
- equal: [ cacie/chore/capture-metadata', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -148,7 +144,7 @@ commands:
name: Set environment variable to determine whether or not to persist artifacts
command: |
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "fix/resolve_browser_process_correctly_for_mjs" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "update-v8-snapshot-cache-on-develop" && "$CIRCLE_BRANCH" != "ryanm/feat/handle-304s" ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
Expand Down Expand Up @@ -219,6 +215,7 @@ commands:
command: |
source ./scripts/ensure-node.sh
yarn gulp buildProd
yarn gulp syncCloudValidations
- run:
name: Build packages
command: |
Expand Down Expand Up @@ -511,7 +508,7 @@ commands:
# internal PR
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
CYPRESS_INTERNAL_ENABLE_TELEMETRY="true" \
yarn cypress:run --record --parallel --group 5x-driver-<<parameters.browser>> --browser <<parameters.browser>>
yarn cypress:run --record --parallel --group 5x-driver-<<parameters.browser>> --browser <<parameters.browser>> --runner-ui
else
# external PR
TESTFILES=$(circleci tests glob "cypress/e2e/**/*.cy.*" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Expand All @@ -520,7 +517,7 @@ commands:
if [[ -z "$TESTFILES" ]]; then
echo "Empty list of test files"
fi
yarn cypress:run --browser <<parameters.browser>> --spec $TESTFILES
yarn cypress:run --browser <<parameters.browser>> --spec $TESTFILES --runner-ui
fi
working_directory: packages/driver
- verify-mocha-results
Expand Down Expand Up @@ -594,7 +591,7 @@ commands:
if [[ <<parameters.type>> == 'ct' ]]; then
# component tests are located side by side with the source codes.
# for the app component tests, ignore specs that are known to cause failures on contributor PRs (see https://discuss.circleci.com/t/how-to-exclude-certain-files-from-circleci-test-globbing/41028)
TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL)
TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL)
else
GLOB="cypress/e2e/**/*cy.*"
TESTFILES=$(circleci tests glob "$GLOB" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Expand Down Expand Up @@ -1850,7 +1847,7 @@ jobs:
PERCY_ENABLE=${PERCY_TOKEN:-0} \
PERCY_PARALLEL_TOTAL=-1 \
yarn percy exec --parallel -- -- \
yarn cypress:run --record --parallel --group reporter
yarn cypress:run --record --parallel --group reporter --runner-ui
working_directory: packages/reporter
- verify-mocha-results
- store_test_results:
Expand Down Expand Up @@ -2191,7 +2188,6 @@ jobs:
CYPRESS_PROJECT_ID=$TEST_KITCHENSINK_PROJECT_ID \
CYPRESS_RECORD_KEY=$TEST_KITCHENSINK_RECORD_KEY \
CYPRESS_INTERNAL_ENV=staging \
CYPRESS_video=false \
yarn cypress:run --project /tmp/cypress-example-kitchensink --record
- store-npm-logs

Expand Down Expand Up @@ -2807,7 +2803,7 @@ linux-x64-workflow: &linux-x64-workflow
- build
- wait-for-binary-publish:
type: approval
requires:
requires:
- create-and-trigger-packaging-artifacts
- get-published-artifacts:
context:
Expand Down Expand Up @@ -2924,7 +2920,7 @@ linux-arm64-workflow: &linux-arm64-workflow
- wait-for-binary-publish:
name: linux-arm64-wait-for-binary-publish
type: approval
requires:
requires:
- linux-arm64-create-and-trigger-packaging-artifacts

- get-published-artifacts:
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ module.exports = {
'cli/types/**',
// these fixtures are supposed to fail linting
'npm/eslint-plugin-dev/test/fixtures/**',
// Cloud generated
'system-tests/lib/validations/**',
],
overrides: [
{
Expand Down
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

**/.eslintrc text eol=lf

packages/errors/__snapshot-html__/** linguist-generated=true
packages/errors/__snapshot-html__/** linguist-generated=true
system-tests/lib/validations/** linguist-generated=true
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
#
# Changes to the Module API, after:run, or after:spec results should be
# reviewed by Brian and/or Jennifer
/system-tests/__snapshots__/results_spec.ts.js @brian-mann @jennifer-shehane
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -395,3 +395,6 @@ tooling/v8-snapshot/cache/dev-win32
tooling/v8-snapshot/cache/prod-darwin
tooling/v8-snapshot/cache/prod-linux
tooling/v8-snapshot/cache/prod-win32

# Cloud API validations
system-tests/lib/validations
25 changes: 23 additions & 2 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.17.5
## 13.0.0

_Released 08/29/2023 (PENDING)_
_Released 08/22/2023 (PENDING)_

**Breaking Changes:**

- The [`cy.readFile()`](/api/commands/readfile) command is now retry-able as a [query command](https://on.cypress.io/retry-ability). This should not affect any tests using it; the functionality is unchanged. However, it can no longer be overwritten using [`Cypress.Commands.overwrite()`](/api/cypress-api/custom-commands#Overwrite-Existing-Commands). Addressed in [#25595](https://github.com/cypress-io/cypress/pull/25595).
- The [`video`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option now defaults to `false`. Addresses [#26157](https://github.com/cypress-io/cypress/issues/26157).
- The [`videoCompression`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option now defaults to `false`. Addresses [#26160](https://github.com/cypress-io/cypress/issues/26160).
- The [`videoUploadOnPasses`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option has been removed. Please see our [screenshots & videos guide](https://docs.cypress.io/guides/guides/screenshots-and-videos#Delete-videos-for-specs-without-failing-or-retried-tests) on how to accomplish similar functionality. Addresses [#26899](https://github.com/cypress-io/cypress/issues/26899).
- The current spec path is now passed from the AUT iframe using a query parameter rather than a path segment. This allows for requests for assets at relative paths to be correctly forwarded to the dev server. Fixes [#26725](https://github.com/cypress-io/cypress/issues/26725).
- The deprecated configuration option, `nodeVersion` has been removed. Addresses [#27016](https://github.com/cypress-io/cypress/issues/27016).
- The properties and values returned by the [Module API](https://docs.cypress.io/guides/guides/module-api) and included in the arguments of handlers for the [`after:run`](https://docs.cypress.io/api/plugins/after-run-api) and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) have been changed to be more consistent. Addresses [#23805](https://github.com/cypress-io/cypress/issues/23805).
- For Cypress Cloud runs with Test Replay enabled, the Cypress Runner UI is now hidden during the run since the Runner will be visible during Test Replay. As such, if video is recorded (which is now defaulted to `false`) during the run, the Runner will not be visible. In addition, if a runner screenshot (`cy.screenshot({ capture: runner })`) is captured, it will no longer contain the Runner.
- Node 14 support has been removed and Node 16 support has been deprecated. Node 16 may continue to work with Cypress `v13`, but will not be supported moving forward to closer coincide with [Node 16's end-of-life](https://nodejs.org/en/blog/announcements/nodejs16-eol) schedule. It is recommended that users update to at least Node 18.
- The minimum supported Typescript version is `4.x`.

**Features:**

- Consolidates and improves terminal output when uploading test artifacts to Cypress Cloud. Addressed in [#27402](https://github.com/cypress-io/cypress/pull/27402)

**Bugfixes:**

Expand All @@ -12,6 +29,10 @@ _Released 08/29/2023 (PENDING)_
- Fixed incorrect type declarations for Cypress and Chai globals that asserted them to be local variables of the global scope rather than properties on the global object. Fixes [#27539](https://github.com/cypress-io/cypress/issues/27539). Fixed in [#27540](https://github.com/cypress-io/cypress/pull/27540).
- Dev Servers will now respect and use the `port` configuration option if present. Fixes [#27675](https://github.com/cypress-io/cypress/issues/27675).

**Dependency Updates:**

- Upgraded [`@cypress/request`](https://www.npmjs.com/package/@cypress/request) from `^2.88.11` to `^3.0.0` to address the [CVE-2023-28155](https://github.com/advisories/GHSA-p8p7-x288-28g6) security vulnerability. Addresses [#27535](https://github.com/cypress-io/cypress/issues/27535). Addressed in [#27495](https://github.com/cypress-io/cypress/pull/27495).

## 12.17.4

_Released 08/15/2023_
Expand Down
2 changes: 2 additions & 0 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ exports['shows help for run --foo 1'] = `
-q, --quiet run quietly, using only the configured reporter
--record [bool] records the run. sends test results, screenshots and videos to Cypress Cloud.
-r, --reporter <reporter> runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"
--runner-ui displays the Cypress Runner UI
--no-runner-ui hides the Cypress Runner UI
-o, --reporter-options <reporter-options> options for the mocha reporter. defaults to "null"
-s, --spec <spec> runs specific spec file(s). defaults to "all"
-t, --tag <tag> named tag(s) for recorded runs in Cypress Cloud
Expand Down
4 changes: 4 additions & 0 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ const descriptions = {
record: 'records the run. sends test results, screenshots and videos to Cypress Cloud.',
reporter: 'runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"',
reporterOptions: 'options for the mocha reporter. defaults to "null"',
runnerUi: 'displays the Cypress Runner UI',
noRunnerUi: 'hides the Cypress Runner UI',
spec: 'runs specific spec file(s). defaults to "all"',
tag: 'named tag(s) for recorded runs in Cypress Cloud',
version: 'prints Cypress version',
Expand Down Expand Up @@ -252,6 +254,8 @@ const addCypressRunCommand = (program) => {
.option('-q, --quiet', text('quiet'))
.option('--record [bool]', text('record'), coerceFalse)
.option('-r, --reporter <reporter>', text('reporter'))
.option('--runner-ui', text('runnerUi'))
.option('--no-runner-ui', text('noRunnerUi'))
.option('-o, --reporter-options <reporter-options>', text('reporterOptions'))
.option('-s, --spec <spec>', text('spec'))
.option('-t, --tag <tag>', text('tag'))
Expand Down
4 changes: 4 additions & 0 deletions cli/lib/exec/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ const processRunOptions = (options = {}) => {
args.push('--reporter-options', options.reporterOptions)
}

if (options.runnerUi != null) {
args.push('--runner-ui', options.runnerUi)
}

// if we have specific spec(s) push that into the args
if (options.spec) {
args.push('--spec', options.spec)
Expand Down
1 change: 1 addition & 0 deletions cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ const parseOpts = (opts) => {
'reporter',
'reporterOptions',
'record',
'runnerUi',
'runProject',
'spec',
'tag')
Expand Down
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"unit": "cross-env BLUEBIRD_DEBUG=1 NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json"
},
"dependencies": {
"@cypress/request": "2.88.12",
"@cypress/request": "^3.0.0",
"@cypress/xvfb": "^1.2.4",
"@types/node": "^16.18.39",
"@types/sinonjs__fake-timers": "8.1.1",
Expand Down Expand Up @@ -124,7 +124,7 @@
"cypress": "bin/cypress"
},
"engines": {
"node": "^14.0.0 || ^16.0.0 || >=18.0.0"
"node": "^16.0.0 || ^18.0.0 || >=20.0.0"
},
"types": "types",
"exports": {
Expand Down
13 changes: 8 additions & 5 deletions cli/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const _ = require('lodash')
const path = require('path')
const shell = require('shelljs')
const minimist = require('minimist')

const fs = require('../lib/fs')

Expand All @@ -24,7 +25,7 @@ function getStdout (cmd) {
return shell.exec(cmd).trim()
}

function preparePackageForNpmRelease (json) {
function preparePackageForNpmRelease (json, branchName) {
// modify the existing package.json
// to prepare it for releasing to npm
delete json.devDependencies
Expand All @@ -36,7 +37,7 @@ function preparePackageForNpmRelease (json) {
_.extend(json, {
version,
buildInfo: {
commitBranch: process.env.CIRCLE_BRANCH || getStdout('git branch --show-current'),
commitBranch: branchName || process.env.CIRCLE_BRANCH || getStdout('git branch --show-current'),
commitSha: getStdout('git rev-parse HEAD'),
commitDate: new Date(getStdout('git show -s --format=%ci')).toISOString(),
stable: false,
Expand All @@ -57,9 +58,9 @@ function preparePackageForNpmRelease (json) {
return json
}

function makeUserPackageFile () {
function makeUserPackageFile (branchName) {
return fs.readJsonAsync(packageJsonSrc)
.then(preparePackageForNpmRelease)
.then((json) => preparePackageForNpmRelease(json, branchName))
.then((json) => {
return fs.outputJsonAsync(packageJsonDest, json, {
spaces: 2,
Expand All @@ -71,7 +72,9 @@ function makeUserPackageFile () {
module.exports = makeUserPackageFile

if (!module.parent) {
makeUserPackageFile()
const args = minimist(process.argv)

makeUserPackageFile(args.branch)
.catch((err) => {
/* eslint-disable no-console */
console.error('Could not write user package file')
Expand Down
14 changes: 12 additions & 2 deletions cli/test/lib/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,25 @@ describe('cli', () => {
expect(run.start).to.be.calledWith({ ciBuildId: '123', group: 'staging' })
})

it('call run with --auto-cancel-after-failures', () => {
it('calls run with --auto-cancel-after-failures', () => {
this.exec('run --auto-cancel-after-failures 4')
expect(run.start).to.be.calledWith({ autoCancelAfterFailures: '4' })
})

it('call run with --auto-cancel-after-failures with false', () => {
it('calls run with --auto-cancel-after-failures with false', () => {
this.exec('run --auto-cancel-after-failures false')
expect(run.start).to.be.calledWith({ autoCancelAfterFailures: 'false' })
})

it('calls run with --runner-ui', () => {
this.exec('run --runner-ui')
expect(run.start).to.be.calledWith({ runnerUi: true })
})

it('calls run with --no-runner-ui', () => {
this.exec('run --no-runner-ui')
expect(run.start).to.be.calledWith({ runnerUi: false })
})
})

context('cypress open', () => {
Expand Down
1 change: 1 addition & 0 deletions cli/test/lib/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ describe('cypress', function () {
.then((args) => {
expect(args.spec).to.equal('foo')
expect(args.autoCancelAfterFailures).to.equal(4)
expect(args.runnerUi).to.be.undefined
})
})

Expand Down
9 changes: 9 additions & 0 deletions cli/test/lib/exec/run_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,14 @@ describe('exec run', function () {
])
})
})

it('spawns with --runner-ui', function () {
return run.start({ runnerUi: true })
.then(() => {
expect(spawn.start).to.be.calledWith([
'--run-project', process.cwd(), '--runner-ui', true,
])
})
})
})
})
Loading

0 comments on commit 0a0eebd

Please sign in to comment.