From d2a244b753e135051df88897d7e5db6a297ad924 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Wed, 3 Apr 2024 12:16:21 +0200 Subject: [PATCH] Move Cypress tests under tests/ directory Bug: T358851 Change-Id: I084f4e098c00d4c1bbcb0e692a2be3b1f8ce59a2 --- .gitignore | 8 ++++---- .npmrc | 2 +- Gruntfile.js | 2 +- package.json | 4 ++-- {cypress => tests/cypress}/.eslintrc.json | 0 cypress.config.js => tests/cypress/cypress.config.js | 12 +++++------- {cypress => tests/cypress}/e2e/tests/backlinks.cy.js | 0 .../tests/referencePreviews/referencePreviews.cy.js | 0 .../cypress}/e2e/tests/ve-cite/reuseRefs.cy.js | 3 ++- .../e2e/tests/ve-cite/veCiteIntegration.cy.js | 0 .../cypress}/e2e/utils/functions.helper.js | 0 11 files changed, 15 insertions(+), 16 deletions(-) rename {cypress => tests/cypress}/.eslintrc.json (100%) rename cypress.config.js => tests/cypress/cypress.config.js (61%) rename {cypress => tests/cypress}/e2e/tests/backlinks.cy.js (100%) rename {cypress => tests/cypress}/e2e/tests/referencePreviews/referencePreviews.cy.js (100%) rename {cypress => tests/cypress}/e2e/tests/ve-cite/reuseRefs.cy.js (98%) rename {cypress => tests/cypress}/e2e/tests/ve-cite/veCiteIntegration.cy.js (100%) rename {cypress => tests/cypress}/e2e/utils/functions.helper.js (100%) diff --git a/.gitignore b/.gitignore index 120753ebe..72cb0b791 100644 --- a/.gitignore +++ b/.gitignore @@ -24,8 +24,8 @@ sublime-* sftp-config.json .eslintcache -/cypress/.cache -/cypress/videos -/cypress/screenshots -/cypress/downloads +/tests/cypress/.cache +/tests/cypress/videos +/tests/cypress/screenshots +/tests/cypress/downloads /docs/js diff --git a/.npmrc b/.npmrc index efdd8c32e..0b16975a9 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ # Controls where the cypress binary is downloaded during `npm install` -CYPRESS_CACHE_FOLDER=./cypress/.cache +CYPRESS_CACHE_FOLDER=./tests/cypress/.cache diff --git a/Gruntfile.js b/Gruntfile.js index def7cf453..d75b38494 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -22,7 +22,7 @@ module.exports = function ( grunt ) { all: [ '**/*.{js,json}', '!{docs,vendor,node_modules}/**', - '!cypress/screenshots/**/*.js' + '!tests/cypress/screenshots/**/*.js' ] }, banana: conf.MessagesDirs, diff --git a/package.json b/package.json index 7ed776b29..13314d711 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "private": true, "scripts": { "selenium-daily": "npm run selenium-test", - "selenium-test": "CYPRESS_CACHE_FOLDER=./cypress/.cache cypress run", - "cypress:open": "CYPRESS_CACHE_FOLDER=./cypress/.cache cypress open", + "selenium-test": "CYPRESS_CACHE_FOLDER=./tests/cypress/.cache cypress run --config-file tests/cypress/cypress.config.js", + "cypress:open": "CYPRESS_CACHE_FOLDER=./tests/cypress/.cache cypress open --config-file tests/cypress/cypress.config.js", "doc": "jsdoc -c jsdoc.json", "test": "grunt test", "lint:fix": "grunt test --fix" diff --git a/cypress/.eslintrc.json b/tests/cypress/.eslintrc.json similarity index 100% rename from cypress/.eslintrc.json rename to tests/cypress/.eslintrc.json diff --git a/cypress.config.js b/tests/cypress/cypress.config.js similarity index 61% rename from cypress.config.js rename to tests/cypress/cypress.config.js index 58bc3a206..a6f16ade2 100644 --- a/cypress.config.js +++ b/tests/cypress/cypress.config.js @@ -1,25 +1,23 @@ -'use strict'; - /* eslint-env node */ const { defineConfig } = require( 'cypress' ); -// const { mwApiCommands } = require( './cypress/support/MwApiPlugin.js' ); +// const { mwApiCommands } = require( './tests/cypress/support/MwApiPlugin.js' ); const envLogDir = process.env.LOG_DIR ? process.env.LOG_DIR + '/Cite' : null; module.exports = defineConfig( { e2e: { supportFile: false, + specPattern: 'tests/cypress/e2e/**/*.cy.js', baseUrl: process.env.MW_SERVER + process.env.MW_SCRIPT_PATH, mediawikiAdminUsername: process.env.MEDIAWIKI_USER, mediawikiAdminPassword: process.env.MEDIAWIKI_PASSWORD - }, retries: 2, defaultCommandTimeout: 5000, // ms; default is 4000ms - screenshotsFolder: envLogDir || 'cypress/screenshots', + screenshotsFolder: envLogDir || 'tests/cypress/screenshots', video: true, - videosFolder: envLogDir || 'cypress/videos', - downloadsFolder: envLogDir || 'cypress/downloads' + videosFolder: envLogDir || 'tests/cypress/videos', + downloadsFolder: envLogDir || 'tests/cypress/downloads' } ); diff --git a/cypress/e2e/tests/backlinks.cy.js b/tests/cypress/e2e/tests/backlinks.cy.js similarity index 100% rename from cypress/e2e/tests/backlinks.cy.js rename to tests/cypress/e2e/tests/backlinks.cy.js diff --git a/cypress/e2e/tests/referencePreviews/referencePreviews.cy.js b/tests/cypress/e2e/tests/referencePreviews/referencePreviews.cy.js similarity index 100% rename from cypress/e2e/tests/referencePreviews/referencePreviews.cy.js rename to tests/cypress/e2e/tests/referencePreviews/referencePreviews.cy.js diff --git a/cypress/e2e/tests/ve-cite/reuseRefs.cy.js b/tests/cypress/e2e/tests/ve-cite/reuseRefs.cy.js similarity index 98% rename from cypress/e2e/tests/ve-cite/reuseRefs.cy.js rename to tests/cypress/e2e/tests/ve-cite/reuseRefs.cy.js index 24f22e425..03830146e 100644 --- a/cypress/e2e/tests/ve-cite/reuseRefs.cy.js +++ b/tests/cypress/e2e/tests/ve-cite/reuseRefs.cy.js @@ -57,7 +57,8 @@ describe( 'Re-using refs in Visual Editor', () => { // ARTICLE SECTION // Ref has been added to article, there are now 4 refs in the article helpers.getRefsFromArticleSection().should( 'have.length', 4 ); - // Ref #2 now appears twice in the article with corresponding IDs matching the backlinks in the references section + // Ref #2 now appears twice in the article with corresponding IDs matching the backlinks in + // the references section helpers.backlinksIdShouldMatchFootnoteId( 2, 0, 2 ); helpers.backlinksIdShouldMatchFootnoteId( 3, 1, 2 ); diff --git a/cypress/e2e/tests/ve-cite/veCiteIntegration.cy.js b/tests/cypress/e2e/tests/ve-cite/veCiteIntegration.cy.js similarity index 100% rename from cypress/e2e/tests/ve-cite/veCiteIntegration.cy.js rename to tests/cypress/e2e/tests/ve-cite/veCiteIntegration.cy.js diff --git a/cypress/e2e/utils/functions.helper.js b/tests/cypress/e2e/utils/functions.helper.js similarity index 100% rename from cypress/e2e/utils/functions.helper.js rename to tests/cypress/e2e/utils/functions.helper.js