From bbf9380c2fc49eec263409cbe3547934dc9acc53 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Tue, 26 Mar 2024 13:55:29 -0400 Subject: [PATCH] DEVPROD-5136: Add testing (#3) --- .evergreen/attach.yml | 170 +++++ .evergreen/evergreen.yml | 100 +++ .evergreen/shared.yml | 408 ++++++++++++ apps/parsley/.evergreen.yml | 590 ------------------ apps/parsley/cypress/support/commands.ts | 10 + apps/parsley/jest.config.js | 1 - apps/parsley/scripts/check_codegen.sh | 0 .../Search/SearchBar/SearchBar.test.tsx | 5 +- .../__snapshots__/SearchBar.stories.storyshot | 32 +- .../__snapshots__/SidePanel.stories.storyshot | 32 +- apps/spruce/.evergreen.yml | 567 ----------------- apps/spruce/jest.config.js | 12 +- apps/spruce/{ => scripts}/check_codegen.sh | 0 .../PageSizeSelector.stories.storyshot | 6 +- .../SpruceForm.stories.storyshot | 20 +- .../TableControl.stories.storyshot | 6 +- .../TupleSelect.stories.storyshot | 6 +- ...lectWithRegexConditional.stories.storyshot | 14 +- .../ProjectHealth.stories.storyshot | 4 +- 19 files changed, 762 insertions(+), 1221 deletions(-) create mode 100644 .evergreen/attach.yml create mode 100644 .evergreen/shared.yml delete mode 100644 apps/parsley/.evergreen.yml mode change 100644 => 100755 apps/parsley/scripts/check_codegen.sh delete mode 100644 apps/spruce/.evergreen.yml rename apps/spruce/{ => scripts}/check_codegen.sh (100%) diff --git a/.evergreen/attach.yml b/.evergreen/attach.yml new file mode 100644 index 000000000..1799ec5d9 --- /dev/null +++ b/.evergreen/attach.yml @@ -0,0 +1,170 @@ +functions: + attach-codegen-diff: + command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/bin/codegen.diff"] + remote_file: ${build_variant}/${task_id}/${execution}/codegen/ + bucket: evg-bucket-evergreen-ui + content_type: text/plain + permissions: public-read + + attach-cypress-results: + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/cypress/screenshots/*"] + remote_file: ${build_variant}/${task_id}/${execution}/ + bucket: evg-bucket-evergreen-ui + content_type: image/png + permissions: public-read + display_name: "screenshot:" + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/cypress/videos/*"] + remote_file: ${build_variant}/${task_id}/${execution}/ + bucket: evg-bucket-evergreen-ui + content_type: video/mp4 + permissions: public-read + display_name: "video:" + - command: attach.xunit_results + params: + files: + - "./ui/${app_dir}/bin/cypress/*.xml" + + attach-email: + command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/body.txt"] + remote_file: ${build_variant}/${task_id}/${execution}/ + bucket: evg-bucket-evergreen-ui + content_type: text/plain + permissions: public-read + + attach-logkeeper-logs: + command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_file: ui/${app_dir}/logkeeper/logkeeperapp.log + remote_file: ${build_variant}/${task_id}/${execution}/logkeeperapp.log + bucket: evg-bucket-evergreen-ui + content_type: text/plain + permissions: public-read + + attach-source-map: + command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_file: "ui/${app_dir}/build/source_map.html" + remote_file: ${build_variant}/${task_id}/${execution}/source_map.html + bucket: evg-bucket-evergreen-ui + content_type: text/html + permissions: public-read + display_name: source_map + + attach-storybook: + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/storybook-static/*.html"] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: text/html + permissions: public-read + preserve_path: true + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: + [ + "ui/${app_dir}/storybook-static/**/*.js$", + "ui/${app_dir}/storybook-static/**/*.mjs$", + ] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: application/javascript + permissions: public-read + preserve_path: true + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/storybook-static/**/*.js.map"] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: application/json + permissions: public-read + preserve_path: true + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/storybook-static/**/*.css"] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: text/css + permissions: public-read + preserve_path: true + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: ["ui/${app_dir}/storybook-static/**/*.json"] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: application/json + permissions: public-read + preserve_path: true + - command: s3.put + type: system + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + local_files_include_filter: [ + "ui/${app_dir}/storybook-static/**/*.woff", + "ui/${app_dir}/storybook-static/**/*.woff2" + ] + remote_file: ${build_variant}/${task_id}/${execution}/storybook/ + bucket: evg-bucket-evergreen-ui + content_type: font/woff2 + permissions: public-read + preserve_path: true + + attach-test-results: + command: attach.xunit_results + params: + files: + - "./ui/${app_dir}/bin/jest/*.xml" diff --git a/.evergreen/evergreen.yml b/.evergreen/evergreen.yml index e69de29bb..cb3670967 100644 --- a/.evergreen/evergreen.yml +++ b/.evergreen/evergreen.yml @@ -0,0 +1,100 @@ +command_type: test + +ignore: + - "*.md" + - ".github/*" + +modules: + - name: evergreen + owner: evergreen-ci + repo: evergreen + branch: main + auto_update: true + - name: logkeeper + owner: evergreen-ci + repo: logkeeper + branch: main + auto_update: true + +pre: + - func: assume-ec2-role + - func: get-project + - func: setup-node + - func: yarn-install + +post: + - func: assume-ec2-role + - func: attach-codegen-diff + - func: attach-cypress-results + - func: attach-email + - func: attach-logkeeper-logs + - func: attach-source-map + - func: attach-storybook + - func: attach-test-results + +include: + - filename: .evergreen/shared.yml + - filename: .evergreen/attach.yml + +buildvariants: + - name: spruce + display_name: Spruce + run_on: + - ubuntu2204-large + expansions: + app_dir: apps/spruce + goroot: /opt/golang/go1.20 + mongodb_tools_url: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz + mongodb_url_2204: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.2.tgz + mongosh_url_2204: https://downloads.mongodb.com/compass/mongosh-2.0.2-linux-x64.tgz + node_version: 20.10.0 + modules: + - evergreen + - logkeeper + tasks: + - name: check_codegen + - name: compile + - name: e2e_test_spruce + - name: lint + - name: snapshots + - name: storybook + - name: test + - name: type_check + - name: deploy_prod_spruce + git_tag_only: true + patchable: false + priority: 100 + + - name: parsley + display_name: Parsley + expansions: + app_dir: apps/parsley + goroot: /opt/golang/go1.20 + mongodb_tools_url: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.tgz + mongodb_url_2204: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.2.tgz + mongosh_url_2204: https://downloads.mongodb.com/compass/mongosh-2.0.2-linux-x64.tgz + node_version: 20.10.0 + run_on: + - ubuntu2204-large + - ubuntu2204-small + modules: + - evergreen + - logkeeper + tasks: + - name: check_codegen + - name: compile + - name: e2e_test_parsley + - name: lint + - name: snapshots + - name: storybook + - name: test + - name: type_check + - name: deploy_prod_parsley + git_tag_only: true + patchable: false + priority: 100 + +parameters: + - key: cypress_spec + value: cypress/integration/**/* + description: Specify the Cypress spec files to run for user submitted patches running the e2e_test task. diff --git a/.evergreen/shared.yml b/.evergreen/shared.yml new file mode 100644 index 000000000..acdbbb9f2 --- /dev/null +++ b/.evergreen/shared.yml @@ -0,0 +1,408 @@ +functions: + assume-ec2-role: + command: ec2.assume_role + params: + role_arn: ${ASSUME_ROLE_ARN} + + check-codegen: + command: shell.exec + params: + working_dir: ui/${app_dir} + script: | + ${PREPARE_SHELL} + ./scripts/check_codegen.sh + + get-project: + command: git.get_project + type: setup + params: + directory: ui + shallow_clone: true + + prod-deploy-parsley: + command: shell.exec + params: + working_dir: ui/apps/parsley + env: + BUCKET: ${parsley_bucket} + AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} + AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} + AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN} + EXECUTION: ${execution} + DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} + AUTHOR_EMAIL: ${author_email} + script: | + ${PREPARE_SHELL} + yarn deploy:prod + + prod-deploy-spruce: + command: shell.exec + params: + working_dir: ui/apps/spruce + env: + BUCKET: ${spruce_bucket} + AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} + AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} + AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN} + EXECUTION: ${execution} + DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} + AUTHOR_EMAIL: ${author_email} + script: | + ${PREPARE_SHELL} + yarn deploy:prod + + run-make-background: + command: subprocess.exec + params: + working_dir: ui/evergreen + binary: make + args: ["${make_args|}", "${target}"] + background: true + env: + SETTINGS_OVERRIDE: file + GOROOT: ${goroot} + + run-logkeeper: + command: shell.exec + params: + working_dir: ui/logkeeper + background: true + script: go run main/logkeeper.go --localPath _bucketdata + shell: bash + env: + GOROOT: ${goroot} + PATH: ${goroot}/bin:$PATH + LK_CORS_ORIGINS: http:\/\/localhost:\d+ + + seed-logkeeper: + command: s3.get + type: setup + params: + aws_key: ${AWS_ACCESS_KEY_ID} + aws_secret: ${AWS_SECRET_ACCESS_KEY} + aws_session_token: ${AWS_SESSION_TOKEN} + extract_to: ui/logkeeper + remote_file: _bucketdata.tar.gz + bucket: parsley-test + + setup-credentials-parsley: + command: shell.exec + params: + working_dir: ui/apps/parsley + env: + PARSLEY_SENTRY_AUTH_TOKEN: ${PARSLEY_SENTRY_AUTH_TOKEN} + REACT_APP_PARSLEY_SENTRY_DSN: ${REACT_APP_PARSLEY_SENTRY_DSN} + NEW_RELIC_ACCOUNT_ID: ${NEW_RELIC_ACCOUNT_ID} + NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} + NEW_RELIC_TRUST_KEY: ${NEW_RELIC_TRUST_KEY} + PARSLEY_NEW_RELIC_AGENT_ID: ${PARSLEY_NEW_RELIC_AGENT_ID} + PARSLEY_NEW_RELIC_APPLICATION_ID: ${PARSLEY_NEW_RELIC_APPLICATION_ID} + DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} + BUCKET: ${parsley_bucket} + EVERGREEN_API_SERVER_HOST: ${evergreen_api_server_host} + EVERGREEN_UI_SERVER_HOST: ${evergreen_ui_server_host} + EVERGREEN_API_KEY: ${evergreen_api_key} + EVERGREEN_USER: ${evergreen_user} + script: | + echo "Generating .env-cmdrc.json" + node scripts/setup-credentials.js + + echo "populating evergreen.yml" + chmod +x ./scripts/create-evergreen-yml.sh + ./scripts/create-evergreen-yml.sh + echo "Done populating evergreen.yml" + + setup-credentials-spruce: + command: shell.exec + params: + working_dir: ui/apps/spruce + env: + SPRUCE_SENTRY_AUTH_TOKEN: ${SPRUCE_SENTRY_AUTH_TOKEN} + REACT_APP_SPRUCE_SENTRY_DSN: ${REACT_APP_SPRUCE_SENTRY_DSN} + NEW_RELIC_ACCOUNT_ID: ${NEW_RELIC_ACCOUNT_ID} + NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} + NEW_RELIC_TRUST_KEY: ${NEW_RELIC_TRUST_KEY} + SPRUCE_NEW_RELIC_AGENT_ID: ${SPRUCE_NEW_RELIC_AGENT_ID} + SPRUCE_NEW_RELIC_APPLICATION_ID: ${SPRUCE_NEW_RELIC_APPLICATION_ID} + REACT_APP_DEPLOYS_EMAIL: ${REACT_APP_DEPLOYS_EMAIL} + REACT_APP_HONEYCOMB_BASE_URL: ${REACT_APP_HONEYCOMB_BASE_URL} + EVERGREEN_API_SERVER_HOST: ${evergreen_api_server_host} + EVERGREEN_UI_SERVER_HOST: ${evergreen_ui_server_host} + EVERGREEN_API_KEY: ${evergreen_api_key} + EVERGREEN_USER: ${evergreen_user} + script: | + echo "Generating .env-cmdrc.json" + node scripts/setup-credentials.js + + echo "populating evergreen.yml" + chmod +x ./scripts/create-evergreen-yml.sh + ./scripts/create-evergreen-yml.sh + echo "Done populating evergreen.yml" + + setup-mongodb: + - command: subprocess.exec + type: setup + params: + env: + gobin: ${goroot}/bin/go + MONGODB_URL: ${mongodb_url_2204} + MONGODB_DECOMPRESS: ${decompress} + working_dir: ui/evergreen + command: make get-mongodb + - command: subprocess.exec + type: setup + params: + env: + gobin: ${goroot}/bin/go + MONGOSH_URL: ${mongosh_url_2204} + MONGOSH_DECOMPRESS: ${decompress} + working_dir: ui/evergreen + command: make get-mongosh + - command: subprocess.exec + type: setup + params: + background: true + working_dir: ui/evergreen + command: make start-mongod + - command: subprocess.exec + type: setup + params: + working_dir: ui/evergreen + command: make configure-mongod + - command: shell.exec + type: setup + params: + shell: bash + script: | + ${PREPARE_SHELL} + cd $PROJECT_DIRECTORY + mkdir mongodb-tools && cd mongodb-tools + curl ${mongodb_tools_url} -o mongodb-tools.tgz + ${decompress} mongodb-tools.tgz + mv ./mongodb-*/bin/* . + + setup-node: + - command: subprocess.exec + params: + binary: bash + args: + - ui/${app_dir}/scripts/prepare-shell.sh + - command: expansions.update + params: + file: expansion.yml + - command: shell.exec + params: + shell: bash + script: | + ${PREPARE_SHELL} + + # Fetch NVM and install it into this task's .nvm directory + # Once downloaded, source nvm and install yarn + git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR" + cd "$NVM_DIR" + git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)` + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + cd - + + # Retry the download for Node in case it flakes. + for i in {1..5}; do + nvm install --no-progress --default ${node_version} + [[ $? -eq 0 ]] && break + echo "Attempt $i of 5 to install Node failed" + sleep 10 + done + npm install -g yarn + + symlink: + command: shell.exec + params: + working_dir: ui + shell: bash + script: | + ln -s ${workdir}/ui/evergreen/graphql/schema ${app_dir}/sdlschema + + wait-for-evergreen: + command: shell.exec + type: setup + params: + exec_timeout_secs: 600 + working_dir: ui/${app_dir} + script: ./scripts/wait-for-evergreen.sh + + yarn-build: + command: shell.exec + params: + working_dir: ui/${app_dir} + shell: bash + script: | + ${PREPARE_SHELL} + yarn build:local + + yarn-build-storybook: + command: shell.exec + params: + working_dir: ui/${app_dir} + script: | + ${PREPARE_SHELL} + # TODO: Standardize Storybook script name in Spruce and Parsley + yarn build-storybook || yarn storybook:build + + yarn-cypress: + command: shell.exec + params: + working_dir: ui/${app_dir} + shell: bash + script: | + ${PREPARE_SHELL} + # Allow spec filtering for an intentional patch. + if [[ "${requester}" == "patch" ]]; then + yarn cy:run --reporter junit --spec "${cypress_spec}" + else + yarn cy:run --reporter junit + fi + + yarn-eslint: + command: shell.exec + params: + working_dir: ui/${app_dir} + shell: bash + script: | + ${PREPARE_SHELL} + yarn eslint:strict + + yarn-install: + command: shell.exec + params: + working_dir: ui/${app_dir} + shell: bash + script: | + ${PREPARE_SHELL} + yarn install + + yarn-preview: + command: shell.exec + params: + working_dir: ui/${app_dir} + background: true + shell: bash + script: | + ${PREPARE_SHELL} + yarn preview + + yarn-serve: + command: shell.exec + type: setup + params: + working_dir: ui/${app_dir} + background: true + script: | + ${PREPARE_SHELL} + yarn serve + + yarn-snapshot: + command: shell.exec + params: + working_dir: ui/${app_dir} + script: | + ${PREPARE_SHELL} + yarn test --ci --testPathPattern=snapshot.test.ts + + yarn-test: + command: shell.exec + params: + working_dir: ui/${app_dir} + script: | + ${PREPARE_SHELL} + yarn test --ci --testPathIgnorePatterns=snapshot.test.ts + + yarn-tsc: + command: shell.exec + params: + working_dir: ui/${app_dir} + script: | + ${PREPARE_SHELL} + yarn check-types + + yarn-verify-backend: + command: shell.exec + params: + working_dir: ui/${app_dir} + shell: bash + script: | + ${PREPARE_SHELL} + yarn verify-backend + +tasks: + - name: check_codegen + commands: + - func: symlink + - func: check-codegen + + - name: compile + commands: + - func: symlink + - func: yarn-build + + - name: deploy_prod_parsley + commands: + - func: setup-credentials-parsley + - func: symlink + - func: prod-deploy-parsley + + - name: deploy_prod_spruce + commands: + - func: setup-credentials-spruce + - func: symlink + - func: prod-deploy-spruce + + - name: e2e_test_parsley + commands: + - func: setup-mongodb + - func: run-make-background + vars: + target: local-evergreen + - func: seed-logkeeper + - func: run-logkeeper + - func: yarn-build + - func: yarn-preview + - func: wait-for-evergreen + - func: yarn-verify-backend + - func: yarn-cypress + + - name: e2e_test_spruce + commands: + - func: setup-mongodb + - func: run-make-background + vars: + target: local-evergreen + - func: symlink + - func: seed-logkeeper + - func: run-logkeeper + - func: yarn-build + - func: yarn-serve + - func: wait-for-evergreen + - func: yarn-cypress + + - name: lint + commands: + - func: symlink + - func: yarn-eslint + + - name: snapshots + commands: + - func: yarn-snapshot + - func: attach-test-results + + - name: storybook + commands: + - func: yarn-build-storybook + + - name: test + commands: + - func: yarn-test + + - name: type_check + commands: + - func: symlink + - func: yarn-tsc + diff --git a/apps/parsley/.evergreen.yml b/apps/parsley/.evergreen.yml deleted file mode 100644 index ff6848924..000000000 --- a/apps/parsley/.evergreen.yml +++ /dev/null @@ -1,590 +0,0 @@ -stepback: true -command_type: test -ignore: - - "*.md" - - ".github/*" - -modules: - - name: evergreen - repo: git@github.com:evergreen-ci/evergreen.git - branch: main - auto_update: true - - name: logkeeper - repo: git@github.com:evergreen-ci/logkeeper.git - branch: main - auto_update: true - - -####################################### -# Parsley Functions # -####################################### -functions: - assume-ec2-role: - command: ec2.assume_role - params: - role_arn: ${PARSLEY_ASSUME_ROLE_ARN} - - attach-codegen-diff: - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - - "parsley/bin/codegen.diff" - remote_file: parsley/${task_id}/codegen/ - bucket: mciuploads - content_type: text/plain - permissions: public-read - - attach-cypress: - - command: attach.xunit_results - params: - files: - - "./parsley/bin/cypress/*.xml" - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/cypress/screenshots/*"] - remote_file: parsley/${task_id}/ - bucket: mciuploads - content_type: image/png - permissions: public-read - display_name: "screenshot:" - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/cypress/videos/*"] - remote_file: parsley/${task_id}/ - bucket: mciuploads - content_type: video/mp4 - permissions: public-read - display_name: "video:" - - attach-test-results: - command: attach.xunit_results - params: - files: - - "./parsley/bin/jest/*.xml" - - attach-storybook: - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/storybook-static/*.html"] - remote_file: parsley/${task_id}/storybook/ - bucket: mciuploads - content_type: text/html - permissions: public-read - preserve_path: true - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/storybook-static/**/*.js", "parsley/storybook-static/**/*.mjs"] - remote_file: parsley/${task_id}/storybook/ - bucket: mciuploads - content_type: application/javascript - permissions: public-read - preserve_path: true - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/storybook-static/**/*.js.map"] - remote_file: parsley/${task_id}/storybook/ - bucket: mciuploads - content_type: application/json - permissions: public-read - preserve_path: true - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/storybook-static/**/*.svg"] - remote_file: parsley/${task_id}/storybook/ - bucket: mciuploads - content_type: image/svg+xml - permissions: public-read - preserve_path: true - - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_files_include_filter: - ["parsley/storybook-static/**/*.json"] - remote_file: parsley/${task_id}/storybook/ - bucket: mciuploads - content_type: application/json - permissions: public-read - preserve_path: true - - link-to-storybook: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - echo "#############################################" - echo "Link to Storybook: https://mciuploads.s3.amazonaws.com/parsley/${task_id}/storybook/parsley/storybook-static/index.html" - echo "#############################################" - - attach-source-map: - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_file: "parsley/build/source_map.html" - remote_file: parsley/${task_id}/source_map.html - bucket: mciuploads - content_type: text/html - permissions: public-read - display_name: source_map - - get-project: - command: git.get_project - type: setup - params: - directory: parsley - - send-email: - command: shell.exec - params: - working_dir: parsley - shell: bash - env: - AUTHOR_EMAIL: ${author_email} - DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} - EXECUTION: ${execution} - script: | - bash scripts/email.sh - - parsley-setup-credentials: - command: shell.exec - params: - working_dir: parsley - shell: bash - env: - PARSLEY_SENTRY_AUTH_TOKEN: ${PARSLEY_SENTRY_AUTH_TOKEN} - REACT_APP_PARSLEY_SENTRY_DSN: ${REACT_APP_PARSLEY_SENTRY_DSN} - NEW_RELIC_ACCOUNT_ID: ${NEW_RELIC_ACCOUNT_ID} - NEW_RELIC_LICENSE_KEY: ${NEW_RELIC_LICENSE_KEY} - NEW_RELIC_TRUST_KEY: ${NEW_RELIC_TRUST_KEY} - PARSLEY_NEW_RELIC_AGENT_ID: ${PARSLEY_NEW_RELIC_AGENT_ID} - PARSLEY_NEW_RELIC_APPLICATION_ID: ${PARSLEY_NEW_RELIC_APPLICATION_ID} - DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} - BUCKET: ${parsley_bucket} - EVERGREEN_API_SERVER_HOST: ${evergreen_api_server_host} - EVERGREEN_UI_SERVER_HOST: ${evergreen_ui_server_host} - EVERGREEN_API_KEY: ${evergreen_api_key} - EVERGREEN_USER: ${evergreen_user} - script: | - echo "Generating .env-cmdrc.json" - node scripts/setup-credentials.js - - echo "populating evergreen.yml" - chmod +x ./scripts/create-evergreen-yml.sh - ./scripts/create-evergreen-yml.sh - echo "Done populating evergreen.yml" - - setup-node: - - command: subprocess.exec - params: - binary: bash - args: - - parsley/scripts/prepare-shell.sh - - command: expansions.update - params: - file: expansion.yml - - command: shell.exec - params: - shell: bash - script: | - ${PREPARE_SHELL} - - # Fetch NVM and install it into this task's .nvm directory - # Once downloaded, source nvm and install yarn - git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR" - cd "$NVM_DIR" - git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)` - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - cd - - - # Retry the download for Node in case it flakes. - for i in {1..5}; do - nvm install --no-progress --default ${node_version} - [[ $? -eq 0 ]] && break - echo "Attempt $i of 5 to install Node failed" - sleep 10 - done - npm install -g yarn - - sym-link: - command: subprocess.exec - params: - working_dir: parsley - command: ln -s evergreen/graphql/schema sdlschema - - yarn-build: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn build:local - - yarn-codegen: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - chmod +x ./scripts/check_codegen.sh - ./scripts/check_codegen.sh - - yarn-cypress: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - # Allow spec filtering for an intentional patch. - if [[ "${requester}" == "patch" ]]; then - yarn cy:run --reporter junit --spec "${cypress_spec}" - else - yarn cy:run --reporter junit - fi - - - yarn-eslint: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn eslint:strict - - yarn-install: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn install - - yarn-preview: - command: shell.exec - params: - working_dir: parsley - background: true - shell: bash - script: | - ${PREPARE_SHELL} - yarn preview - - yarn-snapshot: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn test --ci --testPathPattern=snapshot.test.ts - - yarn-storybook: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn storybook:build - - yarn-test: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn test --ci --testPathIgnorePatterns=snapshot.test.ts - - yarn-tsc: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn check-types - - yarn-verify-backend: - command: shell.exec - params: - working_dir: parsley - shell: bash - script: | - ${PREPARE_SHELL} - yarn verify-backend - - prod-deploy: - command: shell.exec - params: - working_dir: parsley - shell: bash - env: - BUCKET: ${parsley_bucket} - AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} - AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN} - EXECUTION: ${execution} - DEPLOYS_EMAIL: ${DEPLOYS_EMAIL} - AUTHOR_EMAIL: ${author_email} - script: | - ${PREPARE_SHELL} - yarn deploy:prod - -####################################### -# Local Evergreen Functions # -####################################### - setup-mongodb: - - command: subprocess.exec - type: setup - params: - env: - gobin: ${goroot}/bin/go - MONGODB_URL: ${mongodb_url_70} - MONGODB_DECOMPRESS: ${decompress} - working_dir: parsley/evergreen - command: make get-mongodb - - command: subprocess.exec - type: setup - params: - env: - gobin: ${goroot}/bin/go - MONGOSH_URL: ${mongosh_url} - MONGOSH_DECOMPRESS: ${decompress} - working_dir: parsley/evergreen - command: make get-mongosh - - command: subprocess.exec - type: setup - params: - background: true - working_dir: parsley/evergreen - command: make start-mongod - - command: subprocess.exec - type: setup - params: - working_dir: parsley/evergreen - command: make configure-mongod - - run-make-background: - command: subprocess.exec - params: - working_dir: parsley/evergreen - binary: make - args: ["${make_args|}", "${target}"] - background: true - env: - SETTINGS_OVERRIDE: file - GOROOT: ${goroot} - - wait-for-evergreen: - command: shell.exec - type: setup - exec_timeout_secs: 600 - params: - working_dir: parsley - shell: bash - script: ./scripts/wait-for-evergreen.sh - - -####################################### -# Local Logkeeper Functions # -####################################### - run-logkeeper: - command: shell.exec - params: - working_dir: parsley/logkeeper - background: true - script: go run main/logkeeper.go --localPath _bucketdata - shell: bash - env: - GOROOT: ${goroot} - PATH: ${goroot}/bin:$PATH - LK_CORS_ORIGINS: http:\/\/localhost:\d+ - - attach-logkeeper-logs: - command: s3.put - type: system - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - local_file: parsley/logkeeper/logkeeperapp.log - remote_file: parsley/${task_id}/${execution}/logkeeperapp.log - bucket: mciuploads - content_type: text/plain - permissions: public-read - - seed-logkeeper: - command: s3.get - type: setup - params: - aws_key: ${AWS_ACCESS_KEY_ID} - aws_secret: ${AWS_SECRET_ACCESS_KEY} - aws_session_token: ${AWS_SESSION_TOKEN} - extract_to: parsley/logkeeper - remote_file: _bucketdata.tar.gz - bucket: parsley-test - working_dir: parsley/logkeeper - -####################################### -# Tasks # -####################################### -tasks: - - name: compile - commands: - - func: assume-ec2-role - - func: yarn-build - - func: attach-source-map - - - name: type_check - commands: - - func: yarn-tsc - - - name: lint - commands: - - func: sym-link - - func: yarn-eslint - - - name: test - commands: - - func: yarn-test - - - name: e2e_test - commands: - - func: assume-ec2-role - - func: setup-mongodb - - func: run-make-background - vars: - target: local-evergreen - - func: seed-logkeeper - - func: run-logkeeper - - func: yarn-install - - func: yarn-build - - func: yarn-preview - - func: wait-for-evergreen - - func: yarn-verify-backend - - func: yarn-cypress - - - name: storybook - commands: - - func: assume-ec2-role - - func: yarn-storybook - - func: attach-storybook - - func: link-to-storybook - - - name: snapshots - commands: - - func: yarn-snapshot - - - name: check_codegen - commands: - - func: assume-ec2-role - - func: sym-link - - func: yarn-codegen - - - name: deploy-prod - commands: - - func: assume-ec2-role - - func: parsley-setup-credentials - - func: sym-link - - func: prod-deploy - -buildvariants: - - name: ubuntu2204-small - display_name: Ubuntu 22.04 (small) - expansions: - goroot: /opt/golang/go1.20 - mongodb_url_70: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.2.tgz - mongosh_url: https://downloads.mongodb.com/compass/mongosh-2.0.2-linux-x64.tgz - node_version: 20.10.0 - run_on: - - ubuntu2204-small - modules: - - evergreen - tasks: - - name: type_check - - name: lint - - name: test - - name: snapshots - - name: check_codegen - - - name: ubuntu2204-large - display_name: Ubuntu 22.04 (large) - expansions: - goroot: /opt/golang/go1.20 - mongodb_url_70: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.2.tgz - mongosh_url: https://downloads.mongodb.com/compass/mongosh-2.0.2-linux-x64.tgz - node_version: 20.10.0 - run_on: - - ubuntu2204-large - modules: - - evergreen - - logkeeper - tasks: - - name: e2e_test - - name: compile - - name: storybook - - name: deploy-prod - git_tag_only: true - patchable: false - priority: 100 - -pre: - - func: get-project - - func: setup-node - - func: yarn-install - -post: - - func: attach-cypress - - func: attach-logkeeper-logs - - func: attach-test-results - - func: attach-codegen-diff - -parameters: - - key: cypress_spec - value: cypress/integration/**/* - description: Specify the Cypress spec files to run for user submitted patches running the e2e_test task. diff --git a/apps/parsley/cypress/support/commands.ts b/apps/parsley/cypress/support/commands.ts index 514677a51..167c0c1c0 100644 --- a/apps/parsley/cypress/support/commands.ts +++ b/apps/parsley/cypress/support/commands.ts @@ -7,6 +7,11 @@ const user = { const toastDataCy = "toast"; Cypress.Commands.add("addFilter", (filter: string) => { + cy.dataCy("searchbar-select").should( + "not.have.attr", + "aria-disabled", + "true", + ); cy.dataCy("searchbar-select").click(); cy.dataCy("filter-option").click(); cy.dataCy("searchbar-input") @@ -16,6 +21,11 @@ Cypress.Commands.add("addFilter", (filter: string) => { }); Cypress.Commands.add("addHighlight", (highlight: string) => { + cy.dataCy("searchbar-select").should( + "not.have.attr", + "aria-disabled", + "true", + ); cy.dataCy("searchbar-select").click(); cy.dataCy("highlight-option").click(); cy.dataCy("searchbar-input") diff --git a/apps/parsley/jest.config.js b/apps/parsley/jest.config.js index 0f92b532e..a5978e117 100644 --- a/apps/parsley/jest.config.js +++ b/apps/parsley/jest.config.js @@ -17,7 +17,6 @@ module.exports = { snapshotSerializers: ["@emotion/jest/serializer"], testEnvironment: "jsdom", testMatch: ["/{src,scripts}/**/*.{spec,test}.{js,jsx,ts,tsx}"], - testRunner: "/node_modules/jest-circus/runner.js", transform: { "^.+\\.graphql$": "@graphql-tools/jest-transform", "^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "ts-jest", diff --git a/apps/parsley/scripts/check_codegen.sh b/apps/parsley/scripts/check_codegen.sh old mode 100644 new mode 100755 diff --git a/apps/parsley/src/components/Search/SearchBar/SearchBar.test.tsx b/apps/parsley/src/components/Search/SearchBar/SearchBar.test.tsx index c23c7c0ff..4ccc1e346 100644 --- a/apps/parsley/src/components/Search/SearchBar/SearchBar.test.tsx +++ b/apps/parsley/src/components/Search/SearchBar/SearchBar.test.tsx @@ -9,7 +9,10 @@ describe("searchbar", () => { it("disables properly", () => { render(); - expect(screen.getByDataCy("searchbar-select")).toBeDisabled(); + expect(screen.getByDataCy("searchbar-select")).toHaveAttribute( + "aria-disabled", + "true", + ); expect(screen.getByDataCy("searchbar-input")).toBeDisabled(); }); it("should be able to paginate forwards by pressing Enter and keep focus", async () => { diff --git a/apps/parsley/src/components/Search/SearchBar/__snapshots__/SearchBar.stories.storyshot b/apps/parsley/src/components/Search/SearchBar/__snapshots__/SearchBar.stories.storyshot index e3ec8acfc..7a735fd28 100644 --- a/apps/parsley/src/components/Search/SearchBar/__snapshots__/SearchBar.stories.storyshot +++ b/apps/parsley/src/components/Search/SearchBar/__snapshots__/SearchBar.stories.storyshot @@ -6,19 +6,19 @@ exports[`Snapshot Tests SearchBar.stories Default 1`] = ` class="css-14zx4vh" >