mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 07:43:33 +00:00 
			
		
		
		
	Major update to cypress
- Updated cypress - Ground work for testing DNS certs in CI
This commit is contained in:
		| @@ -1 +0,0 @@ | ||||
| node_modules | ||||
| @@ -73,4 +73,4 @@ | ||||
| 			} | ||||
| 		] | ||||
| 	} | ||||
| } | ||||
| } | ||||
|   | ||||
							
								
								
									
										6
									
								
								test/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								test/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,2 @@ | ||||
| .vscode | ||||
| node_modules | ||||
| results | ||||
| cypress/videos | ||||
| results/* | ||||
| cypress/results/* | ||||
|   | ||||
| @@ -1,13 +1,12 @@ | ||||
| FROM cypress/included:9.4.1 | ||||
| FROM cypress/included:13.9.0 | ||||
|  | ||||
| COPY --chown=1000 ./ /test | ||||
| COPY --chown=1000 ./test /test | ||||
|  | ||||
| # mkcert | ||||
| ENV MKCERT=1.4.2 | ||||
| RUN wget -O /usr/bin/mkcert "https://github.com/FiloSottile/mkcert/releases/download/v${MKCERT}/mkcert-v${MKCERT}-linux-amd64" \ | ||||
| 	&& chmod +x /usr/bin/mkcert | ||||
| # Disable Cypress CLI colors | ||||
| ENV FORCE_COLOR=0 | ||||
| ENV NO_COLOR=1 | ||||
|  | ||||
| WORKDIR /test | ||||
| RUN yarn install | ||||
| RUN yarn install && yarn cache clean | ||||
| ENTRYPOINT [] | ||||
| CMD ["cypress", "run"] | ||||
|   | ||||
							
								
								
									
										22
									
								
								test/cypress/config/ci.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/cypress/config/ci.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| const { defineConfig } = require('cypress'); | ||||
|  | ||||
| module.exports = defineConfig({ | ||||
| 	requestTimeout: 30000, | ||||
| 	defaultCommandTimeout: 20000, | ||||
| 	reporter: 'cypress-multi-reporters', | ||||
| 	reporterOptions: { | ||||
| 		configFile: 'multi-reporter.json' | ||||
| 	}, | ||||
| 	video: true, | ||||
| 	videosFolder: 'results/videos', | ||||
| 	screenshotsFolder: 'results/screenshots', | ||||
| 	e2e: { | ||||
| 		setupNodeEvents(on, config) { | ||||
| 			return require("../plugins/index.js")(on, config); | ||||
| 		}, | ||||
| 		env: { | ||||
| 			swaggerBase: '{{baseUrl}}/api/schema', | ||||
| 		}, | ||||
| 		baseUrl: 'http://localhost:1234', | ||||
| 	} | ||||
| }); | ||||
| @@ -1,14 +0,0 @@ | ||||
| { | ||||
| 	"requestTimeout": 30000, | ||||
| 	"defaultCommandTimeout": 20000, | ||||
| 	"reporter": "cypress-multi-reporters", | ||||
| 	"reporterOptions": { | ||||
| 		"configFile": "multi-reporter.json" | ||||
| 	}, | ||||
| 	"videosFolder": "results/videos", | ||||
| 	"screenshotsFolder": "results/screenshots", | ||||
| 	"env": { | ||||
| 		"swaggerBase": "{{baseUrl}}/api/schema", | ||||
| 		"RETRIES": 4 | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										22
									
								
								test/cypress/config/dev.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/cypress/config/dev.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| const { defineConfig } = require('cypress'); | ||||
|  | ||||
| module.exports = defineConfig({ | ||||
| 	requestTimeout: 30000, | ||||
| 	defaultCommandTimeout: 20000, | ||||
| 	reporter: 'cypress-multi-reporters', | ||||
| 	reporterOptions: { | ||||
| 		configFile: 'multi-reporter.json' | ||||
| 	}, | ||||
| 	video: false, | ||||
| 	videosFolder: 'results/videos', | ||||
| 	screenshotsFolder: 'results/screenshots', | ||||
| 	e2e: { | ||||
| 		setupNodeEvents(on, config) { | ||||
| 			return require("../plugins/index.js")(on, config); | ||||
| 		}, | ||||
| 		env: { | ||||
| 			swaggerBase: '{{baseUrl}}/api/schema', | ||||
| 		}, | ||||
| 		baseUrl: 'http://localhost:1234', | ||||
| 	} | ||||
| }); | ||||
| @@ -1,14 +0,0 @@ | ||||
| { | ||||
| 	"requestTimeout": 30000, | ||||
| 	"defaultCommandTimeout": 20000, | ||||
| 	"reporter": "cypress-multi-reporters", | ||||
| 	"reporterOptions": { | ||||
| 		"configFile": "multi-reporter.json" | ||||
| 	}, | ||||
| 	"videos": false, | ||||
| 	"screenshotsFolder": "results/screenshots", | ||||
| 	"env": { | ||||
| 		"swaggerBase": "{{baseUrl}}/api/schema", | ||||
| 		"RETRIES": 0 | ||||
| 	} | ||||
| } | ||||
| @@ -1,5 +0,0 @@ | ||||
| { | ||||
|   "name": "Using fixtures to represent data", | ||||
|   "email": "hello@cypress.io", | ||||
|   "body": "Fixtures are a great way to mock data for responses to routes" | ||||
| } | ||||
| @@ -1,8 +1,12 @@ | ||||
| const _     = require('lodash'); | ||||
| const chalk = require('chalk'); | ||||
| const _ = require("lodash"); | ||||
| const chalk = require("chalk"); | ||||
|  | ||||
| module.exports = function () { | ||||
| module.exports = function() { | ||||
| 	var arr = _.values(arguments); | ||||
| 	arr.unshift(chalk.blue.bold('[') + chalk.yellow.bold('Backend API') + chalk.blue.bold(']')); | ||||
| 	arr.unshift( | ||||
| 		chalk.blue.bold("[") + | ||||
| 			chalk.yellow.bold("Backend API") + | ||||
| 			chalk.blue.bold("]"), | ||||
| 	); | ||||
| 	console.log.apply(null, arr); | ||||
| }; | ||||
|   | ||||
| @@ -9,20 +9,32 @@ | ||||
| // *********************************************** | ||||
| // | ||||
|  | ||||
| import 'cypress-wait-until'; | ||||
|  | ||||
| Cypress.Commands.add('randomString', (length) => { | ||||
| 	var result           = ''; | ||||
| 	var characters       = 'ABCDEFGHIJK LMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||||
| 	var charactersLength = characters.length; | ||||
| 	for (var i = 0; i < length; i++) { | ||||
| 		result += characters.charAt(Math.floor(Math.random() * charactersLength)); | ||||
| 	} | ||||
| 	return result; | ||||
| }); | ||||
|  | ||||
| /** | ||||
|  * Check the swagger schema: | ||||
|  * | ||||
|  * @param {string}  method        API Method in swagger doc, "get", "put", "post", "delete" | ||||
|  * @param {number}  statusCode    API status code in swagger doc | ||||
|  * @param {integer} code          Swagger doc endpoint response code, exactly as defined in swagger doc | ||||
|  * @param {string}  path          Swagger doc endpoint path, exactly as defined in swagger doc | ||||
|  * @param {*}       data          The API response data to check against the swagger schema | ||||
|  */ | ||||
| Cypress.Commands.add('validateSwaggerSchema', (method, statusCode, path, data) => { | ||||
| Cypress.Commands.add('validateSwaggerSchema', (method, code, path, data) => { | ||||
| 	cy.task('validateSwaggerSchema', { | ||||
| 		file:           Cypress.env('swaggerBase'), | ||||
| 		endpoint:       path, | ||||
| 		method:         method, | ||||
| 		statusCode:     statusCode, | ||||
| 		statusCode:     code, | ||||
| 		responseSchema: data, | ||||
| 		verbose:        true | ||||
| 	}).should('equal', null); | ||||
| @@ -40,3 +52,19 @@ Cypress.Commands.add('getToken', () => { | ||||
| 		cy.wrap(res.token); | ||||
| 	}); | ||||
| }); | ||||
|  | ||||
| // TODO: copied from v3, is this usable? | ||||
| Cypress.Commands.add('waitForCertificateStatus', (token, certID, expected, timeout = 60) => { | ||||
| 	cy.log(`Waiting for certificate (${certID}) status (${expected}) timeout (${timeout})`); | ||||
|  | ||||
| 	cy.waitUntil(() => cy.task('backendApiGet', { | ||||
| 		token: token, | ||||
| 		path:  `/api/certificates/${certID}` | ||||
| 	}).then((data) => { | ||||
| 		return data.result.status === expected; | ||||
| 	}), { | ||||
| 		errorMsg: 'Waiting for certificate status failed', | ||||
| 		timeout:  timeout * 1000, | ||||
| 		interval: 5000 | ||||
| 	}); | ||||
| }); | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| require('cypress-plugin-retries'); | ||||
| 
 | ||||
| import './commands'; | ||||
| 
 | ||||
| Cypress.on('uncaught:exception', (/*err, runnable*/) => { | ||||
| @@ -3,4 +3,4 @@ | ||||
| 		"./node_modules/cypress", | ||||
| 		"cypress/**/*.js" | ||||
| 	] | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -4,19 +4,19 @@ | ||||
| 	"description": "", | ||||
| 	"main": "index.js", | ||||
| 	"dependencies": { | ||||
| 		"@jc21/cypress-swagger-validation": "^0.0.9", | ||||
| 		"@jc21/cypress-swagger-validation": "^0.2.6", | ||||
| 		"@jc21/restler": "^3.4.0", | ||||
| 		"chalk": "^4.1.0", | ||||
| 		"cypress": "^9.4.1", | ||||
| 		"cypress-multi-reporters": "^1.4.0", | ||||
| 		"cypress-plugin-retries": "^1.5.2", | ||||
| 		"eslint": "^7.6.0", | ||||
| 		"cypress": "^13.9.0", | ||||
| 		"cypress-multi-reporters": "^1.6.4", | ||||
| 		"cypress-wait-until": "^3.0.1", | ||||
| 		"eslint": "^9.3.0", | ||||
| 		"eslint-plugin-align-assignments": "^1.1.2", | ||||
| 		"eslint-plugin-chai-friendly": "^0.6.0", | ||||
| 		"eslint-plugin-cypress": "^2.11.1", | ||||
| 		"lodash": "^4.17.19", | ||||
| 		"mocha": "^8.1.1", | ||||
| 		"mocha-junit-reporter": "^2.0.0" | ||||
| 		"eslint-plugin-chai-friendly": "^0.7.4", | ||||
| 		"eslint-plugin-cypress": "^3.2.0", | ||||
| 		"lodash": "^4.17.21", | ||||
| 		"mocha": "^10.4.0", | ||||
| 		"mocha-junit-reporter": "^2.2.1" | ||||
| 	}, | ||||
| 	"scripts": { | ||||
| 		"cypress": "cypress open --config-file=cypress/config/dev.json --config baseUrl=${BASE_URL:-http://127.0.0.1:3081}", | ||||
|   | ||||
							
								
								
									
										1676
									
								
								test/yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										1676
									
								
								test/yarn.lock
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user