2018-01-10 14:19:34 +01:00
|
|
|
var wd = require("../wd-helper");
|
|
|
|
var uuid = require('uuid/v1');
|
|
|
|
var geoServer = require("../geojson-server");
|
|
|
|
|
|
|
|
|
|
|
|
var geoserver = geoServer.listen(9002);
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getStyleUrl: function(styles) {
|
|
|
|
var port = geoserver.address().port;
|
|
|
|
return "http://localhost:"+port+"/styles/empty/"+styles.join(",");
|
|
|
|
},
|
|
|
|
getGeoServerUrl: function(urlPath) {
|
|
|
|
var port = geoserver.address().port;
|
|
|
|
return "http://localhost:"+port+"/"+urlPath;
|
|
|
|
},
|
|
|
|
getStyleStore: function(browser) {
|
|
|
|
var result = browser.executeAsync(function(done) {
|
|
|
|
window.debug.get("maputnik", "styleStore").latestStyle(done);
|
|
|
|
})
|
2019-06-08 07:19:18 +02:00
|
|
|
return result;
|
2018-01-10 14:19:34 +01:00
|
|
|
},
|
|
|
|
getRevisionStore: function(browser) {
|
|
|
|
var result = browser.execute(function(done) {
|
|
|
|
var rs = window.debug.get("maputnik", "revisionStore")
|
|
|
|
|
|
|
|
return {
|
|
|
|
currentIdx: rs.currentIdx,
|
|
|
|
revisions: rs.revisions
|
|
|
|
};
|
|
|
|
})
|
|
|
|
return result.value;
|
|
|
|
},
|
|
|
|
modal: {
|
|
|
|
addLayer: {
|
|
|
|
open: function() {
|
2019-06-08 07:19:18 +02:00
|
|
|
const selector = $(wd.$('layer-list:add-layer'));
|
|
|
|
selector.click();
|
2018-01-10 14:19:34 +01:00
|
|
|
|
|
|
|
// Wait for events
|
|
|
|
browser.flushReactUpdates();
|
|
|
|
|
2019-06-08 07:19:18 +02:00
|
|
|
const elem = $(wd.$('modal:add-layer'));
|
|
|
|
elem.waitForExist();
|
|
|
|
elem.isDisplayed();
|
|
|
|
elem.isDisplayedInViewport();
|
2018-01-10 14:19:34 +01:00
|
|
|
|
|
|
|
// Wait for events
|
|
|
|
browser.flushReactUpdates();
|
|
|
|
},
|
|
|
|
fill: function(opts) {
|
|
|
|
var type = opts.type;
|
|
|
|
var layer = opts.layer;
|
|
|
|
var id;
|
|
|
|
if(opts.id) {
|
|
|
|
id = opts.id
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
id = type+":"+uuid();
|
|
|
|
}
|
|
|
|
|
2019-06-08 07:19:18 +02:00
|
|
|
const selectBox = $(wd.$("add-layer.layer-type", "select"));
|
|
|
|
selectBox.selectByAttribute('value', type);
|
2018-01-10 14:19:34 +01:00
|
|
|
browser.flushReactUpdates();
|
|
|
|
|
|
|
|
browser.setValueSafe(wd.$("add-layer.layer-id", "input"), id);
|
|
|
|
if(layer) {
|
|
|
|
browser.setValueSafe(wd.$("add-layer.layer-source-block", "input"), layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
browser.flushReactUpdates();
|
2019-06-08 07:19:18 +02:00
|
|
|
const elem_addLayer = $(wd.$("add-layer"));
|
|
|
|
elem_addLayer.click();
|
2018-01-10 14:19:34 +01:00
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|