diff --git a/browser-versions.json b/browser-versions.json index 06f558e2447d..f409e32c0081 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,4 +1,4 @@ { - "chrome:beta": "100.0.4896.30", - "chrome:stable": "99.0.4844.74" + "chrome:beta": "101.0.4951.15", + "chrome:stable": "100.0.4896.75" } diff --git a/circle.yml b/circle.yml index d7ff5810d5db..b3cc13ce1715 100644 --- a/circle.yml +++ b/circle.yml @@ -29,7 +29,7 @@ mainBuildFilters: &mainBuildFilters only: - develop - 10.0-release - - fix-beta-build-caching + - unify-1449-beta-slug-length # 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 @@ -38,7 +38,7 @@ macWorkflowFilters: &mac-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ fix-beta-build-caching, << pipeline.git.branch >> ] + - equal: [ unify-1449-beta-slug-length, << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -48,7 +48,7 @@ windowsWorkflowFilters: &windows-workflow-filters or: - equal: [ master, << pipeline.git.branch >> ] - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ fix-beta-build-caching, << pipeline.git.branch >> ] + - equal: [ unify-1449-beta-slug-length, << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -418,9 +418,9 @@ commands: echo Current working directory is $PWD echo Total containers $CIRCLE_NODE_TOTAL - if [[ -v PACKAGES_RECORD_KEY ]]; then + if [[ -v MAIN_RECORD_KEY ]]; then # internal PR - CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ yarn cypress:run --record --parallel --group 5x-driver-<> --browser <> else # external PR @@ -455,7 +455,7 @@ commands: command: | cmd=$([[ <> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true CYPRESS_KONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \ PERCY_ENABLE=${PERCY_TOKEN:-0} \ PERCY_PARALLEL_TOTAL=-1 \ @@ -1302,7 +1302,7 @@ jobs: - run: command: | CYPRESS_KONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \ PERCY_ENABLE=${PERCY_TOKEN:-0} \ PERCY_PARALLEL_TOTAL=-1 \ @@ -1347,7 +1347,7 @@ jobs: - run: command: | CYPRESS_KONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ PERCY_PARALLEL_NONCE=$CIRCLE_SHA1 \ PERCY_ENABLE=${PERCY_TOKEN:-0} \ PERCY_PARALLEL_TOTAL=-1 \ @@ -1371,7 +1371,7 @@ jobs: - run: command: | CYPRESS_KONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ yarn cypress:run --record --parallel --group ui-components working_directory: packages/ui-components - verify-mocha-results @@ -1559,25 +1559,25 @@ jobs: command: yarn workspace @cypress/eslint-plugin-dev test npm-cypress-schematic: - <<: *defaults - steps: - - restore_cached_workspace - - run: - name: Build + Install - command: | - yarn workspace @cypress/schematic build:all - working_directory: npm/cypress-schematic - - run: - name: Launch - command: | - yarn launch:test - working_directory: npm/cypress-schematic - - run: - name: Run unit tests - command: | - yarn test - working_directory: npm/cypress-schematic - - store-npm-logs + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + Install + command: | + yarn workspace @cypress/schematic build:all + working_directory: npm/cypress-schematic + - run: + name: Launch + command: | + yarn launch:test + working_directory: npm/cypress-schematic + - run: + name: Run unit tests + command: | + yarn test + working_directory: npm/cypress-schematic + - store-npm-logs npm-release: <<: *defaults @@ -1604,7 +1604,7 @@ jobs: - run: name: Check current branch to persist artifacts command: | - if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-beta-build-caching" ]]; then + if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "unify-1449-beta-slug-length" ]]; then echo "Not uploading artifacts or posting install comment for this branch." circleci-agent step halt fi @@ -2027,6 +2027,7 @@ linux-workflow: &linux-workflow - build # unit, integration and e2e tests - cli-visual-tests: + context: test-runner:percy requires: - build - unit-tests: @@ -2067,39 +2068,51 @@ linux-workflow: &linux-workflow requires: - system-tests-node-modules-install - driver-integration-tests-chrome: + context: test-runner:cypress-record-key requires: - build - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key requires: - build - driver-integration-tests-firefox: + context: test-runner:cypress-record-key requires: - build - driver-integration-tests-electron: + context: test-runner:cypress-record-key requires: - build - runner-integration-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:percy] requires: - build - runner-integration-tests-firefox: + context: [test-runner:cypress-record-key, test-runner:percy] requires: - build - runner-integration-tests-electron: + context: [test-runner:cypress-record-key, test-runner:percy] requires: - build - runner-ct-integration-tests-chrome: + context: test-runner:percy requires: - build - desktop-gui-integration-tests-7x: + context: [test-runner:cypress-record-key, test-runner:percy] requires: - build - desktop-gui-component-tests: + context: test-runner:percy requires: - build - reporter-integration-tests: + context: [test-runner:cypress-record-key, test-runner:percy] requires: - build - ui-components-integration-tests: + context: test-runner:cypress-record-key requires: - build - npm-webpack-dev-server: @@ -2115,6 +2128,7 @@ linux-workflow: &linux-workflow requires: - build - npm-design-system: + context: test-runner:percy requires: - build - npm-vue: diff --git a/cli/__snapshots__/download_spec.js b/cli/__snapshots__/download_spec.js index 70d42ad8b764..802b8edcfd97 100644 --- a/cli/__snapshots__/download_spec.js +++ b/cli/__snapshots__/download_spec.js @@ -44,3 +44,15 @@ https://download.cypress.io/desktop/0.20.2?platform=OS&arch=ARCH exports['desktop url from template'] = ` https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip ` + +exports['desktop url from template with escaped dollar sign'] = ` +https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip +` + +exports['desktop url from template wrapped in quote'] = ` +https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip +` + +exports['desktop url from template with escaped dollar sign wrapped in quote'] = ` +https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip +` diff --git a/cli/__snapshots__/install_spec.js b/cli/__snapshots__/install_spec.js index c28d2dce7132..c1d2cdce0a7e 100644 --- a/cli/__snapshots__/install_spec.js +++ b/cli/__snapshots__/install_spec.js @@ -264,11 +264,11 @@ exports['/lib/tasks/install .start non-stable builds logs a warning about instal Bugs may be present which do not exist in production builds. This build was created from: - * Commit SHA: abc123 + * Commit SHA: 3b7f0b5c59def1e9b5f385bd585c9b2836706c29 * Commit Branch: aBranchName * Commit Timestamp: 1996-11-27Txx:xx:xx.000Z -Installing Cypress (version: https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-abc123/cypress.zip) +Installing Cypress (version: https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-3b7f0b5c59def1e9b5f385bd585c9b2836706c29/cypress.zip) ⠋ Downloaded Cypress diff --git a/cli/lib/exec/spawn.js b/cli/lib/exec/spawn.js index ee903ed512d1..9d79f88dbde7 100644 --- a/cli/lib/exec/spawn.js +++ b/cli/lib/exec/spawn.js @@ -16,7 +16,21 @@ const isXlibOrLibudevRe = /^(?:Xlib|libudev)/ const isHighSierraWarningRe = /\*\*\* WARNING/ const isRenderWorkerRe = /\.RenderWorker-/ -const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe] +// Chromium (which Electron uses) always makes several attempts to connect to the system dbus. +// This works fine in most desktop environments, but in a docker container, there is no dbus service +// and Chromium emits several error lines, similar to these: + +// [1957:0406/160550.146820:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory +// [1957:0406/160550.147994:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon + +// These warnings are absolutely harmless. Failure to connect to dbus means that electron won't be able to access the user's +// credential wallet (none exists in a docker container) and won't show up in the system tray (again, none exists). +// Failure to connect is expected and normal here, but users frequently misidentify these errors as the cause of their problems. + +// https://github.com/cypress-io/cypress/issues/19299 +const isDbusWarning = /Failed to connect to the bus:/ + +const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning] const isGarbageLineWarning = (str) => { return _.some(GARBAGE_WARNINGS, (re) => { diff --git a/cli/lib/tasks/download.js b/cli/lib/tasks/download.js index 59e586728d23..e57269c7a9a2 100644 --- a/cli/lib/tasks/download.js +++ b/cli/lib/tasks/download.js @@ -64,10 +64,15 @@ const getCA = () => { const prepend = (urlPath) => { const endpoint = url.resolve(getBaseUrl(), urlPath) const platform = os.platform() - const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE') + const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE', true) return pathTemplate - ? pathTemplate.replace('${endpoint}', endpoint).replace('${platform}', platform).replace('${arch}', arch()) + ? ( + pathTemplate + .replace(/\\?\$\{endpoint\}/, endpoint) + .replace(/\\?\$\{platform\}/, platform) + .replace(/\\?\$\{arch\}/, arch()) + ) : `${endpoint}?platform=${platform}&arch=${arch()}` } diff --git a/cli/lib/tasks/state.js b/cli/lib/tasks/state.js index 2f3a46b377d0..6a0f4296c3a1 100644 --- a/cli/lib/tasks/state.js +++ b/cli/lib/tasks/state.js @@ -52,7 +52,7 @@ const getBinaryDir = (version = util.pkgVersion()) => { const getVersionDir = (version = util.pkgVersion(), buildInfo = util.pkgBuildInfo()) => { if (buildInfo && !buildInfo.stable) { - version = ['beta', version, buildInfo.commitBranch, buildInfo.commitSha].join('-') + version = ['beta', version, buildInfo.commitBranch, buildInfo.commitSha.slice(0, 8)].join('-') } return path.join(getCacheDir(), version) diff --git a/cli/package.json b/cli/package.json index b068831e4755..b1076a7cb1c1 100644 --- a/cli/package.json +++ b/cli/package.json @@ -51,7 +51,7 @@ "listr2": "^3.8.3", "lodash": "^4.17.21", "log-symbols": "^4.0.0", - "minimist": "^1.2.5", + "minimist": "^1.2.6", "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", "proxy-from-env": "1.0.0", diff --git a/cli/test/lib/exec/spawn_spec.js b/cli/test/lib/exec/spawn_spec.js index fe58325145c4..425123e32968 100644 --- a/cli/test/lib/exec/spawn_spec.js +++ b/cli/test/lib/exec/spawn_spec.js @@ -65,6 +65,9 @@ describe('lib/exec/spawn', function () { [46454:0702/140217.292555:ERROR:gles2_cmd_decoder.cc(4439)] [.RenderWorker-0x7f8bc5815a00.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete [46454:0702/140217.292584:ERROR:gles2_cmd_decoder.cc(4439)] [.RenderWorker-0x7f8bc5815a00.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glClear: framebuffer incomplete [46454:0702/140217.292612:ERROR:gles2_cmd_decoder.cc(4439)] [.RenderWorker-0x7f8bc5815a00.GpuRasterization]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete' + + [1957:0406/160550.146820:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory + [1957:0406/160550.147994:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon ` const lines = _ diff --git a/cli/test/lib/tasks/download_spec.js b/cli/test/lib/tasks/download_spec.js index bb209991b018..a92cbd094e23 100644 --- a/cli/test/lib/tasks/download_spec.js +++ b/cli/test/lib/tasks/download_spec.js @@ -72,6 +72,27 @@ describe('lib/tasks/download', function () { snapshot('desktop url from template', normalize(url)) }) + it('returns custom url from template with escaped dollar sign', () => { + process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = '\\${endpoint}/\\${platform}-\\${arch}/cypress.zip' + const url = download.getUrl('0.20.2') + + snapshot('desktop url from template with escaped dollar sign', normalize(url)) + }) + + it('returns custom url from template wrapped in quote', () => { + process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = '"${endpoint}/${platform}-${arch}/cypress.zip"' + const url = download.getUrl('0.20.2') + + snapshot('desktop url from template wrapped in quote', normalize(url)) + }) + + it('returns custom url from template with escaped dollar sign wrapped in quote', () => { + process.env.CYPRESS_DOWNLOAD_PATH_TEMPLATE = '"\\${endpoint}/\\${platform}-\\${arch}/cypress.zip"' + const url = download.getUrl('0.20.2') + + snapshot('desktop url from template with escaped dollar sign wrapped in quote', normalize(url)) + }) + it('returns input if it is already an https link', () => { const url = 'https://somewhere.com' const result = download.getUrl(url) diff --git a/cli/test/lib/tasks/install_spec.js b/cli/test/lib/tasks/install_spec.js index f1966fe1897f..d33726c45cb2 100644 --- a/cli/test/lib/tasks/install_spec.js +++ b/cli/test/lib/tasks/install_spec.js @@ -74,22 +74,22 @@ describe('/lib/tasks/install', function () { }) describe('non-stable builds', () => { + const buildInfo = { + stable: false, + commitSha: '3b7f0b5c59def1e9b5f385bd585c9b2836706c29', + commitBranch: 'aBranchName', + commitDate: new Date('11-27-1996').toISOString(), + } + function runInstall () { - return install.start({ - buildInfo: { - stable: false, - commitSha: 'abc123', - commitBranch: 'aBranchName', - commitDate: new Date('11-27-1996').toISOString(), - }, - }) + return install.start({ buildInfo }) } it('install from a constructed CDN URL', async function () { await runInstall() expect(download.start).to.be.calledWithMatch({ - version: 'https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-abc123/cypress.zip', + version: 'https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-3b7f0b5c59def1e9b5f385bd585c9b2836706c29/cypress.zip', }) }) @@ -97,6 +97,12 @@ describe('/lib/tasks/install', function () { await runInstall() snapshot(normalize(this.stdout.toString())) }) + + it('installs to the expected pre-release cache dir', async function () { + state.getVersionDir.restore() + await runInstall() + expect(unzip.start).to.be.calledWithMatch({ installDir: sinon.match(/\/Cypress\/beta\-1\.2\.3\-aBranchName\-3b7f0b5c$/) }) + }) }) describe('override version', function () { diff --git a/cli/types/cypress-eventemitter.d.ts b/cli/types/cypress-eventemitter.d.ts index 6f0347f3b32b..3e6e39800fa1 100644 --- a/cli/types/cypress-eventemitter.d.ts +++ b/cli/types/cypress-eventemitter.d.ts @@ -30,4 +30,4 @@ interface NodeEventEmitter { // We use the Buffer class for dealing with binary data, especially around the // selectFile interface. -type BufferType = import("buffer/").Buffer +type BufferType = typeof import("buffer/").Buffer diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 3e2244320eda..0cca2c56e5eb 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -2341,7 +2341,7 @@ declare namespace Cypress { type Agent = SinonSpyAgent & T interface CookieDefaults { - preserve: string | string[] | RegExp | ((cookie: any) => boolean) + preserve: string | string[] | RegExp | ((cookie: Cookie) => boolean) } interface Failable { @@ -5712,6 +5712,7 @@ declare namespace Cypress { name: string /** Override *name* for display purposes only */ displayName: string + /** additional information to include in the log */ message: any /** Set to false if you want to control the finishing of the command in the log yourself */ autoEnd: boolean diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index 3ddfc03f9a6f..5f5085ae8b1c 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -173,6 +173,12 @@ namespace BlobTests { }) } +namespace BufferTests { + const buffer = Cypress.Buffer.from('sometext') + Cypress.Buffer.isBuffer(buffer) + buffer.length +} + cy.window().then(window => { window // $ExpectType AUTWindow diff --git a/guides/release-process.md b/guides/release-process.md index 5c46e8a7c830..69baa03ad4e1 100644 --- a/guides/release-process.md +++ b/guides/release-process.md @@ -76,7 +76,7 @@ In the following instructions, "X.Y.Z" is used to denote the [next version of Cy 5. Once the `develop` branch is passing for all test projects with the new changes and the `linux-x64` binary is present at `https://cdn.cypress.io/beta/binary/X.Y.Z/linux-x64//cypress.zip`, and the `linux-x64` cypress npm package is present at `https://cdn.cypress.io/beta/binary/X.Y.Z/linux-x64//cypress.tgz`, publishing can proceed. -6. Log into AWS SSO with `aws sso login --profile `. The release scripts assumes you are using the `production` profile. If you have setup your credentials under a different profile, be sure to set the `AWS_PROFILE` environment variable. +6. [Set up](https://cypress-io.atlassian.net/wiki/spaces/INFRA/pages/1534853121/AWS+SSO+Cypress) an AWS SSO profile with the [Team-CypressApp-Prod](https://cypress-io.atlassian.net/wiki/spaces/INFRA/pages/1534853121/AWS+SSO+Cypress#Team-CypressApp-Prod) role. The release scripts assumes the name of your profile is `production`. If you have setup your credentials under a different profile, be sure to set the `AWS_PROFILE` environment variable. Log into AWS SSO with `aws sso login --profile `. 7. Use the `prepare-release-artifacts` script (Mac/Linux only) to prepare the latest commit to a stable release. When you run this script, the following happens: * the binaries for `` are moved from `beta` to the `desktop` folder for `` in S3 diff --git a/npm/webpack-dev-server/CHANGELOG.md b/npm/webpack-dev-server/CHANGELOG.md index 613f85c1f45a..121071e9e721 100644 --- a/npm/webpack-dev-server/CHANGELOG.md +++ b/npm/webpack-dev-server/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/webpack-dev-server-v1.8.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.2...@cypress/webpack-dev-server-v1.8.3) (2022-03-15) + + +### Bug Fixes + +* **webpack-dev-server:** do not encodeUri in loader ([#20575](https://github.com/cypress-io/cypress/issues/20575)) ([1b152fc](https://github.com/cypress-io/cypress/commit/1b152fca1b9ed9894cf7a5b2a964c856f73fc685)), closes [#20593](https://github.com/cypress-io/cypress/issues/20593) + # [@cypress/webpack-dev-server-v1.8.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.1...@cypress/webpack-dev-server-v1.8.2) (2022-03-03) diff --git a/npm/webpack-dev-server/src/loader.ts b/npm/webpack-dev-server/src/loader.ts index 13bc936fe408..44522c193f02 100644 --- a/npm/webpack-dev-server/src/loader.ts +++ b/npm/webpack-dev-server/src/loader.ts @@ -18,7 +18,7 @@ const makeImport = (file: Cypress.Cypress['spec'], filename: string, chunkName: const magicComments = chunkName ? `/* webpackChunkName: "${chunkName}" */` : '' return `"${filename}": { - shouldLoad: () => document.location.pathname.includes("${encodeURI(file.absolute)}"), + shouldLoad: () => decodeURI(document.location.pathname).includes("${file.absolute}"), load: () => import("${file.absolute}" ${magicComments}), chunkName: "${chunkName}", }` diff --git a/npm/webpack-dev-server/test/e2e.spec.ts b/npm/webpack-dev-server/test/e2e.spec.ts index f340b627dbc6..022aebe9e100 100644 --- a/npm/webpack-dev-server/test/e2e.spec.ts +++ b/npm/webpack-dev-server/test/e2e.spec.ts @@ -8,12 +8,12 @@ import { webpackDevServerFacts } from '../src/webpackDevServerFacts' import { defineDevServerConfig, devServer, startDevServer } from '../' -const requestSpecFile = (port: number) => { +const requestSpecFile = (file: string, port: number) => { return new Promise((res) => { const opts = { host: 'localhost', port, - path: '/test/fixtures/foo.spec.js', + path: encodeURI(file), } const callback = (response: EventEmitter) => { @@ -41,13 +41,15 @@ const webpackConfig = { } -const specs: Cypress.Cypress['spec'][] = [ - { - name: `${root}/test/fixtures/foo.spec.js`, - relative: `${root}/test/fixtures/foo.spec.js`, - absolute: `${root}/test/fixtures/foo.spec.js`, - }, -] +const createSpecs = (name: string): Cypress.Cypress['spec'][] => { + return [ + { + name: `${root}/test/fixtures/${name}`, + relative: `${root}/test/fixtures/${name}`, + absolute: `${root}/test/fixtures/${name}`, + }, + ] +} const config = { projectRoot: root, @@ -62,12 +64,12 @@ describe('#startDevServer', () => { webpackConfig, options: { config, - specs, + specs: createSpecs('foo.spec.js'), devServerEvents: new EventEmitter(), }, }) - const response = await requestSpecFile(port as number) + const response = await requestSpecFile('/test/fixtures/foo.spec.js', port as number) expect(response).to.eq('const foo = () => {}\n') @@ -76,13 +78,89 @@ describe('#startDevServer', () => { }) }) + it('serves specs in directory with [] chars via a webpack dev server', async () => { + const { port, close } = await startDevServer({ + webpackConfig, + options: { + config, + specs: createSpecs('[foo]/bar.spec.js'), + devServerEvents: new EventEmitter(), + }, + }) + + const response = await requestSpecFile('/test/fixtures/[foo]/bar.spec.js', port as number) + + expect(response).to.eq(`it('this is a spec with a path containing []', () => {})\n`) + + return new Promise((res) => { + close(() => res()) + }) + }) + + it('serves specs in directory with non English chars via a webpack dev server', async () => { + const { port, close } = await startDevServer({ + webpackConfig, + options: { + config, + specs: createSpecs('サイプレス.spec.js'), + devServerEvents: new EventEmitter(), + }, + }) + + const response = await requestSpecFile('/test/fixtures/サイプレス.spec.js', port as number) + + expect(response).to.eq(`it('サイプレス', () => {})\n`) + + return new Promise((res) => { + close(() => res()) + }) + }) + + it('serves specs in directory with ... in the file name via a webpack dev server', async () => { + const { port, close } = await startDevServer({ + webpackConfig, + options: { + config, + specs: createSpecs('[...bar].spec.js'), + devServerEvents: new EventEmitter(), + }, + }) + + const response = await requestSpecFile('/test/fixtures/[...bar].spec.js', port as number) + + expect(response).to.eq(`it('...bar', () => {})\n`) + + return new Promise((res) => { + close(() => res()) + }) + }) + + it('serves a file with spaces via a webpack dev server', async () => { + const { port, close } = await startDevServer({ + webpackConfig, + options: { + config, + specs: createSpecs('foo bar.spec.js'), + devServerEvents: new EventEmitter(), + }, + }) + + const response = await requestSpecFile('/test/fixtures/foo bar.spec.js', port as number) + + expect(response).to.eq(`it('this is a spec with a path containing a space', () => {})\n`) + + return new Promise((res) => { + close(() => res()) + }) + }) + it('emits dev-server:compile:success event on successful compilation', async () => { const devServerEvents = new EventEmitter() const { close } = await startDevServer({ webpackConfig, options: { config, - specs, + specs: createSpecs('foo.spec.js'), devServerEvents, }, }) @@ -137,7 +215,7 @@ describe('#startDevServer', () => { webpackConfig, options: { config, - specs, + specs: createSpecs('foo.spec.js'), devServerEvents, }, }) @@ -172,13 +250,13 @@ describe('#startDevServer', () => { const { port, close } = await devServer( { config, - specs, + specs: createSpecs('foo.spec.js'), devServerEvents, }, defineDevServerConfig({ webpackConfig }), ) - const response = await requestSpecFile(port as number) + const response = await requestSpecFile('/test/fixtures/foo.spec.js', port as number) expect(response).to.eq('const foo = () => {}\n') diff --git a/npm/webpack-dev-server/test/fixtures/[...bar].spec.js b/npm/webpack-dev-server/test/fixtures/[...bar].spec.js new file mode 100644 index 000000000000..98ab9d25997b --- /dev/null +++ b/npm/webpack-dev-server/test/fixtures/[...bar].spec.js @@ -0,0 +1 @@ +it('...bar', () => {}) diff --git a/npm/webpack-dev-server/test/fixtures/[foo]/bar.spec.js b/npm/webpack-dev-server/test/fixtures/[foo]/bar.spec.js new file mode 100644 index 000000000000..9452a9e54d83 --- /dev/null +++ b/npm/webpack-dev-server/test/fixtures/[foo]/bar.spec.js @@ -0,0 +1 @@ +it('this is a spec with a path containing []', () => {}) diff --git a/npm/webpack-dev-server/test/fixtures/foo bar.spec.js b/npm/webpack-dev-server/test/fixtures/foo bar.spec.js new file mode 100644 index 000000000000..b8f90272ec05 --- /dev/null +++ b/npm/webpack-dev-server/test/fixtures/foo bar.spec.js @@ -0,0 +1 @@ +it('this is a spec with a path containing a space', () => {}) diff --git "a/npm/webpack-dev-server/test/fixtures/\343\202\265\343\202\244\343\203\227\343\203\254\343\202\271.spec.js" "b/npm/webpack-dev-server/test/fixtures/\343\202\265\343\202\244\343\203\227\343\203\254\343\202\271.spec.js" new file mode 100644 index 000000000000..2640ee738a46 --- /dev/null +++ "b/npm/webpack-dev-server/test/fixtures/\343\202\265\343\202\244\343\203\227\343\203\254\343\202\271.spec.js" @@ -0,0 +1 @@ +it('サイプレス', () => {}) diff --git a/package.json b/package.json index 14a39828313b..3c0e2588b556 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress", - "version": "9.5.2", + "version": "9.5.3", "description": "Cypress.io end to end testing tool", "private": true, "scripts": { @@ -156,14 +156,14 @@ "lint-staged": "11.1.2", "listr2": "3.8.3", "lodash": "^4.17.21", - "minimist": "1.2.5", + "minimist": "1.2.6", "mocha": "3.5.3", "mocha-banner": "1.1.2", "mocha-junit-reporter": "2.0.0", "mocha-multi-reporters": "1.1.7", "mock-fs": "5.1.1", "patch-package": "6.4.7", - "plist": "3.0.4", + "plist": "3.0.5", "pluralize": "8.0.0", "postinstall-postinstall": "2.0.0", "prefixed-list": "1.0.1", diff --git a/packages/driver/cypress/integration/commands/querying/root_spec.js b/packages/driver/cypress/integration/commands/querying/root_spec.js index e01b4ea30f59..194afca72a8b 100644 --- a/packages/driver/cypress/integration/commands/querying/root_spec.js +++ b/packages/driver/cypress/integration/commands/querying/root_spec.js @@ -35,6 +35,16 @@ describe('src/cy/commands/querying', () => { cy.root().should('have.class', 'foo').and('have.class', 'bar') }) + // https://github.com/cypress-io/cypress/issues/19985 + it('respects timeout option', (done) => { + cy.on('fail', (err) => { + expect(err.message).to.not.contain('4000ms') + done() + }) + + cy.root({ timeout: 50 }).should('contain', 'root world') + }) + describe('.log', () => { beforeEach(function () { this.logs = [] diff --git a/packages/driver/package.json b/packages/driver/package.json index e5337a8eb629..59ba9b392c07 100644 --- a/packages/driver/package.json +++ b/packages/driver/package.json @@ -64,7 +64,7 @@ "methods": "1.1.2", "mime-types": "2.1.27", "minimatch": "3.0.4", - "minimist": "1.2.5", + "minimist": "1.2.6", "mocha": "7.0.1", "morgan": "1.9.1", "multer": "1.4.2", diff --git a/packages/driver/src/cy/commands/actions/type.ts b/packages/driver/src/cy/commands/actions/type.ts index 08e8e413c89b..a00836000ef6 100644 --- a/packages/driver/src/cy/commands/actions/type.ts +++ b/packages/driver/src/cy/commands/actions/type.ts @@ -274,6 +274,7 @@ export default function (Commands, Cypress, cy, state, config) { const isContentEditable = $elements.isContentEditable(options.$el.get(0)) const isTextarea = $elements.isTextarea(options.$el.get(0)) + const isFirefoxBefore98 = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() < 98 const fireClickEvent = (el) => { const ctor = $dom.getDocumentFromElement(el).defaultView!.PointerEvent @@ -334,9 +335,16 @@ export default function (Commands, Cypress, cy, state, config) { } if ( - // Firefox sends a click event when the Space key is pressed. - // We don't want to send it twice. - !Cypress.isBrowser('firefox') && + ( + // Before Firefox 98, + // Firefox sends a click event when the Space key is pressed. + // We don't want to send it twice. + !Cypress.isBrowser('firefox') || + // After Firefox 98, + // it sends a click event automatically if the element is a