Bladeren bron

More test + fix decodeURIComponent call

Previously I was calling decodeURIComponent on regex match result which
was an array. This fixes that and alos adds more tests
bubble
Mohsen Azimi 9 jaren geleden
bovenliggende
commit
ae4686b0dd
3 gewijzigde bestanden met toevoegingen van 31 en 4 verwijderingen
  1. +2
    -2
      dist/index.html
  2. +2
    -2
      src/main/html/index.html
  3. +27
    -0
      src/test/e2e/index.js

+ 2
- 2
dist/index.html Bestand weergeven

@@ -24,9 +24,9 @@
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
var url = decodeURIComponent(window.location.search.match(/url=([^&]+)/));
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
url = decodeURIComponent(url[1]);
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
}


+ 2
- 2
src/main/html/index.html Bestand weergeven

@@ -24,9 +24,9 @@
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
var url = decodeURIComponent(window.location.search.match(/url=([^&]+)/));
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
url = decodeURIComponent(url[1]);
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
}


+ 27
- 0
src/test/e2e/index.js Bestand weergeven

@@ -66,6 +66,33 @@ describe('basics', function (done) {
checkConsoleErrors();
});


describe('should render key elements in document', function () {
var elementQueries = [
'swagger-ui-container',
'resources_container',
'api_info',
'resource_pet',
'resource_store',
'resource_user',
'header'
];

this.timeout(10000);

elementQueries.forEach(function (id) {

it('should render element: ' + id, function (done) {

var locator = webdriver.By.id(id)
driver.isElementPresent(locator).then(function (isPresent) {
expect(isPresent).to.be.true;
done();
});
});
})
});

describe('cleanup', function () {
it('kills the static server', function () {
server.close();


Laden…
Annuleren
Opslaan