You've already forked nginx-proxy-manager
							
							
				mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 18:05:34 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			126 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			126 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /// <reference types="cypress" />
 | |
| 
 | |
| describe('Settings endpoints', () => {
 | |
| 	let token;
 | |
| 
 | |
| 	before(() => {
 | |
| 		cy.resetUsers();
 | |
| 		cy.getToken().then((tok) => {
 | |
| 			token = tok;
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Get all settings', () => {
 | |
| 		cy.task('backendApiGet', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings',
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('get', 200, '/settings', data);
 | |
| 			expect(data.length).to.be.greaterThan(0);
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Get default-site setting', () => {
 | |
| 		cy.task('backendApiGet', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('get', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Default Site congratulations', () => {
 | |
| 		cy.task('backendApiPut', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 			data: {
 | |
| 				value: 'congratulations',
 | |
| 			},
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 			expect(data).to.have.property('value');
 | |
| 			expect(data.value).to.be.equal('congratulations');
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Default Site 404', () => {
 | |
| 		cy.task('backendApiPut', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 			data: {
 | |
| 				value: '404',
 | |
| 			},
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 			expect(data).to.have.property('value');
 | |
| 			expect(data.value).to.be.equal('404');
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Default Site 444', () => {
 | |
| 		cy.task('backendApiPut', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 			data: {
 | |
| 				value: '444',
 | |
| 			},
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 			expect(data).to.have.property('value');
 | |
| 			expect(data.value).to.be.equal('444');
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Default Site redirect', () => {
 | |
| 		cy.task('backendApiPut', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 			data: {
 | |
| 				value: 'redirect',
 | |
| 				meta: {
 | |
| 					redirect: 'https://www.google.com',
 | |
| 				},
 | |
| 			},
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 			expect(data).to.have.property('value');
 | |
| 			expect(data.value).to.be.equal('redirect');
 | |
| 			expect(data).to.have.property('meta');
 | |
| 			expect(data.meta).to.have.property('redirect');
 | |
| 			expect(data.meta.redirect).to.be.equal('https://www.google.com');
 | |
| 		});
 | |
| 	});
 | |
| 
 | |
| 	it('Default Site html', () => {
 | |
| 		cy.task('backendApiPut', {
 | |
| 			token: token,
 | |
| 			path:  '/api/settings/default-site',
 | |
| 			data: {
 | |
| 				value: 'html',
 | |
| 				meta: {
 | |
| 					html: '<p>hello world</p>'
 | |
| 				},
 | |
| 			},
 | |
| 		}).then((data) => {
 | |
| 			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | |
| 			expect(data).to.have.property('id');
 | |
| 			expect(data.id).to.be.equal('default-site');
 | |
| 			expect(data).to.have.property('value');
 | |
| 			expect(data.value).to.be.equal('html');
 | |
| 			expect(data).to.have.property('meta');
 | |
| 			expect(data.meta).to.have.property('html');
 | |
| 			expect(data.meta.html).to.be.equal('<p>hello world</p>');
 | |
| 		});
 | |
| 	});
 | |
| });
 |