Modify test running script, rewrite some test based on local son
This commit is contained in:
@@ -32,14 +32,13 @@
|
|||||||
"test-in-node": "npm run lint-errors && npm run just-test-in-node",
|
"test-in-node": "npm run lint-errors && npm run just-test-in-node",
|
||||||
"just-test": "karma start --config karma.conf.js",
|
"just-test": "karma start --config karma.conf.js",
|
||||||
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package",
|
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package",
|
||||||
"e2e": "sleep 3 && nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json",
|
"test-e2e": "sleep 3 && nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json",
|
||||||
"e2e-initial-render": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --group initial-render",
|
"test-e2e-initial-render": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --group initial-render",
|
||||||
"mock:api": "json-server --watch test/e2e/db.json --port 3204",
|
"mock-api": "json-server --watch test/e2e/db.json --port 3204",
|
||||||
"e2e-flow": "npm-run-all --parallel -r hot-server mock:api e2e"
|
"e2e-flow": "npm-run-all --parallel -r hot-server mock-api test-e2e"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base64-js": "^1.2.0",
|
"base64-js": "^1.2.0",
|
||||||
"brace": "0.10.0",
|
|
||||||
"deep-extend": "0.4.1",
|
"deep-extend": "0.4.1",
|
||||||
"expect": "1.20.2",
|
"expect": "1.20.2",
|
||||||
"getbase": "^3.4.2",
|
"getbase": "^3.4.2",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
describe("initial render", function () {
|
describe("initial render", function () {
|
||||||
let mainPage
|
let mainPage
|
||||||
|
|
||||||
|
|
||||||
describe("for topbar", function () {
|
describe("for topbar", function () {
|
||||||
let topbar
|
let topbar
|
||||||
before(function (client, done) {
|
before(function (client, done) {
|
||||||
@@ -21,19 +22,25 @@ describe("initial render", function () {
|
|||||||
mainPage = client
|
mainPage = client
|
||||||
.url("localhost:3200")
|
.url("localhost:3200")
|
||||||
.page.main()
|
.page.main()
|
||||||
|
|
||||||
topbar = mainPage.section.topbar
|
topbar = mainPage.section.topbar
|
||||||
|
|
||||||
|
client.waitForElementVisible('.download-url-input', 5000)
|
||||||
|
.pause(1000)
|
||||||
|
.clearValue('.download-url-input')
|
||||||
|
.setValue('.download-url-input', 'http://localhost:3200/test-specs/1.json')
|
||||||
|
.click('button.download-url-button')
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("renders section", function (client) {
|
it("renders section", function (client) {
|
||||||
mainPage.expect.section("@topbar").to.be.visible
|
mainPage.expect.section("@topbar").to.be.visible
|
||||||
|
|
||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("renders input box", function (client) {
|
it("renders input box", function (client) {
|
||||||
topbar.expect.element("@inputBox").to.be.visible
|
topbar.expect.element("@inputBox").to.be.visible
|
||||||
|
|
||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -45,13 +52,20 @@ describe("initial render", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("for information", function () {
|
describe("for information", function () {
|
||||||
let informationContainer
|
let informationContainer, topbar
|
||||||
beforeEach(function (client, done) {
|
beforeEach(function (client, done) {
|
||||||
|
|
||||||
mainPage = client
|
mainPage = client
|
||||||
.url("localhost:3200")
|
.url("localhost:3200")
|
||||||
.page.main()
|
.page.main()
|
||||||
|
client.waitForElementVisible('.download-url-input', 5000)
|
||||||
|
.pause(1000)
|
||||||
|
.clearValue('.download-url-input')
|
||||||
|
.setValue('.download-url-input', 'http://localhost:3200/test-specs/1.json')
|
||||||
|
.click('button.download-url-button')
|
||||||
|
|
||||||
informationContainer = mainPage.section.informationContainer
|
informationContainer = mainPage.section.informationContainer
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -71,15 +85,15 @@ describe("initial render", function () {
|
|||||||
|
|
||||||
it("renders base url", function (client) {
|
it("renders base url", function (client) {
|
||||||
informationContainer.waitForElementVisible("@baseUrl", 5000)
|
informationContainer.waitForElementVisible("@baseUrl", 5000)
|
||||||
.assert.containsText("@baseUrl", "[ Base url: petstore.swagger.io/v2]")
|
.assert.containsText("@baseUrl", "[ Base url: localhost:3204/]")
|
||||||
|
|
||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("render main url", function (client) {
|
it("render main url", function (client) {
|
||||||
informationContainer.waitForElementVisible("@mainUrl", 5000)
|
informationContainer.waitForElementVisible("@mainUrl", 5000)
|
||||||
.assert.attributeEquals("@mainUrl", "href", "http://petstore.swagger.io/v2/swagger.json")
|
.assert.attributeEquals("@mainUrl", "href", "http://localhost:3200/test-specs/1.json")
|
||||||
.assert.containsText("@mainUrlContent", "http://petstore.swagger.io/v2/swagger.json")
|
.assert.containsText("@mainUrlContent", "http://localhost:3200/test-specs/1.json")
|
||||||
|
|
||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
@@ -125,7 +139,6 @@ describe("initial render", function () {
|
|||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("for scheme", function () {
|
describe("for scheme", function () {
|
||||||
let schemeContainer
|
let schemeContainer
|
||||||
beforeEach(function (client, done) {
|
beforeEach(function (client, done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user