mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-17 17:56:27 +00:00
Major update to cypress
- Updated cypress - Ground work for testing DNS certs in CI
This commit is contained in:
@ -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*/) => {
|
Reference in New Issue
Block a user