Added upstreams tests for cypress
This commit is contained in:
parent
e39f18b0d1
commit
882674867c
@ -12,7 +12,7 @@ describe('Settings endpoints', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to create new settting', function() {
|
||||
it('Should be able to create new setting', function() {
|
||||
cy.task('backendApiPost', {
|
||||
token: token,
|
||||
path: '/api/settings',
|
||||
@ -31,7 +31,7 @@ describe('Settings endpoints', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to get a settting', function() {
|
||||
it('Should be able to get a setting', function() {
|
||||
cy.task('backendApiGet', {
|
||||
token: token,
|
||||
path: '/api/settings/' + settingName
|
||||
@ -44,7 +44,7 @@ describe('Settings endpoints', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to update a settting', function() {
|
||||
it('Should be able to update a setting', function() {
|
||||
cy.task('backendApiPut', {
|
||||
token: token,
|
||||
path: '/api/settings/' + settingName,
|
||||
|
67
test/cypress/integration/api/Upstreams.spec.js
Normal file
67
test/cypress/integration/api/Upstreams.spec.js
Normal file
@ -0,0 +1,67 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
describe('Upstream endpoints', () => {
|
||||
let token;
|
||||
let upstreamId;
|
||||
|
||||
before(() => {
|
||||
cy.getToken().then((tok) => {
|
||||
token = tok;
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to create new Upstream', function() {
|
||||
cy.task('backendApiPost', {
|
||||
token: token,
|
||||
path: '/api/upstreams',
|
||||
data: {
|
||||
nginx_template_id: 5,
|
||||
name: 'CypressGeneratedUpstreamA',
|
||||
// These servers must be reachable by the Cypress CI stack!
|
||||
servers: [
|
||||
{
|
||||
|
||||
server: 'fullstack:80',
|
||||
weight: 100
|
||||
},
|
||||
{
|
||||
server: 'fullstack:443',
|
||||
weight: 50
|
||||
}
|
||||
]
|
||||
}
|
||||
}).then((data) => {
|
||||
// Check the swagger schema:
|
||||
cy.validateSwaggerSchema('post', 201, '/upstreams', data);
|
||||
expect(data.result).to.have.property('id');
|
||||
expect(data.result.id).to.be.greaterThan(0);
|
||||
upstreamId = data.result.id;
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to get a Upstream', function() {
|
||||
cy.task('backendApiGet', {
|
||||
token: token,
|
||||
path: '/api/upstreams/' + upstreamId
|
||||
}).then((data) => {
|
||||
// Check the swagger schema:
|
||||
cy.validateSwaggerSchema('get', 200, '/upstreams/{upstreamID}', data);
|
||||
expect(data.result).to.have.property('id');
|
||||
expect(data.result).to.have.property('name', 'CypressGeneratedUpstreamA');
|
||||
expect(data.result.id).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to get all Upstreams', function() {
|
||||
cy.task('backendApiGet', {
|
||||
token: token,
|
||||
path: '/api/upstreams'
|
||||
}).then((data) => {
|
||||
cy.validateSwaggerSchema('get', 200, '/upstreams', data);
|
||||
expect(data).to.have.property('result');
|
||||
expect(data.result).to.have.property('items');
|
||||
expect(data.result.items.length).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user