From c6b64b3d6d34bc1481b8e8f987c3577abe49e206 Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Mon, 6 Feb 2023 10:58:53 +0000 Subject: [PATCH 01/13] Testing initial synchronisation with dev team. Added README_QE.md file. --- README_QE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 README_QE.md diff --git a/README_QE.md b/README_QE.md new file mode 100644 index 000000000..1a1601199 --- /dev/null +++ b/README_QE.md @@ -0,0 +1,10 @@ +## README_QE + +# Hi! +Here you will find anything from the QE team that +is worth checking from time to time. +We will update this in-line with the project. + + + + From 817403a11cd854db09671b037e35418a20662947 Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 14:47:26 +0000 Subject: [PATCH 02/13] jest --- .github/workflows/cypress_test.yml | 0 .github/workflows/jest_test.yml | 30 ++++++++++++++++++++++++++ package-lock.json | 34 ++++++++++++++++++++++++++++++ package.json | 1 + 4 files changed, 65 insertions(+) create mode 100644 .github/workflows/cypress_test.yml create mode 100644 .github/workflows/jest_test.yml diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/jest_test.yml b/.github/workflows/jest_test.yml new file mode 100644 index 000000000..602142a7f --- /dev/null +++ b/.github/workflows/jest_test.yml @@ -0,0 +1,30 @@ + +name: Jest Unit Tests +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x] + mongodb-version: ['4.2', '4.4', '5.0'] + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.7.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - run: npm ci + - run: npm run + - run: npm run test:unit + env: + CI: true \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 27002c86c..7453c5bc3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "mongodb": "^3.4.1", "mongoose": "^5.8.11", "morgan": "~1.9.1", + "node": "^19.6.0", "nodemon": "^2.0.15" }, "devDependencies": { @@ -5914,6 +5915,26 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/node": { + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/node/-/node-19.6.0.tgz", + "integrity": "sha512-jbdClWIsgsEVutra596SgggvcNm4Nwrh1WYszNBe/6QHBu+1KJTTsQCju0tuOg1BF2lIHjJ/YP0H7wv8GfUfLw==", + "hasInstallScript": true, + "dependencies": { + "node-bin-setup": "^1.0.0" + }, + "bin": { + "node": "bin/node" + }, + "engines": { + "npm": ">=5.0.0" + } + }, + "node_modules/node-bin-setup": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz", + "integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg==" + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -12341,6 +12362,19 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node": { + "version": "19.6.0", + "resolved": "https://registry.npmjs.org/node/-/node-19.6.0.tgz", + "integrity": "sha512-jbdClWIsgsEVutra596SgggvcNm4Nwrh1WYszNBe/6QHBu+1KJTTsQCju0tuOg1BF2lIHjJ/YP0H7wv8GfUfLw==", + "requires": { + "node-bin-setup": "^1.0.0" + } + }, + "node-bin-setup": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz", + "integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg==" + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/package.json b/package.json index b0b63690e..1f649b8db 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "mongodb": "^3.4.1", "mongoose": "^5.8.11", "morgan": "~1.9.1", + "node": "^19.6.0", "nodemon": "^2.0.15" }, "devDependencies": { From c1adc371fdb2b079d42c4afd80e68835efc17663 Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 15:04:05 +0000 Subject: [PATCH 03/13] workflow changes --- .github/workflows/cypress_test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index e69de29bb..fc8f49d15 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -0,0 +1,14 @@ +name: Cypress Tests +on: [push] +jobs: + Cypress-Test: + runs-on: ubuntu-latest + steps: + - name: Checkout GitCode + uses: actions/checkout@v2 + + - name: Run Cypress Test + uses: cypress-io/github-action@v4 + with: + command: npm run test:integration + browser: chrome \ No newline at end of file From 545ca9292484212c298e26ec26b3c62c9a333f2c Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 15:07:50 +0000 Subject: [PATCH 04/13] workflow changes --- .github/workflows/cypress_test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index fc8f49d15..beb799658 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -9,6 +9,12 @@ jobs: - name: Run Cypress Test uses: cypress-io/github-action@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.7.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} with: command: npm run test:integration browser: chrome \ No newline at end of file From 4d82d9cecf2a50a38fbb9ee591761a478bb0f88b Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 15:18:02 +0000 Subject: [PATCH 05/13] workflow changes cypress --- .github/workflows/cypress_test.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index beb799658..d04f97e23 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -10,11 +10,5 @@ jobs: - name: Run Cypress Test uses: cypress-io/github-action@v4 with: - node-version: ${{ matrix.node-version }} - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.7.0 - with: - mongodb-version: ${{ matrix.mongodb-version }} - with: - command: npm run test:integration + command: npx cypress run browser: chrome \ No newline at end of file From 82672cecaefde8b12396e8dd5ba858b4b47b5d5a Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 15:22:51 +0000 Subject: [PATCH 06/13] workflow changes cypress server task --- .github/workflows/cypress_test.yml | 42 +++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index d04f97e23..3d26ef9f4 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -11,4 +11,44 @@ jobs: uses: cypress-io/github-action@v4 with: command: npx cypress run - browser: chrome \ No newline at end of file + browser: chrome + - name: start server + uses: cypress-io/github-action@v4.1.0 # use the explicit version number + with: + wait-on: "http://localhost:3030" + config-file: cypress.config.cjs + + + + + + + +# name: Cypress Tests + +# on: [push] + +# jobs: +# cypress-run: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# build: npm run build +# # Install NPM dependencies, cache them correctly +# # and run all Cypress tests +# - name: Create mongoDB Docker container +# run: sudo docker run -d -p 27017:27017 mongo:latest +# - name: start server +# uses: cypress-io/github-action@v4.1.0 # use the explicit version number +# with: +# wait-on: "http://localhost:8888" +# config-file: cypress.config.cjs +# # build: npm run build +# start: netlify dev +# env: +# MONGODB_URI: "mongodb://0.0.0.0:27017/" +# MONGODB_DATABASE: "gladiators" +# - name: run cypress component test +# run: npx cypress run --component \ No newline at end of file From 301ef66a55b74d19a68f5ab7f6b3f089e175f5cc Mon Sep 17 00:00:00 2001 From: Ibrahim Pala Date: Tue, 7 Feb 2023 15:32:08 +0000 Subject: [PATCH 07/13] workflow changes --- .github/workflows/cypress_test.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index 3d26ef9f4..4dbebe782 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -6,17 +6,18 @@ jobs: steps: - name: Checkout GitCode uses: actions/checkout@v2 + - name: Install and run MongoDB + uses: docker://mongo + with: + args: --name my-mongo-instance -p 27017:27017 + - name: Install dependencies + run: npm install + - name: Run Tests + run: npx cypress run + + - - name: Run Cypress Test - uses: cypress-io/github-action@v4 - with: - command: npx cypress run - browser: chrome - - name: start server - uses: cypress-io/github-action@v4.1.0 # use the explicit version number - with: - wait-on: "http://localhost:3030" - config-file: cypress.config.cjs + From 81a081f5c781ca04eb219e0a7794393561aded9e Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 15:49:50 +0000 Subject: [PATCH 08/13] Testing Cypress Integration tests --- .github/workflows/cypress_test.yml | 48 ++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index 4dbebe782..ee174df8b 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -1,22 +1,38 @@ +# name: Cypress Tests +# on: [push] +# jobs: +# Cypress-Test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout GitCode +# uses: actions/checkout@v2 +# - name: Install and run MongoDB +# uses: docker://mongo +# with: +# args: --name my-mongo-instance -p 27017:27017 +# - name: Install dependencies +# run: npm install +# - name: Run Tests +# run: npx cypress run + + name: Cypress Tests + on: [push] + jobs: - Cypress-Test: - runs-on: ubuntu-latest - steps: - - name: Checkout GitCode - uses: actions/checkout@v2 - - name: Install and run MongoDB - uses: docker://mongo - with: - args: --name my-mongo-instance -p 27017:27017 - - name: Install dependencies - run: npm install - - name: Run Tests - run: npx cypress run - - - + cypress-run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + # Install NPM dependencies, cache them correctly + # and run all Cypress tests + - name: Cypress run + uses: cypress-io/github-action@v5.x.x # use the explicit version number + with: + build: npm run build + start: npm start From 4f66284df722164c6061aa4a4c22ddb617dff520 Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 15:58:05 +0000 Subject: [PATCH 09/13] Cypress test version 5 testing --- .github/workflows/cypress_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index ee174df8b..59711e96e 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -29,7 +29,7 @@ jobs: # Install NPM dependencies, cache them correctly # and run all Cypress tests - name: Cypress run - uses: cypress-io/github-action@v5.x.x # use the explicit version number + uses: cypress-io/github-action@v5 # use the explicit version number with: build: npm run build start: npm start From 85e51b14051b2aa6d2a38d85bc2562a71e725875 Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 16:08:57 +0000 Subject: [PATCH 10/13] Testing Cypress without Jest tests. --- .github/workflows/cypress_test.yml | 73 ++++++------------------------ .github/workflows/jest_test.yml | 56 +++++++++++------------ 2 files changed, 43 insertions(+), 86 deletions(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index 59711e96e..0c2c3fb48 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -1,21 +1,3 @@ -# name: Cypress Tests -# on: [push] -# jobs: -# Cypress-Test: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout GitCode -# uses: actions/checkout@v2 -# - name: Install and run MongoDB -# uses: docker://mongo -# with: -# args: --name my-mongo-instance -p 27017:27017 -# - name: Install dependencies -# run: npm install -# - name: Run Tests -# run: npx cypress run - - name: Cypress Tests on: [push] @@ -26,46 +8,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + build: npm run build # Install NPM dependencies, cache them correctly # and run all Cypress tests - - name: Cypress run - uses: cypress-io/github-action@v5 # use the explicit version number + - name: Create mongoDB Docker container + run: sudo docker run -d -p 27017:27017 mongo:latest + - name: start server + uses: cypress-io/github-action@v4.1.0 # use the explicit version number with: - build: npm run build - start: npm start - - - - - - - - -# name: Cypress Tests - -# on: [push] - -# jobs: -# cypress-run: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# with: -# build: npm run build -# # Install NPM dependencies, cache them correctly -# # and run all Cypress tests -# - name: Create mongoDB Docker container -# run: sudo docker run -d -p 27017:27017 mongo:latest -# - name: start server -# uses: cypress-io/github-action@v4.1.0 # use the explicit version number -# with: -# wait-on: "http://localhost:8888" -# config-file: cypress.config.cjs -# # build: npm run build -# start: netlify dev -# env: -# MONGODB_URI: "mongodb://0.0.0.0:27017/" -# MONGODB_DATABASE: "gladiators" -# - name: run cypress component test -# run: npx cypress run --component \ No newline at end of file + wait-on: "http://localhost:3030" + config-file: cypress.config.cjs + # build: npm run build + start: npm run start:test + env: + MONGODB_URI: "mongodb://0.0.0.0:27017/" + MONGODB_DATABASE: "acebook_test" + - name: run cypress component test + run: npm run test:unit \ No newline at end of file diff --git a/.github/workflows/jest_test.yml b/.github/workflows/jest_test.yml index 602142a7f..f4d2cbfb9 100644 --- a/.github/workflows/jest_test.yml +++ b/.github/workflows/jest_test.yml @@ -1,30 +1,30 @@ -name: Jest Unit Tests -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +# name: Jest Unit Tests +# on: +# push: +# branches: [ QE-github-workflow ] +# pull_request: +# branches: [ QE-github-workflow ] -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [16.x] - mongodb-version: ['4.2', '4.4', '5.0'] - steps: - - uses: actions/checkout@v3 - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.7.0 - with: - mongodb-version: ${{ matrix.mongodb-version }} - - run: npm ci - - run: npm run - - run: npm run test:unit - env: - CI: true \ No newline at end of file +# jobs: +# build: +# runs-on: ubuntu-latest +# strategy: +# matrix: +# node-version: [16.4.2] +# # mongodb-version: ['4.2', '4.4', '5.0'] +# steps: +# - uses: actions/checkout@v3 +# - name: Setup Node.js ${{ matrix.node-version }} +# uses: actions/setup-node@v3 +# with: +# node-version: ${{ matrix.node-version }} +# - name: Start MongoDB +# uses: supercharge/mongodb-github-action@1.7.0 +# with: +# mongodb-version: ${{ matrix.mongodb-version }} +# - run: npm ci +# - run: npm run +# - run: npm run test:unit +# env: +# CI: true \ No newline at end of file From 78204891cd66ec5a1ea6732084bca4bfddc4b27a Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 16:13:05 +0000 Subject: [PATCH 11/13] Added cypress config file --- cypress.config.cjs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 cypress.config.cjs diff --git a/cypress.config.cjs b/cypress.config.cjs new file mode 100644 index 000000000..8ab53753a --- /dev/null +++ b/cypress.config.cjs @@ -0,0 +1,10 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + component: { + devServer: { + framework: "node" + }, + }, + e2e: { + baseUrl: "http://localhost:3030"}}) \ No newline at end of file From 57ceca7502062dcefeb34a1858896b1d941aa8a4 Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 16:58:11 +0000 Subject: [PATCH 12/13] Change names of tests within cypress_test.yml file --- .github/workflows/cypress_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_test.yml index 0c2c3fb48..7b6481957 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_test.yml @@ -14,7 +14,7 @@ jobs: # and run all Cypress tests - name: Create mongoDB Docker container run: sudo docker run -d -p 27017:27017 mongo:latest - - name: start server + - name: run cypress integration tests uses: cypress-io/github-action@v4.1.0 # use the explicit version number with: wait-on: "http://localhost:3030" @@ -24,5 +24,5 @@ jobs: env: MONGODB_URI: "mongodb://0.0.0.0:27017/" MONGODB_DATABASE: "acebook_test" - - name: run cypress component test + - name: run jest unit tests run: npm run test:unit \ No newline at end of file From 3b83d075be7cf54205fbe3f5aa0127e7bed86194 Mon Sep 17 00:00:00 2001 From: Daniel Macleod Date: Tue, 7 Feb 2023 17:02:48 +0000 Subject: [PATCH 13/13] Changed filename to relate to both Cypress & Jest. --- ...ess_test.yml => cypress_and_jest_test.yml} | 2 +- .github/workflows/jest_test.yml | 30 ------------------- 2 files changed, 1 insertion(+), 31 deletions(-) rename .github/workflows/{cypress_test.yml => cypress_and_jest_test.yml} (96%) delete mode 100644 .github/workflows/jest_test.yml diff --git a/.github/workflows/cypress_test.yml b/.github/workflows/cypress_and_jest_test.yml similarity index 96% rename from .github/workflows/cypress_test.yml rename to .github/workflows/cypress_and_jest_test.yml index 7b6481957..e9c4810be 100644 --- a/.github/workflows/cypress_test.yml +++ b/.github/workflows/cypress_and_jest_test.yml @@ -1,4 +1,4 @@ -name: Cypress Tests +name: Cypress and Jest Tests on: [push] diff --git a/.github/workflows/jest_test.yml b/.github/workflows/jest_test.yml deleted file mode 100644 index f4d2cbfb9..000000000 --- a/.github/workflows/jest_test.yml +++ /dev/null @@ -1,30 +0,0 @@ - -# name: Jest Unit Tests -# on: -# push: -# branches: [ QE-github-workflow ] -# pull_request: -# branches: [ QE-github-workflow ] - -# jobs: -# build: -# runs-on: ubuntu-latest -# strategy: -# matrix: -# node-version: [16.4.2] -# # mongodb-version: ['4.2', '4.4', '5.0'] -# steps: -# - uses: actions/checkout@v3 -# - name: Setup Node.js ${{ matrix.node-version }} -# uses: actions/setup-node@v3 -# with: -# node-version: ${{ matrix.node-version }} -# - name: Start MongoDB -# uses: supercharge/mongodb-github-action@1.7.0 -# with: -# mongodb-version: ${{ matrix.mongodb-version }} -# - run: npm ci -# - run: npm run -# - run: npm run test:unit -# env: -# CI: true \ No newline at end of file