forked from swagger-api/swagger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid too many repeatations
- Loading branch information
Showing
6 changed files
with
71 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Web driver manager | ||
*/ | ||
|
||
var webdriver = require('selenium-webdriver'); | ||
|
||
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build(); | ||
|
||
module.exports = driver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Swagger UI and Specs Servers | ||
*/ | ||
var path = require('path') | ||
var createServer = require('http-server').createServer; | ||
|
||
var dist = path.join(__dirname, '..', '..', 'dist'); | ||
var specs = path.join(__dirname, '..', '..', 'test', 'specs'); | ||
var DOCS_PORT = 8080; | ||
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.listen(DOCS_PORT); | ||
specServer.listen(SPEC_SERVER_PORT); | ||
|
||
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation) | ||
var url = 'http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation; | ||
|
||
setTimeout(function(){ | ||
driver.get(url); | ||
done(); | ||
}, 3000); | ||
}; | ||
|
||
module.exports.close = function(){ | ||
swaggerUI.close(); | ||
specServer.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--recursive | ||
--recursive --timeout 5000 |