diff --git a/.eslintrc.json b/.eslintrc.json index b7e21216dc..5d7474706d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -59,6 +59,13 @@ { "files": ["./tools/ui-components/**/*.test.[jt]s?(x)", "./client/**/*.test.[jt]s?(x)"], "extends": ["plugin:testing-library/react", "plugin:jest-dom/recommended"] + }, + { + "files": ["cypress/**/*.js"], + "globals": { + "cy": true, + "Cypress": true + } } ] } diff --git a/cypress/integration/ShowCertification.js b/cypress/integration/ShowCertification.js index fb191ec86a..aaef73787f 100644 --- a/cypress/integration/ShowCertification.js +++ b/cypress/integration/ShowCertification.js @@ -1,4 +1,3 @@ -/* global cy */ const certificationUrl = '/certification/developmentuser/responsive-web-design'; const projects = { superBlock: 'responsive-web-design', diff --git a/cypress/integration/landing.js b/cypress/integration/landing.js index 9b062320ae..b920c0d7c4 100644 --- a/cypress/integration/landing.js +++ b/cypress/integration/landing.js @@ -1,4 +1,3 @@ -/* global cy */ const selectors = { heading: "[data-test-label='landing-header']", callToAction: "[data-test-label='landing-big-cta']", diff --git a/cypress/integration/learn/challenges/backend.js b/cypress/integration/learn/challenges/backend.js index d2e2d3a5fa..ef908594ea 100644 --- a/cypress/integration/learn/challenges/backend.js +++ b/cypress/integration/learn/challenges/backend.js @@ -1,5 +1,3 @@ -/* global cy */ - const locations = { index: 'learn/back-end-development-and-apis/managing-packages-with-npm/' + diff --git a/cypress/integration/learn/challenges/code-storage.js b/cypress/integration/learn/challenges/code-storage.js index c9b6826013..cdf490f62b 100644 --- a/cypress/integration/learn/challenges/code-storage.js +++ b/cypress/integration/learn/challenges/code-storage.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { defaultOutput: '.output-text', editor: '.react-monaco-editor-container' diff --git a/cypress/integration/learn/challenges/output.js b/cypress/integration/learn/challenges/output.js index bd298660e6..6e8e3b9aa0 100644 --- a/cypress/integration/learn/challenges/output.js +++ b/cypress/integration/learn/challenges/output.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { defaultOutput: '.output-text', editor: '.monaco-editor', diff --git a/cypress/integration/learn/challenges/projects.js b/cypress/integration/learn/challenges/projects.js index 2c45d40b7c..36bfc8d51f 100644 --- a/cypress/integration/learn/challenges/projects.js +++ b/cypress/integration/learn/challenges/projects.js @@ -1,5 +1,3 @@ -/* global cy */ - const projects = { superBlock: 'machine-learning-with-python', block: 'machine-learning-with-python-projects', diff --git a/cypress/integration/learn/coding-interview-prep/intro-page.js b/cypress/integration/learn/coding-interview-prep/intro-page.js index 7c4f9600f7..2d2ff8051a 100644 --- a/cypress/integration/learn/coding-interview-prep/intro-page.js +++ b/cypress/integration/learn/coding-interview-prep/intro-page.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Certification intro page', () => { before(() => { cy.clearCookies(); diff --git a/cypress/integration/learn/common-components/footer.js b/cypress/integration/learn/common-components/footer.js index 864091285b..e191e8d9a1 100644 --- a/cypress/integration/learn/common-components/footer.js +++ b/cypress/integration/learn/common-components/footer.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { footer: '.site-footer' }; diff --git a/cypress/integration/learn/common-components/helpButton.js b/cypress/integration/learn/common-components/helpButton.js index 2788334438..4b23f8aecd 100644 --- a/cypress/integration/learn/common-components/helpButton.js +++ b/cypress/integration/learn/common-components/helpButton.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Help Button', () => { it('should be visible', () => { cy.visit( diff --git a/cypress/integration/learn/common-components/navbar.js b/cypress/integration/learn/common-components/navbar.js index 5d09c454fe..6f0a6701ca 100644 --- a/cypress/integration/learn/common-components/navbar.js +++ b/cypress/integration/learn/common-components/navbar.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { heading: "[data-test-label='landing-header']", smallCallToAction: "[data-test-label='landing-small-cta']", diff --git a/cypress/integration/learn/common-components/searchBar.js b/cypress/integration/learn/common-components/searchBar.js index 00f9e568ba..8ba13b444b 100644 --- a/cypress/integration/learn/common-components/searchBar.js +++ b/cypress/integration/learn/common-components/searchBar.js @@ -1,5 +1,3 @@ -/* global cy */ - const search = query => { cy.get('.ais-SearchBox').within(() => { cy.get('input').type(query); diff --git a/cypress/integration/learn/donate/donate-page-default.js b/cypress/integration/learn/donate/donate-page-default.js index 91d4e01a7c..89ed824029 100644 --- a/cypress/integration/learn/donate/donate-page-default.js +++ b/cypress/integration/learn/donate/donate-page-default.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { donateSupport: { firstTitle: '.donate-support h4:first-of-type b', diff --git a/cypress/integration/learn/donate/donate-page-donor.js b/cypress/integration/learn/donate/donate-page-donor.js index 899503ea68..b1d6132ee8 100644 --- a/cypress/integration/learn/donate/donate-page-donor.js +++ b/cypress/integration/learn/donate/donate-page-donor.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { donateAlert: { firstText: '.alert-info p:first-child', diff --git a/cypress/integration/learn/donate/donation-block-completion-modal.js b/cypress/integration/learn/donate/donation-block-completion-modal.js index 5640c86379..23ab5b3600 100644 --- a/cypress/integration/learn/donate/donation-block-completion-modal.js +++ b/cypress/integration/learn/donate/donation-block-completion-modal.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Donate page', () => { before(() => { cy.clearCookies(); diff --git a/cypress/integration/learn/header/header-nav-links.js b/cypress/integration/learn/header/header-nav-links.js index 2c4ddb56e7..7174516520 100644 --- a/cypress/integration/learn/header/header-nav-links.js +++ b/cypress/integration/learn/header/header-nav-links.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Navigation links', () => { it('should render the expected forum and news links.', () => { cy.visit('/learn'); diff --git a/cypress/integration/learn/index.js b/cypress/integration/learn/index.js index 48167151b7..05fb912a05 100644 --- a/cypress/integration/learn/index.js +++ b/cypress/integration/learn/index.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { challengeMap: "[data-test-label='learn-curriculum-map']" }; diff --git a/cypress/integration/learn/redirects/breadcrumbs.js b/cypress/integration/learn/redirects/breadcrumbs.js index ebd58dc50d..0d70df6668 100644 --- a/cypress/integration/learn/redirects/breadcrumbs.js +++ b/cypress/integration/learn/redirects/breadcrumbs.js @@ -1,5 +1,3 @@ -/* global cy */ - const challengeUrl = '/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'; diff --git a/cypress/integration/learn/responsive-web-design/basic-css/index.js b/cypress/integration/learn/responsive-web-design/basic-css/index.js index 8e2910d92a..4f12edc3ef 100644 --- a/cypress/integration/learn/responsive-web-design/basic-css/index.js +++ b/cypress/integration/learn/responsive-web-design/basic-css/index.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { tableOfContents: '.intro-toc', warningMessage: '.flash-message-enter-active' diff --git a/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js b/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js index fe4095e790..26460d0963 100644 --- a/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js +++ b/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js @@ -1,5 +1,3 @@ -/* global cy */ - const projects = { superBlock: 'responsive-web-design', block: 'responsive-web-design-projects', diff --git a/cypress/integration/learn/responsive-web-design/intro-page.js b/cypress/integration/learn/responsive-web-design/intro-page.js index 62529751dd..35d7f62181 100644 --- a/cypress/integration/learn/responsive-web-design/intro-page.js +++ b/cypress/integration/learn/responsive-web-design/intro-page.js @@ -1,5 +1,3 @@ -/* global cy */ - const selectors = { firstBlock: '.block-ui > .block:nth-child(1) > .map-title' }; diff --git a/cypress/integration/legacy/redirects/adding-development.js b/cypress/integration/legacy/redirects/adding-development.js index 3fde7b37bd..abb172ea1d 100644 --- a/cypress/integration/legacy/redirects/adding-development.js +++ b/cypress/integration/legacy/redirects/adding-development.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Legacy redirects', () => { it('should redirect from front-end-libraries to front-end-development-libraries', () => { cy.visit('learn/front-end-libraries'); diff --git a/cypress/integration/legacy/redirects/challenges.js b/cypress/integration/legacy/redirects/challenges.js index 7693d9a93c..b0f6b197f1 100644 --- a/cypress/integration/legacy/redirects/challenges.js +++ b/cypress/integration/legacy/redirects/challenges.js @@ -1,5 +1,3 @@ -/* global cy */ - const locations = { chalSuper: '/challenges/responsive-web-design/', chalBlock: '/challenges/responsive-web-design/basic-html-and-html5', diff --git a/cypress/integration/settings/certifications.js b/cypress/integration/settings/certifications.js index c64e160e7e..f566d0efc8 100644 --- a/cypress/integration/settings/certifications.js +++ b/cypress/integration/settings/certifications.js @@ -1,5 +1,3 @@ -/* global cy */ - import '@testing-library/cypress/add-commands'; describe('Settings certifications area', () => { diff --git a/cypress/integration/settings/email-change.js b/cypress/integration/settings/email-change.js index 4d3af67451..a227415e86 100644 --- a/cypress/integration/settings/email-change.js +++ b/cypress/integration/settings/email-change.js @@ -1,4 +1,3 @@ -/* global cy */ describe('Email input field', () => { beforeEach(() => { cy.exec('npm run seed'); diff --git a/cypress/integration/settings/image-picture-check.js b/cypress/integration/settings/image-picture-check.js index 5bb38e700e..0fd0284e51 100644 --- a/cypress/integration/settings/image-picture-check.js +++ b/cypress/integration/settings/image-picture-check.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Picture input field', () => { beforeEach(() => { cy.login(); diff --git a/cypress/integration/settings/settings.js b/cypress/integration/settings/settings.js index 8fba0d0ff2..5a40f885f8 100644 --- a/cypress/integration/settings/settings.js +++ b/cypress/integration/settings/settings.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Settings', () => { it('should be possible to reset your progress', () => { cy.login(); diff --git a/cypress/integration/settings/username-change.js b/cypress/integration/settings/username-change.js index 3a88527b55..fd0b8bbd3c 100644 --- a/cypress/integration/settings/username-change.js +++ b/cypress/integration/settings/username-change.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Username input field', () => { beforeEach(() => { cy.login(); diff --git a/cypress/integration/tags.js b/cypress/integration/tags.js index d98cd49810..92976f42d0 100644 --- a/cypress/integration/tags.js +++ b/cypress/integration/tags.js @@ -1,4 +1,3 @@ -/* global cy */ describe('The Document Metadata', () => { before(() => { cy.visit('/'); diff --git a/cypress/integration/top-contributor.js b/cypress/integration/top-contributor.js index f78fab75c9..ff67a67ad4 100644 --- a/cypress/integration/top-contributor.js +++ b/cypress/integration/top-contributor.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Top contributor in user profile', () => { before(() => { cy.clearCookies(); diff --git a/cypress/integration/user/report-user.js b/cypress/integration/user/report-user.js index 307759a55e..85a06ca745 100644 --- a/cypress/integration/user/report-user.js +++ b/cypress/integration/user/report-user.js @@ -1,5 +1,3 @@ -/* global cy */ - describe('Report User', () => { beforeEach(() => { cy.exec('npm run seed'); @@ -21,5 +19,3 @@ describe('Report User', () => { cy.contains('A report was sent to the team with foo@bar.com in copy'); }); }); - -// A report was sent to the team with foo@bar.com in copy diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 5603803e1f..3031c9c555 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1,4 +1,3 @@ -/* global cy Cypress*/ // *********************************************** // This example commands.js shows you how to // create various custom commands and overwrite diff --git a/docs/how-to-add-cypress-tests.md b/docs/how-to-add-cypress-tests.md index a392bb85da..46a3e04694 100644 --- a/docs/how-to-add-cypress-tests.md +++ b/docs/how-to-add-cypress-tests.md @@ -4,8 +4,6 @@ When making changes to JavaScript, CSS, or HTML which could change the functiona To learn how to write Cypress tests, or 'specs', please see Cypress' official [documentation](https://docs.cypress.io/guides/getting-started/writing-your-first-test.html). -> Note: When writing tests for freeCodeCamp, remember to add `/* global cy */` to the top of the file to avoid ESLint issues. - ## Where to add a test - Cypress tests are in the `./cypress` directory.