diff --git a/client/cypress.config.ts b/client/cypress.config.ts new file mode 100644 index 00000000..57fc063d --- /dev/null +++ b/client/cypress.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + videoUploadOnPasses: false, + reporter: 'junit', + reporterOptions: { + mochaFile: 'cypress/test-reports/frontend/cypress-results-[hash].xml', + toConsole: true, + }, + projectId: 'msk-fe', + retries: { + runMode: 2, + }, + e2e: { + // We've imported your old cypress plugins here. + // You may want to clean this up later by importing these. + setupNodeEvents(on, config) { + return require('./cypress/plugins/index.js')(on, config) + }, + baseUrl: 'http://localhost:8080', + specPattern: 'cypress/integration/frontend/**/*.{js,jsx,ts,tsx}', + }, +}) diff --git a/client/cypress.e2e.ts b/client/cypress.e2e.ts new file mode 100644 index 00000000..32dd7f2c --- /dev/null +++ b/client/cypress.e2e.ts @@ -0,0 +1,15 @@ +import {defineConfig} from 'cypress'; +export default defineConfig( { + e2e: { + "baseUrl": "http://localhost:8000", + specPattern: 'cypress/e2e/e2e/**/*.{spec,cy}.{js,ts}', + supportFile: 'cypress/support/e2e.js', + }, + "videoUploadOnPasses": false, + "reporter": "junit", + "reporterOptions": { + "mochaFile": "cypress/test-reports/e2e/cypress-results-[hash].xml", + "toConsole": true + }, + "projectId": "msk-ee", +}); diff --git a/client/cypress.frontend.ts b/client/cypress.frontend.ts new file mode 100644 index 00000000..42bbeedc --- /dev/null +++ b/client/cypress.frontend.ts @@ -0,0 +1,34 @@ +import {defineConfig} from 'cypress'; +import {readFileSync} from "fs"; +import {resolve} from "path"; + +export default defineConfig({ + chromeWebSecurity: false, + e2e: { + baseUrl: "http://localhost:8080", + specPattern: 'cypress/e2e/frontend/**/*.spec.{js,ts}', + supportFile: 'cypress/support/e2e.js', + setupNodeEvents(on, config) { + on('task', { + getSchema() { + return readFileSync( + resolve(__dirname, '../server/schema.graphql'), + 'utf8' + ); + } + }); + }, + }, + videoUploadOnPasses: false, + reporter: "junit", + reporterOptions: { + mochaFile: "cypress/test-reports/frontend/cypress-results-[hash].xml", + toConsole: true + }, + "projectId": "msk-fe", + retries: { + runMode: 3 + } +}); + + diff --git a/client/cypress/integration/e2e/solutions.spec.js b/client/cypress/e2e/e2e/solutions.spec.js similarity index 100% rename from client/cypress/integration/e2e/solutions.spec.js rename to client/cypress/e2e/e2e/solutions.spec.js diff --git a/client/cypress/integration/e2e/users/beta-login.spec.js b/client/cypress/e2e/e2e/users/beta-login.spec.js similarity index 100% rename from client/cypress/integration/e2e/users/beta-login.spec.js rename to client/cypress/e2e/e2e/users/beta-login.spec.js diff --git a/client/cypress/integration/e2e/users/coupon.spec.js b/client/cypress/e2e/e2e/users/coupon.spec.js similarity index 100% rename from client/cypress/integration/e2e/users/coupon.spec.js rename to client/cypress/e2e/e2e/users/coupon.spec.js diff --git a/client/cypress/integration/frontend/assignment.spec.js b/client/cypress/e2e/frontend/assignment.spec.js similarity index 100% rename from client/cypress/integration/frontend/assignment.spec.js rename to client/cypress/e2e/frontend/assignment.spec.js diff --git a/client/cypress/integration/frontend/bookmarks.spec.js b/client/cypress/e2e/frontend/bookmarks.spec.js similarity index 100% rename from client/cypress/integration/frontend/bookmarks.spec.js rename to client/cypress/e2e/frontend/bookmarks.spec.js diff --git a/client/cypress/integration/frontend/instruments/instrument-page.spec.js b/client/cypress/e2e/frontend/instruments/instrument-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/instruments/instrument-page.spec.js rename to client/cypress/e2e/frontend/instruments/instrument-page.spec.js diff --git a/client/cypress/integration/frontend/instruments/instruments-page.spec.js b/client/cypress/e2e/frontend/instruments/instruments-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/instruments/instruments-page.spec.js rename to client/cypress/e2e/frontend/instruments/instruments-page.spec.js diff --git a/client/cypress/integration/frontend/instruments/module-page.spec.js b/client/cypress/e2e/frontend/instruments/module-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/instruments/module-page.spec.js rename to client/cypress/e2e/frontend/instruments/module-page.spec.js diff --git a/client/cypress/integration/frontend/modules/apply-module-visibility.spec.js b/client/cypress/e2e/frontend/modules/apply-module-visibility.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/apply-module-visibility.spec.js rename to client/cypress/e2e/frontend/modules/apply-module-visibility.spec.js diff --git a/client/cypress/integration/frontend/modules/assignment-in-module.spec.js b/client/cypress/e2e/frontend/modules/assignment-in-module.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/assignment-in-module.spec.js rename to client/cypress/e2e/frontend/modules/assignment-in-module.spec.js diff --git a/client/cypress/integration/frontend/modules/create-content-block.page.spec.js b/client/cypress/e2e/frontend/modules/create-content-block.page.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/create-content-block.page.spec.js rename to client/cypress/e2e/frontend/modules/create-content-block.page.spec.js diff --git a/client/cypress/integration/frontend/modules/current-module.spec.js b/client/cypress/e2e/frontend/modules/current-module.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/current-module.spec.js rename to client/cypress/e2e/frontend/modules/current-module.spec.js diff --git a/client/cypress/integration/frontend/modules/custom-content-block.spec.js b/client/cypress/e2e/frontend/modules/custom-content-block.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/custom-content-block.spec.js rename to client/cypress/e2e/frontend/modules/custom-content-block.spec.js diff --git a/client/cypress/integration/frontend/modules/snapshots.spec.js b/client/cypress/e2e/frontend/modules/snapshots.spec.js similarity index 100% rename from client/cypress/integration/frontend/modules/snapshots.spec.js rename to client/cypress/e2e/frontend/modules/snapshots.spec.js diff --git a/client/cypress/integration/frontend/objectives/objectives-visibility.spec.js b/client/cypress/e2e/frontend/objectives/objectives-visibility.spec.js similarity index 100% rename from client/cypress/integration/frontend/objectives/objectives-visibility.spec.js rename to client/cypress/e2e/frontend/objectives/objectives-visibility.spec.js diff --git a/client/cypress/integration/frontend/objectives/objectives.spec.js b/client/cypress/e2e/frontend/objectives/objectives.spec.js similarity index 100% rename from client/cypress/integration/frontend/objectives/objectives.spec.js rename to client/cypress/e2e/frontend/objectives/objectives.spec.js diff --git a/client/cypress/integration/frontend/portfolio/new-project.spec.js b/client/cypress/e2e/frontend/portfolio/new-project.spec.js similarity index 100% rename from client/cypress/integration/frontend/portfolio/new-project.spec.js rename to client/cypress/e2e/frontend/portfolio/new-project.spec.js diff --git a/client/cypress/integration/frontend/portfolio/project-page.spec.js b/client/cypress/e2e/frontend/portfolio/project-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/portfolio/project-page.spec.js rename to client/cypress/e2e/frontend/portfolio/project-page.spec.js diff --git a/client/cypress/integration/frontend/portfolio/projects-page.spec.js b/client/cypress/e2e/frontend/portfolio/projects-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/portfolio/projects-page.spec.js rename to client/cypress/e2e/frontend/portfolio/projects-page.spec.js diff --git a/client/cypress/integration/frontend/read-only/assignment-feedback.teacher.spec.js b/client/cypress/e2e/frontend/read-only/assignment-feedback.teacher.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/assignment-feedback.teacher.spec.js rename to client/cypress/e2e/frontend/read-only/assignment-feedback.teacher.spec.js diff --git a/client/cypress/integration/frontend/read-only/assignment.student.spec.js b/client/cypress/e2e/frontend/read-only/assignment.student.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/assignment.student.spec.js rename to client/cypress/e2e/frontend/read-only/assignment.student.spec.js diff --git a/client/cypress/integration/frontend/read-only/banner.spec.js b/client/cypress/e2e/frontend/read-only/banner.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/banner.spec.js rename to client/cypress/e2e/frontend/read-only/banner.spec.js diff --git a/client/cypress/integration/frontend/read-only/leave-class.spec.js b/client/cypress/e2e/frontend/read-only/leave-class.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/leave-class.spec.js rename to client/cypress/e2e/frontend/read-only/leave-class.spec.js diff --git a/client/cypress/integration/frontend/read-only/navigation.spec.js b/client/cypress/e2e/frontend/read-only/navigation.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/navigation.spec.js rename to client/cypress/e2e/frontend/read-only/navigation.spec.js diff --git a/client/cypress/integration/frontend/read-only/news.spec.js b/client/cypress/e2e/frontend/read-only/news.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/news.spec.js rename to client/cypress/e2e/frontend/read-only/news.spec.js diff --git a/client/cypress/integration/frontend/read-only/portfolio.spec.js b/client/cypress/e2e/frontend/read-only/portfolio.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/portfolio.spec.js rename to client/cypress/e2e/frontend/read-only/portfolio.spec.js diff --git a/client/cypress/integration/frontend/read-only/project.spec.js b/client/cypress/e2e/frontend/read-only/project.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/project.spec.js rename to client/cypress/e2e/frontend/read-only/project.spec.js diff --git a/client/cypress/integration/frontend/read-only/room.spec.js b/client/cypress/e2e/frontend/read-only/room.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/room.spec.js rename to client/cypress/e2e/frontend/read-only/room.spec.js diff --git a/client/cypress/integration/frontend/read-only/rooms.spec.js b/client/cypress/e2e/frontend/read-only/rooms.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/rooms.spec.js rename to client/cypress/e2e/frontend/read-only/rooms.spec.js diff --git a/client/cypress/integration/frontend/read-only/school-class-team.spec.js b/client/cypress/e2e/frontend/read-only/school-class-team.spec.js similarity index 100% rename from client/cypress/integration/frontend/read-only/school-class-team.spec.js rename to client/cypress/e2e/frontend/read-only/school-class-team.spec.js diff --git a/client/cypress/integration/frontend/rooms/article-page.spec.js b/client/cypress/e2e/frontend/rooms/article-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/rooms/article-page.spec.js rename to client/cypress/e2e/frontend/rooms/article-page.spec.js diff --git a/client/cypress/integration/frontend/rooms/room-page.spec.js b/client/cypress/e2e/frontend/rooms/room-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/rooms/room-page.spec.js rename to client/cypress/e2e/frontend/rooms/room-page.spec.js diff --git a/client/cypress/integration/frontend/rooms/rooms-page.spec.js b/client/cypress/e2e/frontend/rooms/rooms-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/rooms/rooms-page.spec.js rename to client/cypress/e2e/frontend/rooms/rooms-page.spec.js diff --git a/client/cypress/integration/frontend/spellcheck.spec.js b/client/cypress/e2e/frontend/spellcheck.spec.js similarity index 100% rename from client/cypress/integration/frontend/spellcheck.spec.js rename to client/cypress/e2e/frontend/spellcheck.spec.js diff --git a/client/cypress/integration/frontend/survey.spec.js b/client/cypress/e2e/frontend/survey.spec.js similarity index 100% rename from client/cypress/integration/frontend/survey.spec.js rename to client/cypress/e2e/frontend/survey.spec.js diff --git a/client/cypress/integration/frontend/ui/home-page.spec.js b/client/cypress/e2e/frontend/ui/home-page.spec.js similarity index 100% rename from client/cypress/integration/frontend/ui/home-page.spec.js rename to client/cypress/e2e/frontend/ui/home-page.spec.js diff --git a/client/cypress/integration/frontend/ui/onboarding.spec.ts b/client/cypress/e2e/frontend/ui/onboarding.spec.ts similarity index 100% rename from client/cypress/integration/frontend/ui/onboarding.spec.ts rename to client/cypress/e2e/frontend/ui/onboarding.spec.ts diff --git a/client/cypress/integration/frontend/ui/sidebar.spec.js b/client/cypress/e2e/frontend/ui/sidebar.spec.js similarity index 100% rename from client/cypress/integration/frontend/ui/sidebar.spec.js rename to client/cypress/e2e/frontend/ui/sidebar.spec.js diff --git a/client/cypress/integration/frontend/users/new-student.spec.js b/client/cypress/e2e/frontend/users/new-student.spec.js similarity index 100% rename from client/cypress/integration/frontend/users/new-student.spec.js rename to client/cypress/e2e/frontend/users/new-student.spec.js diff --git a/client/cypress/integration/frontend/users/school-class-management.spec.js b/client/cypress/e2e/frontend/users/school-class-management.spec.js similarity index 100% rename from client/cypress/integration/frontend/users/school-class-management.spec.js rename to client/cypress/e2e/frontend/users/school-class-management.spec.js diff --git a/client/cypress/integration/frontend/users/team.spec.js b/client/cypress/e2e/frontend/users/team.spec.js similarity index 100% rename from client/cypress/integration/frontend/users/team.spec.js rename to client/cypress/e2e/frontend/users/team.spec.js diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js index 29bb00de..0089cfa2 100644 --- a/client/cypress/support/commands.js +++ b/client/cypress/support/commands.js @@ -89,14 +89,6 @@ Cypress.Commands.add('startGraphQLCapture', () => { cy.route('POST', '/api/graphql/').as('graphQL'); }); -// from https://stackoverflow.com/questions/53814647/how-can-i-alias-specific-graphql-requests-in-cypress -Cypress.Commands.add('waitFor', operationName => { - cy.wait('@graphQL').then(({request}) => { - if (request.body.operationName !== operationName) { - return cy.waitFor(operationName); - } - }); -}); Cypress.Commands.add('changePassword', (oldPassword, newPassword) => { if (oldPassword) { diff --git a/client/cypress/support/index.js b/client/cypress/support/e2e.js similarity index 100% rename from client/cypress/support/index.js rename to client/cypress/support/e2e.js diff --git a/client/package.json b/client/package.json index fa585820..3da8fbf9 100644 --- a/client/package.json +++ b/client/package.json @@ -15,10 +15,10 @@ "open:cypress:frontend": "npm run cypress:frontend:open", "test:cypress:e2e": "npm run cypress:e2e:test", "test:cypress:frontend": "npm run cypress:frontend:test", - "cypress:e2e:open": "cypress open --config-file cypress.e2e.json", - "cypress:frontend:open": "cypress open --config-file cypress.frontend.json", - "cypress:e2e:test": "cypress run --config-file cypress.e2e.json", - "cypress:frontend:test": "cypress run --config-file cypress.frontend.json", + "cypress:e2e:open": "cypress open --config-file cypress.e2e.ts", + "cypress:frontend:open": "cypress open --config-file cypress.frontend.ts", + "cypress:e2e:test": "cypress run --config-file cypress.e2e.ts", + "cypress:frontend:test": "cypress run --config-file cypress.frontend.ts", "install:cypress": "cypress install", "test:unit": "jest", "cypress:parallel": "CYPRESS_API_URL=\"https://iterativ-cypress-director.herokuapp.com/\" cy2 run --parallel --record --key somekey --config-file cypress.frontend.json --ci-build-id some-id", @@ -62,7 +62,7 @@ "css-loader": "^0.28.0", "css-minimizer-webpack-plugin": "^3.4.1", "cy2": "^1.2.1", - "cypress": "^9.5.0", + "cypress": "10", "dayjs": "^1.10.7", "debounce": "^1.2.0", "eslint": "^7.32.0", diff --git a/client/yarn.lock b/client/yarn.lock index 67c644ad..41955d20 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -4653,10 +4653,10 @@ cy2@^1.2.1: js-yaml "^4.0.0" npm-which "^3.0.1" -cypress@^9.5.0: - version "9.7.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.7.0.tgz#bf55b2afd481f7a113ef5604aa8b693564b5e744" - integrity sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q== +cypress@10: + version "10.8.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.8.0.tgz#12a681f2642b6f13d636bab65d5b71abdb1497a5" + integrity sha512-QVse0dnLm018hgti2enKMVZR9qbIO488YGX06nH5j3Dg1isL38DwrBtyrax02CANU6y8F4EJUuyW6HJKw1jsFA== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -4677,7 +4677,7 @@ cypress@^9.5.0: dayjs "^1.10.4" debug "^4.3.2" enquirer "^2.3.6" - eventemitter2 "^6.4.3" + eventemitter2 "6.4.7" execa "4.1.0" executable "^4.1.1" extract-zip "2.0.1" @@ -5571,10 +5571,10 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter2@^6.4.3: - version "6.4.9" - resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.9.tgz#41f2750781b4230ed58827bc119d293471ecb125" - integrity sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg== +eventemitter2@6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" + integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg== eventemitter3@^4.0.0: version "4.0.7" @@ -12013,13 +12013,6 @@ survey-vue-ui@^1.9.50: survey-core "*" vue "^2.6.12" -survey-vue@^1.9.2: - version "1.9.50" - resolved "https://registry.yarnpkg.com/survey-vue/-/survey-vue-1.9.50.tgz#1bce8762f1737fc05ac53dc3e25e8ac657fd2847" - integrity sha512-5QOhxvDAwGDmO87A320fl9PuVHXRH3+Dm9uxJ7iM3OrHSMYh+Pq9u+qa19pZnc3WhMyTuAEpHgJ1NIAM4KxBbg== - dependencies: - vue "^2.1.10" - svgo@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5" @@ -12880,7 +12873,7 @@ vue@2.6.11: resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.11.tgz#76594d877d4b12234406e84e35275c6d514125c5" integrity sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ== -vue@^2.1.10, vue@^2.6.12, vue@^2.7: +vue@^2.6.12, vue@^2.7: version "2.7.10" resolved "https://registry.yarnpkg.com/vue/-/vue-2.7.10.tgz#ae516cc6c88e1c424754468844218fdd5e280f40" integrity sha512-HmFC70qarSHPXcKtW8U8fgIkF6JGvjEmDiVInTkKZP0gIlEPhlVlcJJLkdGIDiNkIeA2zJPQTWJUI4iWe+AVfg==