Use json-server to serve test specs in test:ci:e2e

This commit is contained in:
Kyle Shockey
2018-01-09 15:41:47 -06:00
parent 1187707611
commit 40a2646844
11 changed files with 28 additions and 26 deletions
+2 -2
View File
@@ -31,13 +31,13 @@
"test": "npm run lint:errors && npm run test:nodejs",
"test:ci": "npm-run-all lint:errors test:nodejs test:ci:e2e",
"test:browser": "karma start --config karma.conf.js",
"test:ci:e2e": "if [ \"$ENABLE_CI_E2E\" = \"true\" ]; then npm-run-all --parallel -r hot-server test:e2e:mock-api test:e2e:all:cbt; else exit 0; fi",
"test:ci:e2e": "if [ \"$ENABLE_CI_E2E\" = \"true\" ]; then npm-run-all --parallel -r test:e2e:mock-api test:e2e:all:cbt; else exit 0; fi",
"test:coverage": "nyc npm run test:nodejs",
"test:e2e": "npm-run-all --parallel -r hot-server test:e2e:mock-api test:e2e:all",
"test:e2e:all": "sleep 3 && nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json",
"test:e2e:all:cbt": "sleep 3 && nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch-cbt.json",
"test:e2e:initial-render": "nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json --group initial-render",
"test:e2e:mock-api": "json-server --watch test/e2e/db.json --port 3204",
"test:e2e:mock-api": "json-server --static test/e2e/specs --watch test/e2e/db.json --port 3204",
"test:nodejs": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package test/xss",
"watch": "webpack --config webpack-watch.config.js --watch --progress"
},
+2 -1
View File
@@ -3,7 +3,8 @@ var cbt = require("cbt_tunnels")
module.exports = {
baseUrl: "http://swagger-ui-ci-asset-deployment-test.surge.sh",
baseAppUrl: "http://swagger-ui-ci-asset-deployment-test.surge.sh",
specPath: "http://local:3204/petstore.json",
beforeEach: function(done) {
console.log("Starting up tunnel")
+2 -1
View File
@@ -1,5 +1,6 @@
var cbt = require("cbt_tunnels")
module.exports = {
baseUrl: "http://localhost:3200"
baseAppUrl: "http://localhost:3200",
specPath: "http://localhost:3200/test-specs/petstore.json"
}
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = {
version: {
selector: ".version"
},
baseUrl: {
baseAppUrl: {
selector: ".base-url"
},
mainUrl: {
+9 -9
View File
@@ -2,19 +2,19 @@ describe("render informationContainer", function () {
let mainPage
let informationContainer
beforeEach(function (client, done) {
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
informationContainer = mainPage.section.informationContainer
done()
})
@@ -28,9 +28,9 @@ describe("render informationContainer", function () {
informationContainer.waitForElementVisible("@title", 5000)
.assert.containsText("@title", "Swagger Petstore")
.assert.containsText("@version", "1.0.0")
.assert.containsText("@baseUrl", "[ Base URL: localhost:3204/ ]")
.assert.attributeEquals("@mainUrl", "href", client.globals.baseUrl + "/test-specs/petstore.json")
.assert.containsText("@mainUrlContent", client.globals.baseUrl + "/test-specs/petstore.json")
.assert.containsText("@baseAppUrl", "[ Base URL: localhost:3204/ ]")
.assert.attributeEquals("@mainUrl", "href", client.globals.specPath)
.assert.containsText("@mainUrlContent", client.globals.specPath)
.assert.containsText("@description", "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.")
.assert.attributeEquals("@swaggerUrl", "href", "http://swagger.io/")
.assert.attributeEquals("@swaggerircUrl", "href", "http://swagger.io/irc/")
@@ -42,7 +42,7 @@ describe("render informationContainer", function () {
.assert.containsText("@contactDevLink", "Contact the developer")
.assert.attributeEquals("@aboutSwaggerLink", "href", "http://swagger.io/")
.assert.containsText("@aboutSwaggerLink", "Find out more about Swagger")
client.end()
})
})
})
+2 -2
View File
@@ -3,12 +3,12 @@ describe("Render Model Wrapper", function () {
beforeEach(function (client, done) {
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
+2 -2
View File
@@ -3,13 +3,13 @@ describe("render pet api container", function () {
let apiWrapper
beforeEach(function (client, done) {
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
+2 -2
View File
@@ -3,13 +3,13 @@ describe("render store api container", function(){
let apiWrapper
beforeEach( function(client, done){
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(3000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
+2 -2
View File
@@ -3,13 +3,13 @@ describe("render user api container", function(){
let apiWrapper
beforeEach( function(client, done){
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
+2 -2
View File
@@ -4,7 +4,7 @@ describe("Render scheme", function () {
beforeEach(function (client, done) {
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
schemeContainer = mainPage.section.schemeContainer
@@ -12,7 +12,7 @@ describe("Render scheme", function () {
client.waitForElementVisible(".download-url-input", 5000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)
+2 -2
View File
@@ -18,7 +18,7 @@ describe("initial render", function () {
beforeEach(function (client, done) {
mainPage = client
.url(client.globals.baseUrl)
.url(client.globals.baseAppUrl)
.page.main()
topbar = mainPage.section.topbar
@@ -26,7 +26,7 @@ describe("initial render", function () {
client.waitForElementVisible(".download-url-input", 10000)
.pause(5000)
.clearValue(".download-url-input")
.setValue(".download-url-input", client.globals.baseUrl + "/test-specs/petstore.json")
.setValue(".download-url-input", client.globals.specPath)
.click("button.download-url-button")
.pause(1000)