diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 0f2a74474..c29a6d2b1 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: run-cypress: - name: "Runs integration tests in cypress" + name: 'Runs integration tests in cypress' runs-on: ubuntu-latest steps: - name: Check out code @@ -15,8 +15,11 @@ jobs: - name: Build and run OS4 Dev run: make run-dev ARGS="-d" - - name: Run integration tests (cypress docker) - run: make cypress-docker - - - name: Stop OS4 - run: make stop-dev + - name: Run integration tests (cypress) + uses: cypress-io/github-action@v2 + with: + working-directory: integration + wait-on: 'https://localhost:8000' + wait-on-timeout: 300 + env: + NODE_TLS_REJECT_UNAUTHORIZED: 0 diff --git a/integration/Dockerfile b/integration/Dockerfile index 1b4fdc124..48e02b305 100644 --- a/integration/Dockerfile +++ b/integration/Dockerfile @@ -1,9 +1,12 @@ -FROM cypress/included:8.4.0 +FROM cypress/base:10 WORKDIR /app +COPY package.json package.json +COPY package-lock.json package-lock.json +RUN npm ci -COPY ./cypress ./cypress/ COPY ./cypress-docker.json ./cypress.json +COPY ./resource-config-docker.js ./resource-config.js +COPY ./cypress ./cypress/ -COPY entrypoint.sh /usr/local/bin/entrypoint -ENTRYPOINT entrypoint +CMD ["npm", "run", "cypress:run"] \ No newline at end of file diff --git a/integration/cypress-docker.json b/integration/cypress-docker.json index 1c608e331..0c496513d 100644 --- a/integration/cypress-docker.json +++ b/integration/cypress-docker.json @@ -1,3 +1,3 @@ { - "baseUrl": "https://host.docker.internal:8000" + "baseUrl": "https://host.docker.internal:8000" } diff --git a/integration/cypress.json b/integration/cypress.json index bc1fb6dc4..477c6ade2 100644 --- a/integration/cypress.json +++ b/integration/cypress.json @@ -1,6 +1,6 @@ { - "baseUrl": "https://localhost:8000", - "screenshotsFolder": "results/screenshots", - "videosFolder": "results/videos", - "downloadsFolder": "results/downloads" + "baseUrl": "https://localhost:8000", + "screenshotsFolder": "results/screenshots", + "videosFolder": "results/videos", + "downloadsFolder": "results/downloads" } diff --git a/integration/cypress/integration/committee-update.spec.js b/integration/cypress/integration/committee-update.spec.js index 6d91b81e7..dacf05f6c 100644 --- a/integration/cypress/integration/committee-update.spec.js +++ b/integration/cypress/integration/committee-update.spec.js @@ -1,4 +1,4 @@ -describe("Update a committee", () => { +describe('Update a committee', () => { let committeeName; let committeeId; @@ -10,16 +10,16 @@ describe("Update a committee", () => { name: committeeName, manager_ids: [1], }; - cy.os4request("committee.create", committeeData).then((res) => { + cy.os4request('committee.create', committeeData).then((res) => { committeeId = res.id; }); - cy.visit("/committees/"); + cy.visit('/committees/'); }); - it("Has new Committee", () => { + it('Has new Committee', () => { cy.visit(`/committees/${committeeId}`); - cy.url().should("include", committeeId); - cy.get("h1").contains(committeeName); + cy.url().should('include', committeeId); + cy.get('h1').contains(committeeName); }); /** @@ -30,7 +30,7 @@ describe("Update a committee", () => { // cy.url().should("include", `${committeeId}/edit-committee`); // cy.get(".title-slot").contains("Edit committee"); // cy.get("#mat-input-0").type("edit"); - + // // cy.intercept({ // // method: "POST", // // url: "/system/action/handle_request", diff --git a/integration/entrypoint.sh b/integration/entrypoint.sh deleted file mode 100755 index b5b749e14..000000000 --- a/integration/entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# ------------------------------------------------------------------- -# Copyright (C) 2020 by Intevation GmbH -# Author(s): -# Sean Engelhardt -# -# This program is distributed under the MIT license, as described -# in the LICENSE file included with the distribution. -# SPDX-License-Identifier: MIT -# ------------------------------------------------------------------- - -HOST="https://host.docker.internal:8000" - -echo "wait until OpenSlides is up" -until [[ $(curl -k -s -o /dev/null -w %{http_code} $HOST) -eq 200 ]]; -do - sleep 5 -done -echo ready - -exec npx cypress run \ No newline at end of file diff --git a/integration/package-lock.json b/integration/package-lock.json index 65e894fed..644ea02fe 100644 --- a/integration/package-lock.json +++ b/integration/package-lock.json @@ -5,7 +5,8 @@ "packages": { "": { "devDependencies": { - "cypress": "8.4.0" + "cypress": "8.4.0", + "wait-on": "^6.0.0" } }, "node_modules/@cypress/request": { @@ -57,6 +58,42 @@ "ms": "^2.1.1" } }, + "node_modules/@hapi/hoek": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", + "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==", + "dev": true + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==", + "dev": true + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, "node_modules/@types/node": { "version": "14.17.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.12.tgz", @@ -245,6 +282,15 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -750,6 +796,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/follow-redirects": { + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1046,6 +1112,19 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "node_modules/joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -1761,6 +1840,40 @@ "extsprintf": "^1.2.0" } }, + "node_modules/wait-on": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-6.0.0.tgz", + "integrity": "sha512-tnUJr9p5r+bEYXPUdRseolmz5XqJTTj98JgOsfBn7Oz2dxfE2g3zw1jE+Mo8lopM3j3et/Mq1yW7kKX6qw7RVw==", + "dev": true, + "dependencies": { + "axios": "^0.21.1", + "joi": "^17.4.0", + "lodash": "^4.17.21", + "minimist": "^1.2.5", + "rxjs": "^7.1.0" + }, + "bin": { + "wait-on": "bin/wait-on" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/wait-on/node_modules/rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "dev": true, + "dependencies": { + "tslib": "~2.1.0" + } + }, + "node_modules/wait-on/node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1859,6 +1972,42 @@ } } }, + "@hapi/hoek": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz", + "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw==", + "dev": true + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==", + "dev": true + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, "@types/node": { "version": "14.17.12", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.12.tgz", @@ -1996,6 +2145,15 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dev": true, + "requires": { + "follow-redirects": "^1.14.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2397,6 +2555,12 @@ "escape-string-regexp": "^1.0.5" } }, + "follow-redirects": { + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", + "dev": true + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -2616,6 +2780,19 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, + "joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -3160,6 +3337,36 @@ "extsprintf": "^1.2.0" } }, + "wait-on": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-6.0.0.tgz", + "integrity": "sha512-tnUJr9p5r+bEYXPUdRseolmz5XqJTTj98JgOsfBn7Oz2dxfE2g3zw1jE+Mo8lopM3j3et/Mq1yW7kKX6qw7RVw==", + "dev": true, + "requires": { + "axios": "^0.21.1", + "joi": "^17.4.0", + "lodash": "^4.17.21", + "minimist": "^1.2.5", + "rxjs": "^7.1.0" + }, + "dependencies": { + "rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "dev": true, + "requires": { + "tslib": "~2.1.0" + } + }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + } + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/integration/package.json b/integration/package.json index bf78a49e8..2ec90bd5b 100644 --- a/integration/package.json +++ b/integration/package.json @@ -1,9 +1,10 @@ { "scripts": { "cypress:open": "cypress open", - "cypress:run": "cypress run" + "cypress:run": "wait-on -c resource-config.js && cypress run" }, "devDependencies": { - "cypress": "8.4.0" + "cypress": "8.4.0", + "wait-on": "^6.0.0" } } diff --git a/integration/resource-config-docker.js b/integration/resource-config-docker.js new file mode 100644 index 000000000..724c78cab --- /dev/null +++ b/integration/resource-config-docker.js @@ -0,0 +1,5 @@ +module.exports = { + strictSSL: false, + followRedirect: true, + resources: ['https://host.docker.internal:8000'], +}; diff --git a/integration/resource-config.js b/integration/resource-config.js new file mode 100644 index 000000000..53a8b2436 --- /dev/null +++ b/integration/resource-config.js @@ -0,0 +1,5 @@ +module.exports = { + strictSSL: false, + followRedirect: true, + resources: ['https://localhost:8000'], +};