diff --git a/.github/workflows/cypress-push.yml b/.github/workflows/cypress-push.yml deleted file mode 100644 index 75d5988358..0000000000 --- a/.github/workflows/cypress-push.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Cypress - Push -on: - push: - branches-ignore: - - 'renovate/**' - -jobs: - cypress-run: - name: Test - runs-on: ubuntu-18.04 - strategy: - fail-fast: false - matrix: - containers: [1, 2, 3, 4, 5, 6] - browsers: [chrome, firefox] - node-version: [14.x] - services: - mongodb: - image: mongo:3.6.19 - ports: - - 27017:27017 - mailhog: - image: mailhog/mailhog - ports: - - 1025:1025 - - steps: - # We use .npmrc to set the default version to 0, and prevents download during development. - # This installs it specifically in the CI runs. - - name: Set Action Environment Variables - run: | - echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV - echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - echo "CYPRESS_INSTALL_BINARY=7.1.0" >> $GITHUB_ENV - - - name: Checkout Source Files - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set freeCodeCamp Environment Variables - run: cp sample.env .env - - - name: Install Dependencies - run: | - npm ci - npm run ensure-env - npm run build:curriculum - - - name: Seed Database - run: npm run seed - - - name: Generate fixture data - run: npm run precypress:gen:fixtures - - - name: Generate Specfiles for challenges - run: npm run precypress:gen:test - - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - parallel: ${{ env.CYPRESS_RECORD_KEY != 0 }} - group: ${{ matrix.browsers }} - record: ${{ env.CYPRESS_RECORD_KEY != 0 }} - build: npm run build - # this should mirror the production build, but for now we're using gatsby - # serve instead (the npm script serve:client needs updating!) - start: npm run start-ci - wait-on: http://localhost:8000 - # the site builds in about 8 minutes, so there is currently 12 minutes of time - # left for testing. - wait-on-timeout: 1200 - config: baseUrl=http://localhost:8000 - browser: ${{ matrix.browsers }} - headless: true diff --git a/.github/workflows/cypress-pull.yml b/.github/workflows/cypress.yml similarity index 97% rename from .github/workflows/cypress-pull.yml rename to .github/workflows/cypress.yml index 6c3986b719..9a1b48232e 100644 --- a/.github/workflows/cypress-pull.yml +++ b/.github/workflows/cypress.yml @@ -1,5 +1,8 @@ -name: Cypress - Pull-request +name: Cypress on: + push: + branches-ignore: + - 'renovate/**' pull_request: jobs: diff --git a/.gitignore b/.gitignore index e84540e57d..27070638e8 100644 --- a/.gitignore +++ b/.gitignore @@ -116,10 +116,6 @@ coverage cypress/videos cypress/screenshots -### Cypress generated fixtures and tests ### -cypress/fixtures/path-data -cypress/integration/challenge-tests/blocks - # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt @@ -183,4 +179,3 @@ api-server/lib/* curriculum/dist curriculum/build client/static/_redirects - diff --git a/cypress.json b/cypress.json index 5f604d630f..b88626651a 100644 --- a/cypress.json +++ b/cypress.json @@ -1,6 +1,5 @@ { "projectId": "ke77ns", "baseUrl": "http://localhost:8000", - "retries": 4, - "videoUploadOnPasses": false + "retries": 4 } diff --git a/cypress/integration/main-tests/ShowCertification.js b/cypress/integration/ShowCertification.js similarity index 100% rename from cypress/integration/main-tests/ShowCertification.js rename to cypress/integration/ShowCertification.js diff --git a/cypress/integration/challenge-tests/blocks/.gitkeep b/cypress/integration/challenge-tests/blocks/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cypress/integration/main-tests/landing.js b/cypress/integration/landing.js similarity index 100% rename from cypress/integration/main-tests/landing.js rename to cypress/integration/landing.js diff --git a/cypress/integration/main-tests/learn/challenges/backend.js b/cypress/integration/learn/challenges/backend.js similarity index 100% rename from cypress/integration/main-tests/learn/challenges/backend.js rename to cypress/integration/learn/challenges/backend.js diff --git a/cypress/integration/main-tests/learn/challenges/output.js b/cypress/integration/learn/challenges/output.js similarity index 100% rename from cypress/integration/main-tests/learn/challenges/output.js rename to cypress/integration/learn/challenges/output.js diff --git a/cypress/integration/main-tests/learn/challenges/projects.js b/cypress/integration/learn/challenges/projects.js similarity index 100% rename from cypress/integration/main-tests/learn/challenges/projects.js rename to cypress/integration/learn/challenges/projects.js diff --git a/cypress/integration/main-tests/learn/coding-interview-prep/intro-page.js b/cypress/integration/learn/coding-interview-prep/intro-page.js similarity index 100% rename from cypress/integration/main-tests/learn/coding-interview-prep/intro-page.js rename to cypress/integration/learn/coding-interview-prep/intro-page.js diff --git a/cypress/integration/main-tests/learn/common-components/footer.js b/cypress/integration/learn/common-components/footer.js similarity index 100% rename from cypress/integration/main-tests/learn/common-components/footer.js rename to cypress/integration/learn/common-components/footer.js diff --git a/cypress/integration/main-tests/learn/common-components/helpButton.js b/cypress/integration/learn/common-components/helpButton.js similarity index 100% rename from cypress/integration/main-tests/learn/common-components/helpButton.js rename to cypress/integration/learn/common-components/helpButton.js diff --git a/cypress/integration/main-tests/learn/common-components/navbar.js b/cypress/integration/learn/common-components/navbar.js similarity index 100% rename from cypress/integration/main-tests/learn/common-components/navbar.js rename to cypress/integration/learn/common-components/navbar.js diff --git a/cypress/integration/main-tests/learn/common-components/searchBar.js b/cypress/integration/learn/common-components/searchBar.js similarity index 100% rename from cypress/integration/main-tests/learn/common-components/searchBar.js rename to cypress/integration/learn/common-components/searchBar.js diff --git a/cypress/integration/main-tests/learn/donate/donate-page-default.js b/cypress/integration/learn/donate/donate-page-default.js similarity index 100% rename from cypress/integration/main-tests/learn/donate/donate-page-default.js rename to cypress/integration/learn/donate/donate-page-default.js diff --git a/cypress/integration/main-tests/learn/donate/donate-page-donor.js b/cypress/integration/learn/donate/donate-page-donor.js similarity index 100% rename from cypress/integration/main-tests/learn/donate/donate-page-donor.js rename to cypress/integration/learn/donate/donate-page-donor.js diff --git a/cypress/integration/main-tests/learn/donate/donation-block-completion-modal.js b/cypress/integration/learn/donate/donation-block-completion-modal.js similarity index 100% rename from cypress/integration/main-tests/learn/donate/donation-block-completion-modal.js rename to cypress/integration/learn/donate/donation-block-completion-modal.js diff --git a/cypress/integration/main-tests/learn/index.js b/cypress/integration/learn/index.js similarity index 100% rename from cypress/integration/main-tests/learn/index.js rename to cypress/integration/learn/index.js diff --git a/cypress/integration/main-tests/learn/redirects/challenges.js b/cypress/integration/learn/redirects/challenges.js similarity index 100% rename from cypress/integration/main-tests/learn/redirects/challenges.js rename to cypress/integration/learn/redirects/challenges.js diff --git a/cypress/integration/main-tests/learn/responsive-web-design/basic-css/index.js b/cypress/integration/learn/responsive-web-design/basic-css/index.js similarity index 100% rename from cypress/integration/main-tests/learn/responsive-web-design/basic-css/index.js rename to cypress/integration/learn/responsive-web-design/basic-css/index.js diff --git a/cypress/integration/main-tests/learn/responsive-web-design/intro-page.js b/cypress/integration/learn/responsive-web-design/intro-page.js similarity index 100% rename from cypress/integration/main-tests/learn/responsive-web-design/intro-page.js rename to cypress/integration/learn/responsive-web-design/intro-page.js diff --git a/cypress/integration/main-tests/settings/certifications.js b/cypress/integration/settings/certifications.js similarity index 100% rename from cypress/integration/main-tests/settings/certifications.js rename to cypress/integration/settings/certifications.js diff --git a/cypress/integration/main-tests/settings/email-change.js b/cypress/integration/settings/email-change.js similarity index 100% rename from cypress/integration/main-tests/settings/email-change.js rename to cypress/integration/settings/email-change.js diff --git a/cypress/integration/main-tests/settings/image-picture-check.js b/cypress/integration/settings/image-picture-check.js similarity index 100% rename from cypress/integration/main-tests/settings/image-picture-check.js rename to cypress/integration/settings/image-picture-check.js diff --git a/cypress/integration/main-tests/settings/settings.js b/cypress/integration/settings/settings.js similarity index 100% rename from cypress/integration/main-tests/settings/settings.js rename to cypress/integration/settings/settings.js diff --git a/cypress/integration/main-tests/settings/username-change.js b/cypress/integration/settings/username-change.js similarity index 100% rename from cypress/integration/main-tests/settings/username-change.js rename to cypress/integration/settings/username-change.js diff --git a/cypress/integration/main-tests/tags.js b/cypress/integration/tags.js similarity index 100% rename from cypress/integration/main-tests/tags.js rename to cypress/integration/tags.js diff --git a/cypress/integration/main-tests/top-contributor.js b/cypress/integration/top-contributor.js similarity index 100% rename from cypress/integration/main-tests/top-contributor.js rename to cypress/integration/top-contributor.js diff --git a/cypress/integration/main-tests/user/report-user.js b/cypress/integration/user/report-user.js similarity index 100% rename from cypress/integration/main-tests/user/report-user.js rename to cypress/integration/user/report-user.js diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 5247fc56a4..6b713888e4 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,5 +1,17 @@ -/* eslint-disable no-unused-vars */ +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** -module.exports = function (on, config) { - // configure plugins here +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) +/* eslint-disable no-unused-vars */ +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config }; diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 3ff47e13d2..c7e31a4757 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1,4 +1,37 @@ -/* global cy Cypress */ +/* global cy Cypress*/ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => {}); +// +// +// -- This is a child command -- +// Cypress.Commands.add( +// 'drag', +// { prevSubject: 'element' }, +// (subject, options) => {} +// ); +// +// +// -- This is a dual command -- +// Cypress.Commands.add( +// 'dismiss', +// { prevSubject: 'optional' }, +// (subject, options) => {} +// ); +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => {}); Cypress.Commands.add('login', () => { cy.visit('/'); @@ -19,50 +52,3 @@ Cypress.Commands.add('resetUsername', () => { cy.contains('Account Settings for developmentuser').should('be.visible'); }); - -Cypress.Commands.add('testChallenges', () => { - // Test Meta tags - cy.get('head meta[charset=utf-8]'); - cy.get('head meta[name=description]').should('have.attr', 'content'); - - // Test breadcrumbs - cy.get('.breadcrumb-right').should('have.attr', 'href'); - cy.get('.ellipsis').should('be.visible'); - cy.get('.breadcrumb-left').should('have.attr', 'href'); - cy.get('.breadcrumb-left').should('be.visible', 'href'); - - cy.get('body').should('be.visible'); - - // Challenge content - cy.get('.challenge-title').should('be.visible'); - cy.get('#description').should('be.visible'); - - // Monaco editor - cy.get('.react-monaco-editor-container') - .click() - .focused() - .type('