diff --git a/.circleci/src/pipeline/@pipeline.yml b/.circleci/src/pipeline/@pipeline.yml index 24e4cc47c94..40d757017c9 100644 --- a/.circleci/src/pipeline/@pipeline.yml +++ b/.circleci/src/pipeline/@pipeline.yml @@ -1494,9 +1494,6 @@ jobs: resource_class: type: string default: large - is_contributor_pr: - type: boolean - default: false resource_class: << parameters.resource_class >> steps: - restore_cached_workspace @@ -1515,8 +1512,9 @@ jobs: command: yarn list --depth=0 || true - run: name: Check env canaries - command: node ./scripts/circle-env.js --check-canaries --is-contributor-pr << - parameters.is_contributor_pr >> + command: | + IS_CONTRIBUTOR_PR=$([[ "<< pipeline.git.branch >>" =~ ^pull/[0-9]+$ ]] && echo "true" || echo "false") + node ./scripts/circle-env.js --check-canaries --is-contributor-pr $IS_CONTRIBUTOR_PR - build-and-persist lint: diff --git a/.circleci/src/pipeline/workflows/@main.yml b/.circleci/src/pipeline/workflows/@main.yml index e12f2d19d8e..62a6c3109d9 100644 --- a/.circleci/src/pipeline/workflows/@main.yml +++ b/.circleci/src/pipeline/workflows/@main.yml @@ -1,4 +1,3 @@ - linux-x64: when: &full-workflow-filters or: @@ -428,386 +427,6 @@ linux-x64: - get-published-artifacts - system-tests-node-modules-install -linux-x64-contributor: - when: - matches: - pattern: /^pull\/[0-9]+/ - value: << pipeline.git.branch >> - jobs: - - node_modules_install - - build: - is_contributor_pr: true - requires: - - node_modules_install - # In subsequent jobs, we use some contexts that are restricted to members of the Cypress organization. - # This job will allow for a Cypress member to approve and run the rest of the restricted jobs in the pipeline after the contributor code has been reviewed. - - contributor-pr: - type: approval - requires: - - build - # verify-accessibility-results is required for status checks, however, it will be skipped for contributors so it - # can run in any order - - verify-accessibility-results - - check-ts: - requires: - - build - - lint: - name: linux-lint - requires: - - build - - percy-finalize: - context: test-runner:percy - required_env_var: PERCY_TOKEN # skips job if not defined (external PR) - requires: - - cli-visual-tests - - reporter-integration-tests - - run-app-component-tests-chrome - - run-app-integration-tests-chrome - - run-frontend-shared-component-tests-chrome - - run-launchpad-component-tests-chrome - - run-launchpad-integration-tests-chrome - - run-reporter-component-tests-chrome - - run-webpack-dev-server-integration-tests - - run-vite-dev-server-integration-tests - - lint-types: - requires: - - build - # unit, integration and e2e tests - - cli-visual-tests: - context: test-runner:percy - requires: - - contributor-pr - - unit-tests: - requires: - - build - - verify-release-readiness: - context: test-runner:npm-release - requires: - - contributor-pr - - server-unit-tests: - requires: - - build - - server-integration-tests: - requires: - - build - - server-performance-tests: - requires: - - build - - system-tests-node-modules-install: - context: test-runner:performance-tracking - requires: - - contributor-pr - - system-tests-chrome: - context: test-runner:performance-tracking - requires: - - system-tests-node-modules-install - - system-tests-electron: - context: test-runner:performance-tracking - requires: - - system-tests-node-modules-install - - system-tests-firefox: - context: test-runner:performance-tracking - requires: - - system-tests-node-modules-install - - system-tests-webkit: - context: test-runner:performance-tracking - requires: - - system-tests-node-modules-install - - system-tests-non-root: - context: test-runner:performance-tracking - executor: non-root-docker-user - requires: - - system-tests-node-modules-install - - driver-integration-tests-chrome: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-chrome-inject-document-domain: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-chrome-beta: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-chrome-beta-inject-document-domain: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-firefox: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-electron: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-webkit: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-memory-tests: - requires: - - build - - run-frontend-shared-component-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-launchpad-integration-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-launchpad-component-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-app-integration-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-webpack-dev-server-integration-tests: - context: [ test-runner:cypress-record-key, test-runner:percy ] - requires: - - system-tests-node-modules-install - - run-vite-dev-server-integration-tests: - context: [ test-runner:cypress-record-key, test-runner:percy ] - requires: - - system-tests-node-modules-install - - run-app-component-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-reporter-component-tests-chrome: - context: [ test-runner:cypress-record-key, test-runner:percy ] - percy: true - requires: - - contributor-pr - - reporter-integration-tests: - context: [ test-runner:cypress-record-key, test-runner:percy ] - requires: - - contributor-pr - - npm-webpack-dev-server: - requires: - - system-tests-node-modules-install - - npm-vite-dev-server: - requires: - - build - - npm-vite-plugin-cypress-esm: - requires: - - build - - npm-webpack-preprocessor: - requires: - - build - - npm-webpack-batteries-included-preprocessor: - requires: - - build - - npm-vue: - requires: - - build - - npm-puppeteer-unit-tests: - requires: - - build - - npm-puppeteer-cypress-tests: - requires: - - build - - npm-react: - requires: - - build - - npm-angular: - requires: - - build - - npm-mount-utils: - requires: - - build - - npm-grep: - requires: - - build - - npm-eslint-plugin-dev: - requires: - - build - - npm-cypress-schematic: - requires: - - build - - v8-integration-tests: - requires: - - system-tests-node-modules-install - - - ready-to-release: - requires: - - check-ts - - npm-angular - - npm-eslint-plugin-dev - - npm-puppeteer-unit-tests - - npm-puppeteer-cypress-tests - - npm-react - - npm-mount-utils - - npm-grep - - npm-vue - - npm-webpack-batteries-included-preprocessor - - npm-webpack-preprocessor - - npm-vite-dev-server - - npm-vite-plugin-cypress-esm - - npm-webpack-dev-server - - npm-cypress-schematic - - lint-types - - linux-lint - - percy-finalize - - driver-integration-tests-firefox - - driver-integration-tests-chrome - - driver-integration-tests-chrome-beta - - driver-integration-tests-electron - - driver-integration-tests-webkit - - driver-integration-memory-tests - - system-tests-non-root - - system-tests-firefox - - system-tests-electron - - system-tests-chrome - - system-tests-webkit - - server-performance-tests - - server-integration-tests - - server-unit-tests - - "test binary as a non-root user" - - "test binary as a root user" - - test-types-cypress-and-jest - - test-full-typescript-project - - test-binary-against-kitchensink - - test-npm-module-on-minimum-node-version - - binary-system-tests - - test-kitchensink - - unit-tests - - verify-release-readiness - - v8-integration-tests - - - npm-release: - context: test-runner:npm-release - requires: - - ready-to-release - - - create-and-trigger-packaging-artifacts: - context: [ test-runner:upload, test-runner:build-binary, publish-binary ] - requires: - - contributor-pr - - get-published-artifacts: - context: [ publish-binary, test-runner:commit-status-checks ] - requires: - - create-and-trigger-packaging-artifacts - # various testing scenarios, like building full binary - # and testing it on a real project - - test-against-staging: - context: test-runner:record-tests - filters: *mainBuildFilters - requires: - - build - - test-kitchensink: - requires: - - build - - test-kitchensink-against-staging: - executor: kitchensink-executor - context: test-runner:record-tests - filters: *mainBuildFilters - requires: - - build - - test-npm-module-on-minimum-node-version: - context: publish-binary - requires: - - get-published-artifacts - - test-types-cypress-and-jest: - context: publish-binary - requires: - - get-published-artifacts - - test-full-typescript-project: - context: publish-binary - requires: - - get-published-artifacts - - test-binary-against-kitchensink: - context: publish-binary - requires: - - get-published-artifacts - - test-npm-module-and-verify-binary: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-staging: - context: test-runner:record-tests - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-kitchensink-chrome: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-recipes-firefox: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-recipes-chrome: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-recipes: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-kitchensink-firefox: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-todomvc-firefox: - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-against-cypress-realworld-app: - context: test-runner:cypress-record-key - filters: *mainBuildFilters - requires: - - get-published-artifacts - - test-binary-as-specific-user: - name: "test binary as a non-root user" - executor: non-root-docker-user - context: publish-binary - requires: - - get-published-artifacts - - test-binary-as-specific-user: - name: "test binary as a root user" - context: publish-binary - requires: - - get-published-artifacts - - binary-system-tests: - context: publish-binary - requires: - - get-published-artifacts - - system-tests-node-modules-install - linux-arm64: when: *full-workflow-filters jobs: diff --git a/.circleci/src/pipeline/workflows/pull-request.yml b/.circleci/src/pipeline/workflows/pull-request.yml index 2d69cb42f10..3bb6500f4ae 100644 --- a/.circleci/src/pipeline/workflows/pull-request.yml +++ b/.circleci/src/pipeline/workflows/pull-request.yml @@ -1,4 +1,6 @@ - +# The workflow runs for: +# External PR after approval (approved contributor PR that's not a main branch) +# Internal PR for any branch that does is not develop or release/ related when: and: - not: @@ -9,87 +11,84 @@ when: matches: pattern: /^develop/ value: << pipeline.git.branch >> - - not: - matches: - pattern: /^pull\/[0-9]+/ - value: << pipeline.git.branch >> jobs: - node_modules_install: build-better-sqlite3: true - build: + name: internal-pr-build context: test-runner:env-canary requires: - node_modules_install + filters: + branches: + ignore: /^pull\/[0-9]+/ + - build: + name: external-pr-build + requires: + - node_modules_install + filters: + branches: + only: /^pull\/[0-9]+/ - check-ts: requires: - - build + - internal-pr-build + - external-pr-build - lint: name: linux-lint requires: - - build - - percy-finalize: - context: test-runner:percy - required_env_var: PERCY_TOKEN - requires: - - cli-visual-tests - - reporter-integration-tests - - run-app-component-tests-chrome - - run-app-integration-tests-chrome - - run-frontend-shared-component-tests-chrome - - run-launchpad-component-tests-chrome - - run-launchpad-integration-tests-chrome - - run-reporter-component-tests-chrome - - run-webpack-dev-server-integration-tests - - run-vite-dev-server-integration-tests - # Cypress run must be completed to fetch Accessibility report - - verify-accessibility-results: - context: test-runner:cypress-record-key - requires: - - reporter-integration-tests - - run-app-component-tests-chrome - - run-app-integration-tests-chrome - - run-frontend-shared-component-tests-chrome - - run-launchpad-component-tests-chrome - - run-launchpad-integration-tests-chrome - - run-reporter-component-tests-chrome - - run-webpack-dev-server-integration-tests - - run-vite-dev-server-integration-tests - - driver-integration-tests-firefox - - driver-integration-tests-chrome - - driver-integration-tests-chrome-inject-document-domain - - driver-integration-tests-chrome-beta-inject-document-domain - - driver-integration-tests-electron - - driver-integration-tests-webkit - - driver-integration-memory-tests + - internal-pr-build + - external-pr-build - lint-types: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr: + type: approval + filters: + branches: + only: /^pull\/[0-9]+/ + + # The following jobs are only run for contributor PRs once they are approved # unit, integration and e2e tests - cli-visual-tests: context: test-runner:percy requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - unit-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - verify-release-readiness: context: test-runner:npm-release requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - server-unit-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - server-integration-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - server-performance-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - system-tests-node-modules-install: context: test-runner:performance-tracking requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - system-tests-chrome: context: test-runner:performance-tracking requires: @@ -114,34 +113,50 @@ jobs: - driver-integration-tests-chrome: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-chrome-inject-document-domain: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-chrome-beta: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-chrome-beta-inject-document-domain: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-firefox: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-electron: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-tests-webkit: context: test-runner:cypress-record-key requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - driver-integration-memory-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-frontend-shared-component-tests-chrome: context: [ @@ -151,7 +166,9 @@ jobs: ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-launchpad-integration-tests-chrome: context: [ @@ -161,7 +178,9 @@ jobs: ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-launchpad-component-tests-chrome: context: [ @@ -171,7 +190,9 @@ jobs: ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-app-integration-tests-chrome: context: [ @@ -181,7 +202,9 @@ jobs: ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-webpack-dev-server-integration-tests: context: [ test-runner:cypress-record-key, test-runner:percy ] requires: @@ -199,58 +222,90 @@ jobs: ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - run-reporter-component-tests-chrome: context: [ test-runner:cypress-record-key, test-runner:percy ] percy: true requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - reporter-integration-tests: context: [ test-runner:cypress-record-key, test-runner:percy ] requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-webpack-dev-server: requires: - system-tests-node-modules-install - npm-vite-dev-server: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-vite-plugin-cypress-esm: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-webpack-preprocessor: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-webpack-batteries-included-preprocessor: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-vue: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-puppeteer-unit-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-puppeteer-cypress-tests: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-react: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-angular: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-mount-utils: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-grep: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-eslint-plugin-dev: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - npm-cypress-schematic: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - v8-integration-tests: requires: - system-tests-node-modules-install @@ -262,6 +317,7 @@ jobs: - publish-binary requires: - node_modules_install + - approve-contributor-pr - wait-for-binary-publish: type: approval requires: @@ -274,7 +330,9 @@ jobs: - wait-for-binary-publish - test-kitchensink: requires: - - build + - internal-pr-build + - external-pr-build + - approve-contributor-pr - test-npm-module-on-minimum-node-version: context: publish-binary requires: @@ -317,3 +375,39 @@ jobs: requires: - get-published-artifacts - system-tests-node-modules-install + + # Finalization jobs + - percy-finalize: + context: test-runner:percy + required_env_var: PERCY_TOKEN + requires: + - cli-visual-tests + - reporter-integration-tests + - run-app-component-tests-chrome + - run-app-integration-tests-chrome + - run-frontend-shared-component-tests-chrome + - run-launchpad-component-tests-chrome + - run-launchpad-integration-tests-chrome + - run-reporter-component-tests-chrome + - run-webpack-dev-server-integration-tests + - run-vite-dev-server-integration-tests + # Cypress run must be completed to fetch Accessibility report + - verify-accessibility-results: + context: test-runner:cypress-record-key + requires: + - reporter-integration-tests + - run-app-component-tests-chrome + - run-app-integration-tests-chrome + - run-frontend-shared-component-tests-chrome + - run-launchpad-component-tests-chrome + - run-launchpad-integration-tests-chrome + - run-reporter-component-tests-chrome + - run-webpack-dev-server-integration-tests + - run-vite-dev-server-integration-tests + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests \ No newline at end of file diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 15f4fa668f9..3792a7d5424 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /// /// /// @@ -684,22 +683,22 @@ declare namespace Cypress { Keyboard: { defaults(options: Partial): void Keys: { - DOWN: 'ArrowDown', - LEFT: 'ArrowLeft', - RIGHT: 'ArrowRight', - UP: 'ArrowUp', - END: 'End', - HOME: 'Home', - PAGEDOWN: 'PageDown', - PAGEUP: 'PageUp', - ENTER: 'Enter', - TAB: 'Tab', - BACKSPACE: 'Backspace', - SPACE: 'Space', - DELETE: 'Delete', - INSERT: 'Insert', - ESC: 'Escape', - }, + DOWN: 'ArrowDown' + LEFT: 'ArrowLeft' + RIGHT: 'ArrowRight' + UP: 'ArrowUp' + END: 'End' + HOME: 'Home' + PAGEDOWN: 'PageDown' + PAGEUP: 'PageUp' + ENTER: 'Enter' + TAB: 'Tab' + BACKSPACE: 'Backspace' + SPACE: 'Space' + DELETE: 'Delete' + INSERT: 'Insert' + ESC: 'Escape' + } } /** @@ -755,7 +754,7 @@ declare namespace Cypress { * Trigger action * @private */ - action: (action: string, ...args: any[]) => T + action: (action: string, ...args: any[]) => T /** * Load files @@ -2898,8 +2897,8 @@ declare namespace Cypress { } type RetryStrategyWithModeSpecs = RetryStrategy & { - openMode: boolean; // defaults to false - runMode: boolean; // defaults to true + openMode: boolean // defaults to false + runMode: boolean // defaults to true } type RetryStrategy = @@ -2907,18 +2906,18 @@ declare namespace Cypress { | RetryStrategyDetectFlakeButAlwaysFailType interface RetryStrategyDetectFlakeAndPassOnThresholdType { - experimentalStrategy: "detect-flake-and-pass-on-threshold" + experimentalStrategy: 'detect-flake-and-pass-on-threshold' experimentalOptions?: { - maxRetries: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 - passesRequired: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 and <= maxRetries + maxRetries: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 + passesRequired: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 and <= maxRetries } } interface RetryStrategyDetectFlakeButAlwaysFailType { - experimentalStrategy: "detect-flake-but-always-fail" + experimentalStrategy: 'detect-flake-but-always-fail' experimentalOptions?: { - maxRetries: number; // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 - stopIfAnyPassed: boolean; // defaults to false if experimentalOptions is not provided + maxRetries: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 + stopIfAnyPassed: boolean // defaults to false if experimentalOptions is not provided } } interface ResolvedConfigOptions { @@ -3140,7 +3139,7 @@ declare namespace Cypress { * @see https://on.cypress.io/experiments#Experimental-CSP-Allow-List * @default false */ - experimentalCspAllowList: boolean | experimentalCspAllowedDirectives[], + experimentalCspAllowList: boolean | experimentalCspAllowedDirectives[] /** * Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode. * @default false