diff --git a/.github/workflows/master_rancher_ui_workflow.yml b/.github/workflows/master_rancher_ui_workflow.yml index 97ca33ef..1a663107 100644 --- a/.github/workflows/master_rancher_ui_workflow.yml +++ b/.github/workflows/master_rancher_ui_workflow.yml @@ -116,9 +116,9 @@ jobs: browser: ${{ inputs.browser }} headless: true spec: | - cypress/integration/unit_tests/first_connexion.spec.ts - cypress/integration/unit_tests/${{ inputs.cypress_install_test }} - config-file: cypress-with-epinio-cert.json + cypress/e2e/unit_tests/first_connexion.spec.ts + cypress/e2e/unit_tests/${{ inputs.cypress_install_test }} + config-file: cypress.config.ts - name: Copying screenshots and videos to Mochawesome report if: always() @@ -217,8 +217,8 @@ jobs: browser: ${{ inputs.browser }} headless: true spec: | - cypress/integration/unit_tests/${{ inputs.cypress_test }} - config-file: cypress-with-epinio-cert.json + cypress/e2e/unit_tests/${{ inputs.cypress_test }} + config-file: cypress.config.ts - name: Copying screenshots and videos to Mochawesome report if: always() @@ -277,8 +277,8 @@ jobs: browser: ${{ inputs.browser }} headless: true spec: | - cypress/integration/unit_tests/uninstall.spec.ts - config-file: cypress-with-epinio-cert.json + cypress/e2e/unit_tests/uninstall.spec.ts + config-file: cypress.config.ts - name: Copying screenshots and videos to Mochawesome report if: always() diff --git a/.github/workflows/master_std_ui.yml b/.github/workflows/master_std_ui.yml index f4ec9316..34913bf7 100644 --- a/.github/workflows/master_std_ui.yml +++ b/.github/workflows/master_std_ui.yml @@ -117,7 +117,7 @@ jobs: - name: Start Cypress tests env: BROWSER: ${{ inputs.browser }} - CYPRESS_CFG: cypress-with-epinio-cert.json + CYPRESS_CFG: cypress.config.ts CYPRESS_DOCKER: ${{ inputs.cypress_docker }} DOCKER_OPTIONS: ${{ inputs.docker_options }} EXT_REG_USER: ${{ secrets.EPINIO_DOCKER_USER }} diff --git a/.github/workflows/std_ui_latest_chrome.yml b/.github/workflows/std_ui_latest_chrome.yml index d4143b7b..c801a15a 100644 --- a/.github/workflows/std_ui_latest_chrome.yml +++ b/.github/workflows/std_ui_latest_chrome.yml @@ -15,7 +15,7 @@ jobs: with: browser: chrome cypress_docker: cypress/included:9.7.0 - cypress_spec: cypress/integration/unit_tests/menu.spec.ts + cypress_spec: cypress/e2e/unit_tests/menu.spec.ts secrets: inherit configurations-tests: @@ -23,7 +23,7 @@ jobs: with: browser: chrome cypress_docker: cypress/included:9.7.0 - cypress_spec: cypress/integration/unit_tests/configurations.spec.ts + cypress_spec: cypress/e2e/unit_tests/configurations.spec.ts secrets: inherit applications-tests: @@ -31,7 +31,7 @@ jobs: with: browser: chrome cypress_docker: cypress/included:9.7.0 - cypress_spec: cypress/integration/unit_tests/applications.spec.ts + cypress_spec: cypress/e2e/unit_tests/applications.spec.ts secrets: inherit namespaces-tests: @@ -39,5 +39,5 @@ jobs: with: browser: chrome cypress_docker: cypress/included:9.7.0 - cypress_spec: cypress/integration/unit_tests/namespaces.spec.ts + cypress_spec: cypress/e2e/unit_tests/namespaces.spec.ts secrets: inherit diff --git a/.github/workflows/std_ui_latest_firefox.yml b/.github/workflows/std_ui_latest_firefox.yml index a6ac91f5..a089d4f6 100644 --- a/.github/workflows/std_ui_latest_firefox.yml +++ b/.github/workflows/std_ui_latest_firefox.yml @@ -20,7 +20,7 @@ jobs: #with: #browser: firefox #cypress_docker: cypress/included:9.7.0 - #cypress_spec: cypress/integration/unit_tests/menu.spec.ts + #cypress_spec: cypress/e2e/unit_tests/menu.spec.ts #docker_options: '--user 1000' #ext_reg: '1' #s3: '1' @@ -31,7 +31,7 @@ jobs: #with: #browser: firefox #cypress_docker: cypress/included:9.7.0 - #cypress_spec: cypress/integration/unit_tests/configurations.spec.ts + #cypress_spec: cypress/e2e/unit_tests/configurations.spec.ts #docker_options: '--user 1000' #ext_reg: '1' #s3: '1' @@ -42,7 +42,7 @@ jobs: #with: #browser: firefox #cypress_docker: cypress/included:9.7.0 - #cypress_spec: cypress/integration/unit_tests/applications.spec.ts + #cypress_spec: cypress/e2e/unit_tests/applications.spec.ts #docker_options: '--user 1000' #ext_reg: '1' #s3: '1' @@ -53,7 +53,7 @@ jobs: with: browser: firefox cypress_docker: cypress/included:9.7.0 - cypress_spec: cypress/integration/unit_tests/namespaces.spec.ts + cypress_spec: cypress/e2e/unit_tests/namespaces.spec.ts docker_options: '--user 1000' ext_reg: '1' s3: '1' diff --git a/Dockerfile b/Dockerfile index 5d0c4d7a..1685fe8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM cypress/base:16.13.0 -COPY cypress.json . +COPY cypress.config.ts . COPY tsconfig.json . COPY package.json . COPY ./cypress/ cypress diff --git a/Makefile b/Makefile index 4282da1f..7432882a 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ build-image: ## Build the e2e_image with latest tests version cypress-gui: ## Start Cypress in GUI mode, need graphical environment npm install - ./node_modules/cypress/bin/cypress open -C cypress-with-epinio-cert.json + ./node_modules/cypress/bin/cypress open -C cypress.config.ts check-dependencies: command -v docker && echo "docker - ok" diff --git a/cypress-with-epinio-cert.json b/cypress-with-epinio-cert.json deleted file mode 100644 index 9abb0d06..00000000 --- a/cypress-with-epinio-cert.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "experimentalSessionAndOrigin": true, - "defaultCommandTimeout": 10000, - "reporter":"mochawesome", - "reporterOptions": { - "reportFilename": "[name]-report_[status]_[datetime]", - "timestamp": "shortDate" - }, - "clientCertificates": [ - { - "url": "https://*", - "ca": [], - "certs": [ - { - "cert": "cypress/fixtures/epinio-private-cert-pem.file", - "key": "cypress/fixtures/epinio-private-key-pem.file" - } - ] - } - ], - "testFiles": [ - "unit_tests/first_connexion.spec.ts", - "unit_tests/installation.spec.ts", - "unit_tests/menu.spec.ts", - "unit_tests/applications.spec.ts", - "unit_tests/configurations.spec.ts", - "unit_tests/namespaces.spec.ts", - "scenarios/with_default_options.spec.ts", - "scenarios/with_s3_and_external_registry.spec.ts", - "unit_tests/uninstall.spec.ts" - ] -} diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 00000000..9d2ee47c --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,34 @@ +import { defineConfig } from 'cypress' + +// export default defineConfig({ +export default defineConfig({ + defaultCommandTimeout: 10000, + numTestsKeptInMemory:25, + reporter: 'mochawesome', + reporterOptions: { + reportFilename: '[name]-report_[status]_[datetime]', + timestamp: 'shortDate', + }, + clientCertificates: [ + { + url: 'https://*', + ca: [], + certs: [ + { + cert: 'cypress/fixtures/epinio-private-cert-pem.file', + key: 'cypress/fixtures/epinio-private-key-pem.file', + }, + ], + }, + ], + 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.ts')(on, config) + }, + experimentalSessionAndOrigin: true, + specPattern: + 'cypress/e2e/unit_tests/*.spec.ts', + }, +}) diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 8112334d..00000000 --- a/cypress.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "experimentalSessionAndOrigin": true, - "defaultCommandTimeout": 10000, - "clientCertificates": [ - { - "url": "https://*", - "ca": [], - "certs": [ - { - "cert": "%crt%", - "key": "%key%" - } - ] - } - ], - "testFiles": [ - "unit_tests/first_connexion.spec.ts", - "unit_tests/installation.spec.ts", - "unit_tests/menu.spec.ts", - "unit_tests/applications.spec.ts", - "unit_tests/configurations.spec.ts", - "unit_tests/namespaces.spec.ts", - "unit_tests/uninstall.spec.ts", - "scenarios/with_default_options.spec.ts", - "scenarios/with_s3_and_external_registry.spec.ts" - ] -} diff --git a/cypress/integration/scenarios/with_default_options.spec.ts b/cypress/e2e/scenarios/with_default_options.spec.ts similarity index 100% rename from cypress/integration/scenarios/with_default_options.spec.ts rename to cypress/e2e/scenarios/with_default_options.spec.ts diff --git a/cypress/integration/scenarios/with_s3_and_external_registry.spec.ts b/cypress/e2e/scenarios/with_s3_and_external_registry.spec.ts similarity index 100% rename from cypress/integration/scenarios/with_s3_and_external_registry.spec.ts rename to cypress/e2e/scenarios/with_s3_and_external_registry.spec.ts diff --git a/cypress/integration/unit_tests/applications.spec.ts b/cypress/e2e/unit_tests/applications.spec.ts similarity index 100% rename from cypress/integration/unit_tests/applications.spec.ts rename to cypress/e2e/unit_tests/applications.spec.ts diff --git a/cypress/integration/unit_tests/configurations.spec.ts b/cypress/e2e/unit_tests/configurations.spec.ts similarity index 100% rename from cypress/integration/unit_tests/configurations.spec.ts rename to cypress/e2e/unit_tests/configurations.spec.ts diff --git a/cypress/integration/unit_tests/first_connexion.spec.ts b/cypress/e2e/unit_tests/first_connexion.spec.ts similarity index 100% rename from cypress/integration/unit_tests/first_connexion.spec.ts rename to cypress/e2e/unit_tests/first_connexion.spec.ts diff --git a/cypress/integration/unit_tests/installation.spec.ts b/cypress/e2e/unit_tests/installation.spec.ts similarity index 100% rename from cypress/integration/unit_tests/installation.spec.ts rename to cypress/e2e/unit_tests/installation.spec.ts diff --git a/cypress/integration/unit_tests/menu.spec.ts b/cypress/e2e/unit_tests/menu.spec.ts similarity index 100% rename from cypress/integration/unit_tests/menu.spec.ts rename to cypress/e2e/unit_tests/menu.spec.ts diff --git a/cypress/integration/unit_tests/namespaces.spec.ts b/cypress/e2e/unit_tests/namespaces.spec.ts similarity index 100% rename from cypress/integration/unit_tests/namespaces.spec.ts rename to cypress/e2e/unit_tests/namespaces.spec.ts diff --git a/cypress/integration/unit_tests/uninstall.spec.ts b/cypress/e2e/unit_tests/uninstall.spec.ts similarity index 100% rename from cypress/integration/unit_tests/uninstall.spec.ts rename to cypress/e2e/unit_tests/uninstall.spec.ts diff --git a/cypress/support/index.ts b/cypress/support/e2e.ts similarity index 100% rename from cypress/support/index.ts rename to cypress/support/e2e.ts diff --git a/package-lock.json b/package-lock.json index b67213fb..bfe4c967 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,14 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "cypress": "^9.2.0", "cypress-dark": "^1.8.3", "cypress-file-upload": "^5.0.8", - "dotenv": "^10.0.0", - "typescript": "^4.5.2" + "dotenv": "^10.0.0" }, "devDependencies": { - "mochawesome": "^7.1.3" + "cypress": "^10.11.0", + "mochawesome": "^7.1.3", + "typescript": "^4.8.4" } }, "node_modules/@colors/colors": { @@ -592,9 +592,9 @@ } }, "node_modules/cypress": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz", - "integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==", + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz", + "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==", "hasInstallScript": true, "dependencies": { "@cypress/request": "^2.88.10", @@ -616,7 +616,7 @@ "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", @@ -803,9 +803,9 @@ } }, "node_modules/eventemitter2": { - "version": "6.4.9", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.9.tgz", - "integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==" + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", + "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==" }, "node_modules/execa": { "version": "4.1.0", @@ -2462,9 +2462,10 @@ } }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3064,9 +3065,9 @@ } }, "cypress": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.7.0.tgz", - "integrity": "sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q==", + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.11.0.tgz", + "integrity": "sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==", "requires": { "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", @@ -3087,7 +3088,7 @@ "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", @@ -3225,9 +3226,9 @@ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "eventemitter2": { - "version": "6.4.9", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.9.tgz", - "integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==" + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", + "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==" }, "execa": { "version": "4.1.0", @@ -4449,9 +4450,10 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==" + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "dev": true }, "universalify": { "version": "2.0.0", diff --git a/package.json b/package.json index 181fc808..fd7d3f94 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "epinio-end-to-end-tests", "version": "1.0.0", "description": "Cypress tests to test the Epinio UI", - "main": "index.js", + "main": "index.ts", "directories": { "doc": "docs" }, @@ -21,13 +21,13 @@ }, "homepage": "https://github.com/epinio/epinio-end-to-end-tests#readme", "dependencies": { - "cypress": "^9.2.0", "cypress-dark": "^1.8.3", "cypress-file-upload": "^5.0.8", - "dotenv": "^10.0.0", - "typescript": "^4.5.2" + "dotenv": "^10.0.0" }, "devDependencies": { - "mochawesome": "^7.1.3" + "cypress": "^10.11.0", + "mochawesome": "^7.1.3", + "typescript": "^4.8.4" } } diff --git a/scripts/get_ca.sh b/scripts/get_ca.sh index 97e3b2f5..47361c60 100755 --- a/scripts/get_ca.sh +++ b/scripts/get_ca.sh @@ -18,6 +18,6 @@ for I in crt key; do FILE="${DATA_PATH}/${CA_NAME}-${I}-pem.file" echo "${VALUE}" > ${FILE} - # And update cypress.json - sed -i "s|%${I}%|${FILE}|g" cypress.json + # And update cypress.config.ts + sed -i "s|%${I}%|${FILE}|g" cypress.config.ts done diff --git a/scripts/start_cypress_tests.sh b/scripts/start_cypress_tests.sh index bc05e68a..856b1a30 100755 --- a/scripts/start_cypress_tests.sh +++ b/scripts/start_cypress_tests.sh @@ -16,4 +16,5 @@ docker run -v $PWD:/e2e -w /e2e \ $CYPRESS_DOCKER \ -C /e2e/$CYPRESS_CFG \ -b $BROWSER \ - -s /e2e/$SPEC + # -s /e2e/$SPEC + -s $SPEC