Merge branch 'develop_2.0' into JSONEditor
Conflicts: dist/index.html dist/swagger-ui.js dist/swagger-ui.min.js src/main/coffeescript/view/MainView.coffee src/main/coffeescript/view/OperationView.coffee src/main/coffeescript/view/ParameterView.coffee src/main/coffeescript/view/ResourceView.coffee src/main/coffeescript/view/SignatureView.coffee src/main/html/index.html
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Web driver manager
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var webdriver = require('selenium-webdriver');
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
* Swagger UI and Specs Servers
|
||||
*/
|
||||
var path = require('path')
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var createServer = require('http-server').createServer;
|
||||
|
||||
var dist = path.join(__dirname, '..', '..', 'dist');
|
||||
@@ -11,22 +13,17 @@ var SPEC_SERVER_PORT = 8081;
|
||||
|
||||
var driver = require('./driver');
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
|
||||
};
|
||||
|
||||
var swaggerUI;
|
||||
var specServer;
|
||||
|
||||
module.exports.start = function (specsLocation, done) {
|
||||
swaggerUI = createServer({ root: dist, headers: headers });
|
||||
specServer = createServer({ root: specs, headers: headers });
|
||||
swaggerUI = createServer({ root: dist, cors: true });
|
||||
specServer = createServer({ root: specs, cors: true });
|
||||
|
||||
swaggerUI.listen(DOCS_PORT);
|
||||
specServer.listen(SPEC_SERVER_PORT);
|
||||
|
||||
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation)
|
||||
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation);
|
||||
var url = 'http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation;
|
||||
|
||||
setTimeout(function(){
|
||||
@@ -35,7 +32,7 @@ module.exports.start = function (specsLocation, done) {
|
||||
}, process.env.TRAVIS ? 20000 : 3000);
|
||||
};
|
||||
|
||||
module.exports.close = function(){
|
||||
module.exports.close = function() {
|
||||
swaggerUI.close();
|
||||
specServer.close();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var expect = require('chai').expect;
|
||||
var driver = require('./driver');
|
||||
var servers = require('./servers');
|
||||
@@ -13,7 +15,7 @@ var elements = [
|
||||
'header'
|
||||
];
|
||||
|
||||
describe('swagger 1.x spec tests', function (done) {
|
||||
describe('swagger 1.x spec tests', function () {
|
||||
this.timeout(10 * 1000);
|
||||
|
||||
before(function (done) {
|
||||
@@ -27,8 +29,9 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
var errors = [];
|
||||
browserLogs.forEach(function(log){
|
||||
// 900 and above is "error" level. Console should not have any errors
|
||||
if (log.level.value > 900)
|
||||
if (log.level.value > 900) {
|
||||
console.log('browser error message:', log.message); errors.push(log);
|
||||
}
|
||||
});
|
||||
expect(errors).to.be.empty;
|
||||
done();
|
||||
@@ -46,7 +49,7 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
|
||||
elements.forEach(function (id) {
|
||||
it('should render element: ' + id, function (done) {
|
||||
var locator = webdriver.By.id(id)
|
||||
var locator = webdriver.By.id(id);
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -63,7 +66,7 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the pet link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='pet']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="pet"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -71,7 +74,7 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the pet resource description', function(done){
|
||||
var locator = webdriver.By.xpath("//div[contains(., 'Operations about pets')]");
|
||||
var locator = webdriver.By.xpath('//div[contains(., "Operations about pets")]');
|
||||
driver.findElements(locator).then(function (elements) {
|
||||
expect(elements.length).to.not.equal(0);
|
||||
done();
|
||||
@@ -79,7 +82,7 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the user link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='user']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="user"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -87,7 +90,7 @@ describe('swagger 1.x spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the store link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='store']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="store"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var expect = require('chai').expect;
|
||||
var webdriver = require('selenium-webdriver');
|
||||
var driver = require('./driver');
|
||||
@@ -14,7 +16,7 @@ var elements = [
|
||||
'header'
|
||||
];
|
||||
|
||||
describe('swagger 2.0 spec tests', function (done) {
|
||||
describe('swagger 2.0 spec tests', function () {
|
||||
this.timeout(10 * 1000);
|
||||
|
||||
before(function (done) {
|
||||
@@ -28,8 +30,9 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
var errors = [];
|
||||
browserLogs.forEach(function(log){
|
||||
// 900 and above is "error" level. Console should not have any errors
|
||||
if (log.level.value > 900)
|
||||
if (log.level.value > 900) {
|
||||
console.log('browser error message:', log.message); errors.push(log);
|
||||
}
|
||||
});
|
||||
expect(errors).to.be.empty;
|
||||
done();
|
||||
@@ -80,7 +83,7 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the pet link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='pet']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="pet"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -88,7 +91,7 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the pet resource description', function(done){
|
||||
var locator = webdriver.By.xpath("//div[contains(., 'Everything about your Pets')]");
|
||||
var locator = webdriver.By.xpath('//div[contains(., "Everything about your Pets")]');
|
||||
driver.findElements(locator).then(function (elements) {
|
||||
expect(elements.length).to.not.equal(0);
|
||||
done();
|
||||
@@ -96,7 +99,7 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the user link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='user']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="user"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -104,7 +107,7 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
|
||||
it('should find the store link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='store']");
|
||||
var locator = webdriver.By.xpath('//*[@data-id="store"]');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
@@ -121,6 +124,8 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO JSonEditor Tests for POST/PUT
|
||||
|
||||
after(function() {
|
||||
servers.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user