From eb84dce6cae8c3e4c1bb7bf0d57124938f77e95a Mon Sep 17 00:00:00 2001 From: Sem Bauke Date: Fri, 14 Jun 2024 19:09:40 +0200 Subject: [PATCH] chore: remove Cypress (#55056) --- .devcontainer/Dockerfile | 33 +- .eslintrc.json | 8 - .github/labeler.yml | 1 - .github/workflows/e2e-web.yml | 157 -------- .gitignore | 4 - .gitpod.yml | 5 +- client/src/assets/icons/freecodecamp.tsx | 1 - client/src/assets/icons/microsoft-logo.tsx | 1 - .../client-only-routes/show-certification.tsx | 8 +- .../client-only-routes/show-project-links.tsx | 2 +- .../Donation/donation-text-components.tsx | 14 +- .../Donation/multi-tier-donation-form.tsx | 1 - .../components/Donation/stripe-card-form.tsx | 1 - .../SolutionViewer/project-modal.tsx | 7 +- .../search/searchBar/search-bar-optimized.tsx | 3 +- .../search/searchBar/search-hits.tsx | 6 +- client/src/components/settings/email.tsx | 3 - client/src/components/settings/portfolio.tsx | 1 - client/src/components/settings/privacy.tsx | 1 - client/src/components/settings/username.tsx | 6 +- client/src/pages/email-sign-up.tsx | 2 +- .../Challenges/classic/editor-tabs.tsx | 1 - .../Challenges/classic/lower-jaw.tsx | 4 - .../Challenges/classic/multifile-editor.tsx | 1 - .../components/completion-modal.tsx | 1 - .../Challenges/components/output.tsx | 1 - .../Challenges/components/reset-modal.tsx | 1 - .../Challenges/components/tool-panel.tsx | 7 +- .../exam/components/exam-results.tsx | 1 - .../exam/components/exit-exam-modal.tsx | 14 +- .../exam/components/finish-exam-modal.tsx | 2 - .../foundational-c-sharp-survey-alert.tsx | 1 - .../foundational-c-sharp-survey.tsx | 1 - client/src/templates/Challenges/exam/show.tsx | 12 +- .../Introduction/components/block.tsx | 1 - cypress-install.js | 15 - cypress-install.sh | 53 --- cypress.config.js | 60 --- .../learn/common-components/search-bar.ts | 100 ----- cypress/fixtures/example.json | 5 - cypress/plugins/index.js | 32 -- cypress/support/commands.ts | 78 ---- cypress/support/e2e.ts | 40 -- cypress/support/selectors.ts | 10 - cypress/tsconfig.json | 9 - knip.jsonc | 11 +- package.json | 18 +- pnpm-lock.yaml | 360 ++---------------- .../build-external-curricula-data.test.ts | 2 + tools/scripts/build/package.json | 1 + tsconfig-base.json | 2 +- 51 files changed, 67 insertions(+), 1042 deletions(-) delete mode 100644 .github/workflows/e2e-web.yml delete mode 100644 cypress-install.js delete mode 100644 cypress-install.sh delete mode 100644 cypress.config.js delete mode 100644 cypress/e2e/default/learn/common-components/search-bar.ts delete mode 100644 cypress/fixtures/example.json delete mode 100644 cypress/plugins/index.js delete mode 100644 cypress/support/commands.ts delete mode 100644 cypress/support/e2e.ts delete mode 100644 cypress/support/selectors.ts delete mode 100644 cypress/tsconfig.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5695f1053e2a72..c9c0024297bf51 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -7,29 +7,28 @@ ARG MONGODB_VERSION=6.0.4 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y sudo && \ - sudo apt-get install -y ca-certificates curl gnupg && \ - sudo mkdir -p /etc/apt/keyrings && \ - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && \ - sudo apt-get update && \ - sudo apt-get install nodejs -y && \ - sudo apt-get install -y libcurl4 openssl liblzma5 && \ - mkdir -p /tmp/mongodb && \ - cd /tmp/mongodb && \ - wget -qOmongodb.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-${MONGODB_VERSION}.tgz && \ - tar -zxvf mongodb.tgz && \ - cd mongodb-* && \ - sudo cp bin/* /usr/local/bin/ && \ - rm -rf /tmp/mongodb && \ - sudo mkdir -p /data/db && \ - sudo chown vscode:vscode -R /data/db + sudo apt-get install -y ca-certificates curl gnupg && \ + sudo mkdir -p /etc/apt/keyrings && \ + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && \ + sudo apt-get update && \ + sudo apt-get install nodejs -y && \ + sudo apt-get install -y libcurl4 openssl liblzma5 && \ + mkdir -p /tmp/mongodb && \ + cd /tmp/mongodb && \ + wget -qOmongodb.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-${MONGODB_VERSION}.tgz && \ + tar -zxvf mongodb.tgz && \ + cd mongodb-* && \ + sudo cp bin/* /usr/local/bin/ && \ + rm -rf /tmp/mongodb && \ + sudo mkdir -p /data/db && \ + sudo chown vscode:vscode -R /data/db # Setup ENV ENV COOKIE_DOMAIN=github.dev ENV HOME_LOCATION=https://$CODESPACE_NAME-8000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN ENV API_LOCATION=https://$CODESPACE_NAME-3000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN -ENV CYPRESS_BASE_URL=https://$CODESPACE_NAME-8000.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN ENV REACT_APP_CHALLENGE_EDITOR_API_LOCATION=https://$CODESPACE_NAME-3200.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN ENV CHALLENGE_EDITOR_CLIENT_LOCATION=https://$CODESPACE_NAME-3300.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN diff --git a/.eslintrc.json b/.eslintrc.json index 370a74ef275141..d174aae33def25 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -70,7 +70,6 @@ "./api/tsconfig.json", "./shared/tsconfig.json", "./tools/client-plugins/browser-scripts/tsconfig.json", - "./cypress/tsconfig.json", "./e2e/tsconfig.json" ] }, @@ -94,13 +93,6 @@ ], "rules": { "import/named": 2 } }, - { - "files": ["cypress/**/*.js"], - "globals": { - "cy": true, - "Cypress": true - } - }, { "files": ["e2e/*.ts"], "rules": { diff --git a/.github/labeler.yml b/.github/labeler.yml index 5982311ae3d8cd..0e7b0ccc9fec08 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -12,7 +12,6 @@ - api/**/* 'scope: tools/scripts': - - cypress/**/* - tools/**/* - .github/**/* - utils/**/* diff --git a/.github/workflows/e2e-web.yml b/.github/workflows/e2e-web.yml deleted file mode 100644 index bb805d4863668b..00000000000000 --- a/.github/workflows/e2e-web.yml +++ /dev/null @@ -1,157 +0,0 @@ -name: CI - E2E - Web browser -on: - workflow_dispatch: - workflow_run: - workflows: ['CI - Node.js'] - types: - - completed - # TODO: refactor with a workflow_call - pull_request: - paths-ignore: - - 'docs/**' - branches: - - 'main' - - 'next-**' - - 'e2e-**' - -jobs: - build-client: - name: Build Client - runs-on: ubuntu-22.04 - strategy: - matrix: - node-version: [20.x] - - steps: - - name: Checkout Source Files - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Checkout client-config - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: freeCodeCamp/client-config - path: client-config - - - name: Setup pnpm - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0 - with: - version: 9 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: ${{ matrix.node-version }} - cache: pnpm - - - name: Set freeCodeCamp Environment Variables - run: cp sample.env .env - - - name: Install and Build - run: | - pnpm install - pnpm run build - - - name: Move serve.json to Public Folder - run: cp client-config/serve.json client/public/serve.json - - # We tar them for performance reasons - uploading a lot of files is slow. - - name: Tar Files - run: tar -cf client-artifact.tar client/public - - - name: Upload Client Artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: client-artifact - path: client-artifact.tar - - - name: Upload Webpack Stats - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: webpack-stats - path: client/public/stats.json - - cypress-run: - name: Test - runs-on: ubuntu-22.04 - needs: build-client - strategy: - fail-fast: false - matrix: - browsers: [chrome, firefox] - node-version: [20.x] - services: - mongodb: - image: mongo:4.4 - ports: - - 27017:27017 - # We need mailhog to catch any emails the api tries to send. - mailhog: - image: mailhog/mailhog - ports: - - 1025:1025 - - steps: - - name: Set Action Environment Variables - run: | - echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - - - name: Checkout Source Files - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - name: client-artifact - - - name: Unpack Client Artifact - run: | - tar -xf client-artifact.tar - rm client-artifact.tar - - - name: Downgrade Firefox - run: | - curl https://ftp.mozilla.org/pub/firefox/releases/123.0/linux-x86_64/en-US/firefox-123.0.tar.bz2 --output firefox-123.0.tar.bz2 - tar -xjf firefox-123.0.tar.bz2 - sudo mv firefox /opt/ - sudo mv /usr/bin/firefox /usr/bin/firefox_old - sudo ln -s /opt/firefox/firefox /usr/bin/firefox - - - name: Setup pnpm - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0 - with: - version: 9 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: ${{ matrix.node-version }} - # cypress-io/github-action caches the store, so we should not cache it - # here. - - - name: Set freeCodeCamp Environment Variables - run: cp sample.env .env - - - name: Install and Build - run: | - pnpm install - pnpm run create:shared - pnpm run build:curriculum - pnpm run build:server - - - name: Seed Database - run: pnpm run seed - - # start-ci uses pm2, so it needs to be installed globally - - name: Install pm2 - run: npm i -g pm2 - - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - record: ${{ env.CYPRESS_RECORD_KEY != 0 }} - start: pnpm run start-ci - wait-on: http://localhost:8000 - wait-on-timeout: 1200 - config: baseUrl=http://localhost:8000 - browser: ${{ matrix.browsers }} - spec: ${{ matrix.spec }} diff --git a/.gitignore b/.gitignore index 8593e094881ba9..b06e156451f12d 100644 --- a/.gitignore +++ b/.gitignore @@ -111,10 +111,6 @@ coverage # nyc test coverage .nyc_output -# Cypress.io -cypress/videos -cypress/screenshots - # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt diff --git a/.gitpod.yml b/.gitpod.yml index 79e288b9d0cb4b..4b51ff7bfc8437 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -26,7 +26,6 @@ tasks: export COOKIE_DOMAIN=gitpod.io export HOME_LOCATION=$(gp url 8000) export API_LOCATION=$(gp url 3000) - export CYPRESS_BASE_URL=$(gp url 8000) export CHALLENGE_EDITOR_API_LOCATION=$(gp url 3200) export CHALLENGE_EDITOR_CLIENT_LOCATION=$(gp url 3300) ' >> ~/.bashrc; @@ -39,7 +38,7 @@ tasks: (mongod --dbpath /workspace/data &) - name: server - before: export COOKIE_DOMAIN=gitpod.io && export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) && export CYPRESS_BASE_URL=$(gp url 8000) + before: export COOKIE_DOMAIN=gitpod.io && export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) # init is not executed for prebuilt workspaces and restarts, # so we should put all the heavy initialization here init: > @@ -55,7 +54,7 @@ tasks: pnpm run develop:server - name: client - before: export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) && export CYPRESS_BASE_URL=$(gp url 8000) + before: export HOME_LOCATION=$(gp url 8000) && export API_LOCATION=$(gp url 3000) init: > cd ./client && gp sync-await pnpm-install && diff --git a/client/src/assets/icons/freecodecamp.tsx b/client/src/assets/icons/freecodecamp.tsx index 6bd143c84ece95..1e1a28f8321dfd 100644 --- a/client/src/assets/icons/freecodecamp.tsx +++ b/client/src/assets/icons/freecodecamp.tsx @@ -5,7 +5,6 @@ function FreeCodeCampLogo( ): JSX.Element { return ( { }} -

+

{{ time: certDate.toLocaleString([localeCode, 'en-US'], { year: 'numeric', @@ -414,7 +411,6 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => { <>
Quincy Larson's Signature {
Julia Liusons's Signature { ) : (
Quincy Larson's Signature { if (!isCertName(certName)) return
Unknown Certification
; return ( -
+
{t(getCertHeading(certName), { user: name })} diff --git a/client/src/components/Donation/donation-text-components.tsx b/client/src/components/Donation/donation-text-components.tsx index 79fbb0772340ab..b36f93c4b30b31 100644 --- a/client/src/components/Donation/donation-text-components.tsx +++ b/client/src/components/Donation/donation-text-components.tsx @@ -43,15 +43,11 @@ export const ThankYouMessage = ({ const { t } = useTranslation(); return ( <> -

- {t('donate.thank-you')} -

+

{t('donate.thank-you')}

{(askForDonation || thankContributon) && ( <> -

- {t('donate.crucial-contribution')} -

+

{t('donate.crucial-contribution')}

)} {askForDonation && } @@ -63,13 +59,11 @@ export const OtherWaysToSupport = (): JSX.Element => { const { t } = useTranslation(); return ( <> -

+

placeholder placeholder - - placeholder - + placeholder

diff --git a/client/src/components/Donation/multi-tier-donation-form.tsx b/client/src/components/Donation/multi-tier-donation-form.tsx index f3dd6fcbd5ae35..8126c36cd11afd 100644 --- a/client/src/components/Donation/multi-tier-donation-form.tsx +++ b/client/src/components/Donation/multi-tier-donation-form.tsx @@ -97,7 +97,6 @@ function SelectionTabs({ + ); diff --git a/client/src/components/search/searchBar/search-bar-optimized.tsx b/client/src/components/search/searchBar/search-bar-optimized.tsx index 806113393ae1d0..511c3fd26cac0d 100644 --- a/client/src/components/search/searchBar/search-bar-optimized.tsx +++ b/client/src/components/search/searchBar/search-bar-optimized.tsx @@ -32,11 +32,10 @@ const SearchBarOptimized = ({ return (
-
+
diff --git a/client/src/components/search/searchBar/search-hits.tsx b/client/src/components/search/searchBar/search-hits.tsx index da2413206ab124..bbf1fe8e4afc0a 100644 --- a/client/src/components/search/searchBar/search-hits.tsx +++ b/client/src/components/search/searchBar/search-hits.tsx @@ -63,11 +63,7 @@ const CustomHits = connectHits( return (
-
    +
      {allHits.map((hit: Hit, i: number) => (
    • e.preventDefault() })} @@ -206,7 +205,6 @@ function EmailSettings({ {t('settings.email.new')} {

      {t('settings.share-projects')}

{t('misc.email-blast')}

diff --git a/client/src/templates/Challenges/classic/editor-tabs.tsx b/client/src/templates/Challenges/classic/editor-tabs.tsx index 33757b55ee2117..6af10cff96225d 100644 --- a/client/src/templates/Challenges/classic/editor-tabs.tsx +++ b/client/src/templates/Challenges/classic/editor-tabs.tsx @@ -50,7 +50,6 @@ class EditorTabs extends Component { visibleEditors[challengeFile.fileKey] ?? 'false' } key={challengeFile.fileKey} - data-cy={`editor-tab-${challengeFile.fileKey}`} onClick={() => toggleVisibleEditor(challengeFile.fileKey)} > {`${challengeFile.name}.${challengeFile.ext}`}{' '} diff --git a/client/src/templates/Challenges/classic/lower-jaw.tsx b/client/src/templates/Challenges/classic/lower-jaw.tsx index a21135df5d14f6..c12b02b59eab7d 100644 --- a/client/src/templates/Challenges/classic/lower-jaw.tsx +++ b/client/src/templates/Challenges/classic/lower-jaw.tsx @@ -100,7 +100,6 @@ const LowerButtonsPanel = ({ diff --git a/client/src/templates/Challenges/exam/components/exam-results.tsx b/client/src/templates/Challenges/exam/components/exam-results.tsx index d093b624533a22..fad11faf158910 100644 --- a/client/src/templates/Challenges/exam/components/exam-results.tsx +++ b/client/src/templates/Challenges/exam/components/exam-results.tsx @@ -109,7 +109,6 @@ ${t('learn.exam.time', { t: formatSecondsToTime(examTimeInSeconds) })} - diff --git a/client/src/templates/Challenges/exam/components/finish-exam-modal.tsx b/client/src/templates/Challenges/exam/components/finish-exam-modal.tsx index 45804b3f100d9b..0e5b6ed844cad4 100644 --- a/client/src/templates/Challenges/exam/components/finish-exam-modal.tsx +++ b/client/src/templates/Challenges/exam/components/finish-exam-modal.tsx @@ -52,7 +52,6 @@ function FinishExamModal({