diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index b6314715ebae..b7a808d21bf9 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -62,6 +62,9 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters linuxWorkflowExcludeFilters: &linux-x64-workflow-exclude-filters unless: or: + - matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> - false # windows is slow and expensive in CI, so it normally only runs on main branches @@ -156,6 +159,16 @@ commands: circleci-agent step halt fi + maybe_skip_binary_jobs: + steps: + - run: + name: Skip binary job if external PR + command: | + if [[ -z "$CIRCLE_TOKEN" ]]; then + echo "There is no CIRCLE_TOKEN set for this job. Cannot trigger binary build. Skipping job." + circleci-agent step halt + fi + restore_workspace_binaries: steps: - attach_workspace: @@ -589,7 +602,7 @@ commands: if [[ <> == '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|useDurationFormat|useTestingType|SpecPatterns).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL) + TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns|DebugPendingRunCounts|DebugRunStates|DebugPageHeader|DebugPendingRunSplash|DebugRunNavigation|DebugRunNavigationLimitMessage).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) @@ -1644,6 +1657,7 @@ jobs: docker_layer_caching: true resource_class: medium steps: + - maybe_skip_binary_jobs - run-binary-system-tests system-tests-chrome: @@ -2087,6 +2101,7 @@ jobs: default: xlarge resource_class: << parameters.resource_class >> steps: + - maybe_skip_binary_jobs - restore_cached_workspace - check-if-binary-exists - setup_should_persist_artifacts @@ -2102,6 +2117,7 @@ jobs: default: large resource_class: << parameters.resource_class >> steps: + - maybe_skip_binary_jobs - restore_cached_workspace - run: name: Check pipeline info @@ -2243,6 +2259,7 @@ jobs: docker: - image: cypress/base-internal:18.15.0 steps: + - maybe_skip_binary_jobs - restore_workspace_binaries - run: mkdir test-binary - run: @@ -2279,6 +2296,7 @@ jobs: <<: *defaults resource_class: small steps: + - maybe_skip_binary_jobs - restore_workspace_binaries - run: mkdir <> - run: @@ -2318,6 +2336,7 @@ jobs: <<: *defaults resource_class: small steps: + - maybe_skip_binary_jobs - restore_workspace_binaries - run: mkdir <> - run: @@ -2410,6 +2429,7 @@ jobs: test-binary-against-kitchensink: <<: *defaults steps: + - maybe_skip_binary_jobs - test-binary-against-repo: repo: cypress-example-kitchensink browser: electron @@ -2472,6 +2492,7 @@ jobs: test-binary-as-specific-user: <<: *defaults steps: + - maybe_skip_binary_jobs - restore_workspace_binaries # the user should be "node" - run: whoami @@ -2825,15 +2846,396 @@ linux-x64-workflow: &linux-x64-workflow 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: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + <<: *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-x64-contributor-workflow: &linux-x64-contributor-workflow + jobs: + - node_modules_install + - build: + 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 + + - check-ts: + requires: + - build + - lint: + name: linux-lint + requires: + - build + - percy-finalize: + context: [test-runner:poll-circle-workflow, test-runner:percy] + required_env_var: PERCY_TOKEN # skips job if not defined (external PR) + requires: + - contributor-pr + - 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-beta: + 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-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-create-cypress-tests: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + # This release definition must be updated with any new jobs + # Any attempts to automate this are welcome + # If CircleCI provided an "after all" hook, then this wouldn't be necessary + - trigger-binary-release-workflow: + context: test-runner:poll-circle-workflow + requires: + - build + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-create-cypress-tests + - npm-react + - npm-mount-utils + - 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-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - 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 + - 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 + - v8-integration-tests + + - npm-release: + context: test-runner:npm-release + requires: + - build + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-create-cypress-tests + - npm-react + - npm-mount-utils + - 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-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - server-performance-tests + - server-integration-tests + - server-unit-tests + - test-kitchensink + - unit-tests + - verify-release-readiness + - 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 + - v8-integration-tests + + - 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 + <<: *mainBuildFilters + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + context: test-runner:record-tests + <<: *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: @@ -2877,13 +3279,16 @@ linux-x64-workflow: &linux-x64-workflow - 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 @@ -2905,11 +3310,7 @@ linux-arm64-workflow: &linux-arm64-workflow - create-and-trigger-packaging-artifacts: name: linux-arm64-create-and-trigger-packaging-artifacts - context: - - test-runner:upload - - test-runner:commit-status-checks - - test-runner:build-binary - - publish-binary + context: [test-runner:upload, test-runner:commit-status-checks, test-runner:build-binary, publish-binary] executor: linux-arm64 resource_class: arm.medium requires: @@ -2923,9 +3324,7 @@ linux-arm64-workflow: &linux-arm64-workflow - get-published-artifacts: name: linux-arm64-get-published-artifacts - context: - - publish-binary - - test-runner:commit-status-checks + context: [publish-binary, test-runner:commit-status-checks] executor: linux-arm64 resource_class: arm.medium requires: @@ -3130,6 +3529,12 @@ workflows: linux-x64: <<: *linux-x64-workflow <<: *linux-x64-workflow-exclude-filters + linux-x64-contributor: + <<: *linux-x64-contributor-workflow + when: + matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> linux-arm64: <<: *linux-arm64-workflow <<: *linux-arm64-workflow-filters @@ -3141,4 +3546,4 @@ workflows: <<: *darwin-workflow-filters windows: <<: *windows-workflow - <<: *windows-workflow-filters + <<: *windows-workflow-filters \ No newline at end of file diff --git a/.github/workflows/report_weekly_app_kpis.yml b/.github/workflows/report_weekly_app_kpis.yml deleted file mode 100644 index d9a1a82be7d6..000000000000 --- a/.github/workflows/report_weekly_app_kpis.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: 'KPI Report Generation' -on: - # makes this workflow reusable - workflow_call: - secrets: - TRIAGE_BOARD_TOKEN: - required: true - - workflow_dispatch: - inputs: - start-date: - description: 'Beginning date of query (ex. 2023-06-01)' - required: false - end-date: - description: 'Ending date of query (ex. 2023-06-01)' - required: false - default-other-repos: - description: "Comma separated list of repos you want to query" - required: false - default: '["cypress-documentation", "circleci-orb", "github-action", "cypress-docker-images", "cypress-chrome-recorder-extension", "cypress-chrome-recorder", "cypress-recorder-extension", "cypress-example-kitchensink", "cypress-origin-providers", "release-automations", "cypress-test-tiny", "eslint-plugin-cypress", "netlify-plugin-cypress", "cypress-support-internal", "cypress-realworld-app", "code-coverage"]' - default-mono-repo: - description: "The Cypress mono repo" - required: false - default: '["cypress"]' - - schedule: - - cron: '0 18 * * 5' # this will run weekly on Friday at 2PM EST (the github workflow runners are on UTC) - -jobs: - run-kpi-reporting: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - repository: 'cypress-io/release-automations' - ref: 'master' - ssh-key: ${{ secrets.WORKFLOW_DEPLOY_KEY }} - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - - name: Generate Non-mono Repo Open / Closed KPIs - id: non-mono-repo-open-closed-metrics - uses: actions/github-script@v6 - env: - DEFAULT_REPOS: ${{ github.event.inputs.default-other-repos || '["cypress-documentation", "circleci-orb", "github-action", "cypress-docker-images", "cypress-chrome-recorder-extension", "cypress-chrome-recorder", "cypress-recorder-extension", "cypress-example-kitchensink", "cypress-origin-providers", "release-automations", "cypress-test-tiny", "eslint-plugin-cypress", "netlify-plugin-cypress", "cypress-support-internal", "cypress-realworld-app", "code-coverage"]' }} - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/open-vs-closed-issues.js') - await script.getOpenAndClosedIssueMetrics(github, context, core, ${{ env.DEFAULT_REPOS }}); - - name: Generate Cypress Mono Repo Open / Closed KPIs - id: mono-repo-open-closed-metrics - uses: actions/github-script@v6 - env: - DEFAULT_MONO_REPO: ${{ github.event.inputs.default-mono-repo || '["cypress"]' }} - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/open-vs-closed-issues.js') - await script.getOpenAndClosedIssueMetrics(github, context, core, ${{ env.DEFAULT_MONO_REPO }}); - - name: Generate Triage Throughput KPIs - id: triage-metrics - uses: actions/github-script@v6 - env: - START_DATE: ${{ github.event.inputs.start-date }} - END_DATE: ${{ github.event.inputs.end-date }} - PROJECT_BOARD_NUMBER: 9 - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/triage_throughput_kpis.js') - await script.getTriageIssueMetrics(github, context, core, "${{ env.START_DATE }}", "${{ env.END_DATE }}", "${{ env.PROJECT_BOARD_NUMBER }}"); - - name: Generate Mitigation KPIs - id: mitigation-metrics - uses: actions/github-script@v6 - env: - START_DATE: ${{ github.event.inputs.start-date }} - END_DATE: ${{ github.event.inputs.end-date }} - PROJECT_BOARD_NUMBER: 9 - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/triage_mitigation_kpis.js') - await script.getIssueMitigationMetrics(github, context, core, "${{ env.START_DATE }}", "${{ env.END_DATE }}", "${{ env.PROJECT_BOARD_NUMBER }}"); - - name: Generate Feature Request KPIs - id: feature-metrics - uses: actions/github-script@v6 - env: - START_DATE: ${{ github.event.inputs.start-date }} - END_DATE: ${{ github.event.inputs.end-date }} - PROJECT_BOARD_NUMBER: 9 - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/triage_feature_requests_metrics.js') - await script.getFeatureRequestMetrics(github, context, core, "${{ env.START_DATE }}", "${{ env.END_DATE }}", "${{ env.PROJECT_BOARD_NUMBER }}"); - - name: Generate KPI Report - id: generate-report - uses: actions/github-script@v6 - env: - START_DATE: ${{ github.event.inputs.start-date }} - END_DATE: ${{ github.event.inputs.end-date }} - PROJECT_BOARD_NUMBER: 9 - with: - github-token: ${{ secrets.TRIAGE_BOARD_TOKEN }} - script: | - const script = require('./scripts/reports/generate_kpi_report.js') - await script.generateKPIReport(github, context, core, ${{ steps.non-mono-repo-open-closed-metrics.outputs.results }}, ${{ steps.mono-repo-open-closed-metrics.outputs.results }}, ${{ steps.triage-metrics.outputs.results }}, ${{ steps.mitigation-metrics.outputs.results }}, ${{ steps.feature-metrics.outputs.results }} ); - \ No newline at end of file diff --git a/.github/workflows/trigger_circleci.yml b/.github/workflows/trigger_circleci.yml deleted file mode 100644 index 1386ec551beb..000000000000 --- a/.github/workflows/trigger_circleci.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: "Trigger CircleCi Pipeline" - -on: - pull_request_target: - types: - - opened - - ready_for_review - -jobs: - main: - name: Trigger CircleCi Pipeline when PR is ready for review - runs-on: ubuntu-latest - steps: - - if: ${{ github.event.pull_request.draft == false }} - shell: bash - env: - CIRCLE_TOKEN: ${{ secrets.CIRCLE_TOKEN }} - BASE_ORG_AND_REPO: ${{ github.event.pull_request.head.full_name }} - PULL_ID: ${{ github.event.pull_request.number }} - run: | - if [[ "${CIRCLE_TOKEN}" == "" ]]; then - echo "The CIRCLE_TOKEN is unset. Cannot trigger pipeline..." - exit 1; - fi - - BRANCH="$GITHUB_HEAD_REF" - - if [[ "$BASE_ORG_AND_REPO" != "cypress-io/cypress" ]]; then - echo "Triggering CircleCi pipeline for outside contributor." - BRANCH="pull/$PULL_ID/head" - fi - - echo "Triggering CircleCi pipeline for $BRANCH" - - response=$(curl -X POST https://circleci.com/api/v2/project/github/cypress-io/cypress/pipeline \ - --header "Circle-Token:$CIRCLE_TOKEN" \ - --header "content-type:application/json" \ - --data "{\"branch\":\"$BRANCH\"}" \ - --silent - ) - - echo "$response" - - if [ "$(jq 'has("message")' <<< $response )" == "true" ]; then - echo "Error triggering pipeline..." - exit 1; - fi diff --git a/.github/workflows/update-browser-versions.yml b/.github/workflows/update-browser-versions.yml index b85b8eb89c4e..1f13316f7731 100644 --- a/.github/workflows/update-browser-versions.yml +++ b/.github/workflows/update-browser-versions.yml @@ -1,5 +1,7 @@ name: Update Browser Versions on: + workflow_dispatch: + schedule: - cron: '0 8 * * *' # every day at 8am UTC (3/4am EST/EDT) jobs: @@ -104,6 +106,7 @@ jobs: }) # Update available and a PR doesn't already exist - name: Create Pull Request + id: create-pr if: ${{ steps.check-need-for-pr.outputs.needs_pr == 'true' }} uses: actions/github-script@v6 with: @@ -117,4 +120,5 @@ jobs: branchName: '${{ steps.check-branch.outputs.branch_name }}', description: '${{ steps.get-versions.outputs.description }}', body: 'This PR was auto-generated to update the version(s) of Chrome for driver tests', + addToProjectBoard: true, }) diff --git a/.vscode/launch.json b/.vscode/launch.json index ff2618c4bf7d..2142cdfd3ce2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,21 @@ "processId": "${command:PickProcess}", "continueOnAttach": true }, + { + "type": "node", + "request": "attach", + "name": "Attach to port 5566", + "port": 5566, + "continueOnAttach": true, + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Docker", + "port": 5566, + "continueOnAttach": true, + "remoteRoot": "/opt/cypress", + }, { "type": "node", "request": "attach", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 800dd5bd5904..843077d6855a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -207,6 +207,7 @@ You must have the following installed on your system to contribute locally: - [`Node.js`](https://nodejs.org/en/) (See the root [.node-version](.node-version) file for the required version. You can find a list of tools on [node-version-usage](https://github.com/shadowspawn/node-version-usage) to switch the version of [`Node.js`](https://nodejs.org/en/) based on [.node-version](.node-version).) - [`yarn`](https://yarnpkg.com/en/docs/install) - [`python`](https://www.python.org/downloads/) (since we use `node-gyp`. See their [repo](https://github.com/nodejs/node-gyp) for Python version requirements.) + - Note for Debian-based systems: `python` is pre-installed.
`sudo apt install g++ make cmake` meets the additional requirements to run `node-gyp` in the context of building Cypress from source. ### Getting Started @@ -363,6 +364,8 @@ Additionally, we test the code by running it against various other example proje If you're curious how we manage all of these tests in CI check out our [CircleCI config](.circleci/config.yml). +Some of our test jobs in CircleCI require access to environment variables that are sensitive and are restricted to Cypress maintainers only. If you are not a Cypress maintainer, when your CI job runs, only a subset of jobs will run at first. A Cypress maintainer will need to approve the `contributor-pr` job in your workflow in order for your CI pipeline to complete. + #### Docker Sometimes tests pass locally, but fail in CI. Our CI environment is dockerized. In order to run the image used in CI locally: @@ -396,6 +399,20 @@ $ yarn add https://cdn.cypress.io/beta/npm/.../cypress.tgz Note that unzipping the Linux binary inside a Docker container onto a mapped volume drive is *slow*. But once this is done you can modify the application resource folder in the local folder `/tmp/test-folder/node_modules/cypress/cypress-cache/3.3.0/Cypress/resources/app` to debug issues. +#### Docker as a performance constrained environment + +Sometimes performance issues are easier to reproduce in performance constrained environments. A docker container can be a good way to simulate this locally and allow for quick iteration. + +In a fresh cypress repository run the following command: + +```shell +docker compose run --service-port dev +``` + +This will spin up a docker container based off cypress/browsers:latest and start up the bash terminal. From here you can yarn install and develop as normal, although slower. It's recommend that you run this in a fresh repo because node modules may differ between an install on your local device and from within a linux docker image. + +Ports 5566 and 5567 are available to attach debuggers to, please note that docker compose run only maps ports if the `--service-port` command is used. + ### Packages Generally when making contributions, you are typically making them to a small number of packages. Most of your local development work will be inside a single package at a time. @@ -414,7 +431,7 @@ The repository has one protected branch: We want to publish our [standalone npm packages](./npm) continuously as new features are added. Therefore, after any pull request that changes independent `@cypress/` packages in the [`npm`](./npm) directory will automatically publish when a PR is merged directly into `develop` and the entire build passes. We used [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/) to automate the release of these packages to npm. -We do not continuously deploy the Cypress binary, so `develop` contains all of the new features and fixes that are staged to go out in the next update of the main Cypress app. If you make changes to an npm package that can't be published until the binary is also updated, you should make a pull request against specifying this is not be merged until the scheduled Cypress app release date. +We do not continuously deploy the Cypress binary, so `develop` contains all of the new features and fixes that are staged to go out in the next update of the main Cypress app. If you make changes to an npm package that can't be published until the binary is also updated, the pull request should clearly state that it should not be merged until the next scheduled Cypress app release date. ### Pull Requests diff --git a/browser-versions.json b/browser-versions.json index eb4bb16309d3..a123031782e8 100644 --- a/browser-versions.json +++ b/browser-versions.json @@ -1,5 +1,5 @@ { - "chrome:beta": "115.0.5790.13", - "chrome:stable": "114.0.5735.106", + "chrome:beta": "118.0.5993.11", + "chrome:stable": "117.0.5938.88", "chrome:minimum": "64.0.3282.0" } diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index d4ad63cde915..a20c46342968 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,19 +1,43 @@ +## 13.3.1 + +_Released 10/03/2023 (PENDING)_ + +**Bugfixes:** + +- Fixed an issue where requests were correlated in the wrong order in the proxy. This could cause an issue where the wrong request is used for `cy.intercept` or assets (e.g. stylesheets or images) may not properly be available in Test Replay. Addressed in [#27892](https://github.com/cypress-io/cypress/pull/27892). + +## 13.3.0 + +_Released 09/27/2023_ + +**Features:** + + - Introduces new layout for Runs page providing additional run information. Addresses [#27203](https://github.com/cypress-io/cypress/issues/27203). + +**Bugfixes:** + +- Fixed an issue where actionability checks trigger a flood of font requests. Removing the font requests has the potential to improve performance and removes clutter from Test Replay. Addressed in [#27860](https://github.com/cypress-io/cypress/pull/27860). +- Fixed network stubbing not permitting status code 999. Fixes [#27567](https://github.com/cypress-io/cypress/issues/27567). Addressed in [#27853](https://github.com/cypress-io/cypress/pull/27853). + ## 13.2.0 -_Released 09/12/2023 (PENDING)_ +_Released 09/12/2023_ **Features:** - - Adds support for Nx users who want to run Angular Component Testing in parallel. Addresses [#27723](https://github.com/cypress-io/cypress/pull/27723). + - Adds support for Nx users who want to run Angular Component Testing in parallel. Addressed in [#27723](https://github.com/cypress-io/cypress/pull/27723). **Bugfixes:** -- Fixed an issue where `enter`, `keyup`, and `space` events where not triggering `click` events properly in some versions of Firefox. Addressed in [#27715](https://github.com/cypress-io/cypress/pull/27715). +- Edge cases where `cy.intercept()` would not properly intercept and asset response bodies would not properly be captured for Test Replay have been addressed. Addressed in [#27771](https://github.com/cypress-io/cypress/pull/27771). +- Fixed an issue where `enter`, `keyup`, and `space` events were not triggering `click` events properly in some versions of Firefox. Addressed in [#27715](https://github.com/cypress-io/cypress/pull/27715). +- Fixed a regression in `13.0.0` where tests using Basic Authorization can potentially hang indefinitely on chromium browsers. Addressed in [#27781](https://github.com/cypress-io/cypress/pull/27781). +- Fixed a regression in `13.0.0` where component tests using an intercept that matches all requests can potentially hang indefinitely. Addressed in [#27788](https://github.com/cypress-io/cypress/pull/27788). **Dependency Updates:** -- Upgraded Electron from `21.0.0` to `25.8.0`, which updates bundled Chromium from `106.0.5249.51` to `114.0.5735.289`. Addresses [#27595](https://github.com/cypress-io/cypress/issues/27595). Additionally, the Node version the binary has been upgraded from from `16.16.0` to `18.15.0`. This does **NOT** have an impact on the node version you are using with Cypress and is merely an internal update to the repository & shipped binary. Addressed in [#27715](https://github.com/cypress-io/cypress/pull/27715). Addresses [#27595](https://github.com/cypress-io/cypress/issues/27595). +- Upgraded Electron from `21.0.0` to `25.8.0`, which updates bundled Chromium from `106.0.5249.51` to `114.0.5735.289`. Additionally, the Node version binary has been upgraded from `16.16.0` to `18.15.0`. This does **NOT** have an impact on the node version you are using with Cypress and is merely an internal update to the repository & shipped binary. Addressed in [#27715](https://github.com/cypress-io/cypress/pull/27715). Addresses [#27595](https://github.com/cypress-io/cypress/issues/27595). ## 13.1.0 @@ -26,7 +50,7 @@ _Released 08/31/2023_ **Bugfixes:** - Fixed a regression introduced in Cypress [13.0.0](#13-0-0) where the [Module API](https://docs.cypress.io/guides/guides/module-api), [`after:run`](https://docs.cypress.io/api/plugins/after-run-api), and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) results did not include the `stats.skipped` field for each run result. Fixes [#27694](https://github.com/cypress-io/cypress/issues/27694). Addressed in [#27695](https://github.com/cypress-io/cypress/pull/27695). -- Individual CDP errors that occur while capturing data for test replay will no longer prevent the entire run from being available. Addressed in [#27709](https://github.com/cypress-io/cypress/pull/27709). +- Individual CDP errors that occur while capturing data for Test Replay will no longer prevent the entire run from being available. Addressed in [#27709](https://github.com/cypress-io/cypress/pull/27709). - Fixed an issue where the release date on the `v13` landing page was a day behind. Fixed in [#27711](https://github.com/cypress-io/cypress/pull/27711). - Fixed an issue where fatal protocol errors would leak between specs causing all subsequent specs to fail to upload protocol information. Fixed in [#27720](https://github.com/cypress-io/cypress/pull/27720) - Updated `plist` from `3.0.6` to `3.1.0` to address [CVE-2022-37616](https://github.com/advisories/GHSA-9pgh-qqpf-7wqj) and [CVE-2022-39353](https://github.com/advisories/GHSA-crh6-fp67-6883). Fixed in [#27710](https://github.com/cypress-io/cypress/pull/27710). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000000..83fd12748ddd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3' + +services: + dev: + image: cypress/browsers:latest + ports: + # Share debugging ports + - 5566:5566 + - 5567:5567 + environment: + # Use Hist file from shared volume + HISTFILE: /root/hist/.bash_history + # Setup inspect to use the more permissive address when debugging so + # that we can connect to it from ouside the docker container + CYPRESS_DOCKER_DEV_INSPECT_OVERRIDE: '0.0.0.0:5566' + # This disables CI mode which causes cypress to build differently + CI: '' + command: /bin/bash + working_dir: /opt/cypress + volumes: + # Copy Cypress source to docker container + - .:/opt/cypress + - bash-history:/root/hist + watch: + image: cypress/browsers:latest + environment: + # This disables CI mode which causes cypress to build differently + CI: '' + command: yarn watch + working_dir: /opt/cypress + volumes: + # Copy Cypress source to docker container + - .:/opt/cypress + ci: + # This should mirror the image used in workflows.yml + image: cypress/browsers-internal:node18.15.0-chrome114-ff115 + ports: + - 5566:5566 + - 5567:5567 + command: /bin/bash + environment: + HISTFILE: /root/hist/.bash_history + CYPRESS_DOCKER_DEV_INSPECT_OVERRIDE: '0.0.0.0:5566' + working_dir: /opt/cypress + volumes: + - .:/opt/cypress + - bash-history:/root/hist + +# persist terminal history between runs in a virtual volume +volumes: + bash-history: diff --git a/package.json b/package.json index 4e6d5b76c3b8..68ddc604fdb9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress", - "version": "13.1.0", + "version": "13.3.0", "description": "Cypress is a next generation front end testing tool built for the modern web", "private": true, "scripts": { @@ -40,6 +40,7 @@ "gulp:debug": "node --inspect-brk ./node_modules/.bin/gulp", "dev-debug": "node ./scripts/debug.js dev", "docker": "./scripts/run-docker-local.sh", + "docker-dev": "./scripts/run-docker-local.sh dev", "ensure-deps": "./scripts/ensure-dependencies.sh", "get-next-version": "node scripts/get-next-version.js", "postinstall": "node ./scripts/run-postInstall.js", @@ -145,7 +146,7 @@ "dedent": "^0.7.0", "del": "3.0.0", "detect-port": "^1.3.0", - "electron": "25.8.0", + "electron": "25.8.1", "electron-builder": "^23.6.0", "enzyme-adapter-react-16": "1.12.1", "eslint": "7.22.0", diff --git a/packages/app/cypress/e2e/debug.cy.ts b/packages/app/cypress/e2e/debug.cy.ts index a5252b99eb56..c2c39129028b 100644 --- a/packages/app/cypress/e2e/debug.cy.ts +++ b/packages/app/cypress/e2e/debug.cy.ts @@ -75,7 +75,7 @@ describe('App - Debug Page', () => { .contains('View in Cypress Cloud') .should('have.attr', 'href', 'https://cloud.cypress.io/projects/7p5uce/runs/2?utm_medium=Debug+Tab&utm_campaign=View+in+Cypress+Cloud&utm_source=Binary%3A+App') - cy.findByTestId('debug-runNumber-PASSED').contains('#2') + cy.findByTestId('runNumber-status-PASSED').contains('#2') cy.findByTestId('debug-commitsAhead').contains('You are 1 commit ahead') cy.findByTestId('metadata').within(() => { @@ -136,7 +136,7 @@ describe('App - Debug Page', () => { cy.findByLabelText('Relevant run had 1 test failure').should('be.visible').contains('1') - cy.findByTestId('debug-runNumber-FAILED').contains('#136') + cy.findByTestId('runNumber-status-FAILED').contains('#136') cy.findByTestId('debug-commitsAhead').contains('You are 1 commit ahead') cy.findByTestId('metadata').within(() => { diff --git a/packages/app/cypress/e2e/runs.cy.ts b/packages/app/cypress/e2e/runs.cy.ts index d89a684b872d..5e6efb766d58 100644 --- a/packages/app/cypress/e2e/runs.cy.ts +++ b/packages/app/cypress/e2e/runs.cy.ts @@ -60,7 +60,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() cy.findByTestId('sidebar-link-runs-page').click() - cy.get('[data-cy="runs-loader"]') + cy.get('[data-cy*="runsSkeleton-"]') cy.get('[data-cy="runs"]') }) }) @@ -103,7 +103,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() moveToRunsPage() - cy.contains('a', 'OVERLIMIT').click() + cy.findByTestId('runNumber-status-OVERLIMIT').click() cy.withCtx((ctx, o) => { expect((ctx.actions.electron.openExternal as SinonStub).lastCall.lastArg).to.contain('http://dummy.cypress.io/runs/4') @@ -666,29 +666,25 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() moveToRunsPage() - cy.get('[href^="http://dummy.cypress.io/runs/0"]').first().within(() => { - cy.findByText('fix: make gql work CANCELLED') - cy.get('[data-cy="run-card-icon-CANCELLED"]') + cy.get('[data-cy="runCard-status-CANCELLED"]').first().within(() => { + cy.get('[data-cy="runNumber-status-CANCELLED"]') }) - cy.get('[href^="http://dummy.cypress.io/runs/1"]').first().within(() => { - cy.findByText('fix: make gql work ERRORED') - cy.get('[data-cy="run-card-icon-ERRORED"]') + cy.get('[data-cy="runCard-status-ERRORED"]').first().within(() => { + cy.get('[data-cy="runNumber-status-ERRORED"]') }) - cy.get('[href^="http://dummy.cypress.io/runs/2"]').first().within(() => { - cy.findByText('fix: make gql work FAILED') - cy.get('[data-cy="run-card-icon-FAILED"]') + cy.get('[data-cy="runCard-status-FAILED"]').first().within(() => { + cy.get('[data-cy="runNumber-status-FAILED"]') }) - cy.get('[href^="http://dummy.cypress.io/runs/0"]').first().as('firstRun') + cy.get('[data-cy="runCard-status-CANCELLED"]').first().as('firstRun') cy.get('@firstRun').within(() => { - cy.get('[data-cy="run-card-author"]').contains('John Appleseed') - cy.get('[data-cy="run-card-avatar"]') - cy.get('[data-cy="run-card-branch"]').contains('main') - cy.get('[data-cy="run-card-created-at"]').contains('an hour ago') - cy.get('[data-cy="run-card-duration"]').contains('01:00') + cy.get('[data-cy="runCard-author"]').contains('John Appleseed') + cy.get('[data-cy="runCard-avatar"]') + cy.get('[data-cy="runCard-branchName"]').contains('main') + cy.get('[data-cy="runCard-createdAt"]').contains('01m 00s (an hour ago)') cy.contains('span', 'skipped') cy.get('span').contains('pending') @@ -702,7 +698,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() moveToRunsPage() - cy.get('[data-cy^="runCard-"]').first().click() + cy.get('[data-cy="runNumber-status-CANCELLED"]').first().click() cy.withCtx((ctx) => { expect((ctx.actions.electron.openExternal as SinonStub).lastCall.lastArg).to.contain('http://dummy.cypress.io/runs/0') @@ -765,19 +761,18 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() moveToRunsPage() + cy.findByText('fix: using Git data CANCELLED') cy.get('[href^="http://dummy.cypress.io/runs/0"]').first().within(() => { - cy.findByText('fix: using Git data CANCELLED') - cy.get('[data-cy="run-card-icon-CANCELLED"]') + cy.get('[data-cy="runNumber-status-CANCELLED"]') }) - cy.get('[href^="http://dummy.cypress.io/runs/0"]').first().as('firstRun') + cy.get('[data-cy="runCard-status-CANCELLED"]').first().as('firstRun') cy.get('@firstRun').within(() => { - cy.get('[data-cy="run-card-author"]').contains('John Appleseed') - cy.get('[data-cy="run-card-avatar"]') - cy.get('[data-cy="run-card-branch"]').contains('main') - cy.get('[data-cy="run-card-created-at"]').contains('an hour ago') - cy.get('[data-cy="run-card-duration"]').contains('01:00') + cy.get('[data-cy="runCard-author"]').contains('John Appleseed') + cy.get('[data-cy="runCard-avatar"]') + cy.get('[data-cy="runCard-branchName"]').contains('main') + cy.get('[data-cy="runCard-createdAt"]').contains('01m 00s (an hour ago)') cy.contains('span', 'skipped') cy.get('span').contains('pending') @@ -791,7 +786,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { cy.visitApp() moveToRunsPage() - cy.get('[data-cy^="runCard-"]').first().click() + cy.get('[data-cy="runNumber-status-CANCELLED"]').first().click() cy.withCtx((ctx) => { expect((ctx.actions.electron.openExternal as SinonStub).lastCall.lastArg).to.contain('http://dummy.cypress.io/runs/0') @@ -955,7 +950,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { const itSkipIfWindows = Cypress.platform === 'win32' ? it.skip : it itSkipIfWindows('should re-query for executing runs', () => { - cy.get('[data-cy="run-card-icon-RUNNING"]').should('have.length', RUNNING_COUNT).should('be.visible') + cy.get('[data-cy="runNumber-status-RUNNING"]').should('have.length', RUNNING_COUNT).should('be.visible') cy.remoteGraphQLIntercept(async (obj) => { await new Promise((resolve) => setTimeout(resolve, 100)) @@ -976,7 +971,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => { }) function completeNext (passed) { - cy.get('[data-cy="run-card-icon-PASSED"]').should('have.length', passed).should('be.visible') + cy.get('[data-cy="runNumber-status-PASSED"]').should('have.length', passed).should('be.visible') if (passed < RUNNING_COUNT) { completeNext(passed + 1) } diff --git a/packages/app/package.json b/packages/app/package.json index c4a45f225676..e2c9505defcf 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -21,7 +21,7 @@ "dependencies": {}, "devDependencies": { "@cypress-design/vue-button": "^0.10.1", - "@cypress-design/vue-icon": "^0.25.0", + "@cypress-design/vue-icon": "^0.26.0", "@cypress-design/vue-statusicon": "^0.5.0", "@cypress-design/vue-tabs": "^0.5.1", "@graphql-typed-document-node/core": "^3.1.0", diff --git a/packages/app/src/debug/DebugPageHeader.cy.tsx b/packages/app/src/debug/DebugPageHeader.cy.tsx index 20a5b574ebb2..b5de9ddd2260 100644 --- a/packages/app/src/debug/DebugPageHeader.cy.tsx +++ b/packages/app/src/debug/DebugPageHeader.cy.tsx @@ -43,11 +43,11 @@ describe('', { cy.findByTestId('debug-results').should('be.visible') - cy.findByTestId('debug-runNumber-FAILED') + cy.findByTestId('runNumber-status-FAILED') .should('have.text', '#432') .children().should('have.length', 2) - cy.findByTestId('debug-flaky-badge') + cy.findByTestId('runResults-flakyBadge') .should('not.exist') defaults.forEach((obj) => { @@ -73,7 +73,7 @@ describe('', { }, }) - cy.findByTestId('debug-flaky-badge') + cy.findByTestId('runResults-flakyBadge') .contains(defaultMessages.specPage.flaky.badgeLabel) cy.findByTestId('total-flaky-tests') @@ -97,7 +97,7 @@ describe('', { }, }) - cy.findByTestId(`debug-runNumber-${status}`).should('be.visible') + cy.findByTestId(`runNumber-status-${status}`).should('be.visible') }) }) diff --git a/packages/app/src/debug/DebugPageHeader.vue b/packages/app/src/debug/DebugPageHeader.vue index 020eaffac4be..ee5f734d598b 100644 --- a/packages/app/src/debug/DebugPageHeader.vue +++ b/packages/app/src/debug/DebugPageHeader.vue @@ -51,12 +51,12 @@
  • - - @@ -92,7 +92,7 @@ v-if="debug.createdAt" data-cy="debug-header-createdAt" > - diff --git a/packages/app/src/debug/DebugRunNavigation.vue b/packages/app/src/debug/DebugRunNavigation.vue index ff2a1c4a260f..7bd9be4e92d2 100644 --- a/packages/app/src/debug/DebugRunNavigation.vue +++ b/packages/app/src/debug/DebugRunNavigation.vue @@ -38,12 +38,12 @@