mirror of
https://github.com/maputnik/editor.git
synced 2025-12-27 16:40:00 +00:00
Update tests for WebdriverIO v5
This commit is contained in:
@@ -7,14 +7,16 @@ var helper = require("../helper");
|
||||
|
||||
function closeModal(wdKey) {
|
||||
browser.waitUntil(function() {
|
||||
return browser.isVisibleWithinViewport(wd.$(wdKey));
|
||||
const elem = $(wdKey);
|
||||
return elem.isDisplayedInViewport();
|
||||
});
|
||||
|
||||
var closeBtnSelector = wd.$(wdKey+".close-modal");
|
||||
browser.click(closeBtnSelector);
|
||||
const closeBtnSelector = $(wd.$(wdKey+".close-modal"));
|
||||
closeBtnSelector.click();
|
||||
|
||||
browser.waitUntil(function() {
|
||||
return !browser.isVisibleWithinViewport(wd.$(wdKey));
|
||||
const elem = $(wdKey);
|
||||
return !elem.isDisplayed();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,10 +28,12 @@ describe("modals", function() {
|
||||
beforeEach(function() {
|
||||
browser.url(config.baseUrl+"?debug");
|
||||
|
||||
browser.waitForExist(".maputnik-toolbar-link");
|
||||
const elem = $(".maputnik-toolbar-link");
|
||||
elem.waitForExist();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
browser.click(wd.$("nav:open"))
|
||||
const elem2 = $(wd.$("nav:open"));
|
||||
elem2.click();
|
||||
browser.flushReactUpdates();
|
||||
});
|
||||
|
||||
@@ -38,7 +42,8 @@ describe("modals", function() {
|
||||
});
|
||||
|
||||
it("upload", function() {
|
||||
browser.waitForExist("*[type='file']")
|
||||
const elem = $("*[type='file']");
|
||||
elem.waitForExist();
|
||||
browser.chooseFile("*[type='file']", styleFilePath);
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -50,8 +55,8 @@ describe("modals", function() {
|
||||
|
||||
browser.setValueSafe(wd.$("open-modal.url.input"), styleFileUrl);
|
||||
|
||||
var selector = wd.$("open-modal.url.button");
|
||||
browser.click(selector);
|
||||
const selector = $(wd.$("open-modal.url.button"));
|
||||
selector.click();
|
||||
|
||||
// Allow the network request to happen
|
||||
// NOTE: Its localhost so this should be fast.
|
||||
@@ -70,10 +75,12 @@ describe("modals", function() {
|
||||
beforeEach(function() {
|
||||
browser.url(config.baseUrl+"?debug");
|
||||
|
||||
browser.waitForExist(".maputnik-toolbar-link");
|
||||
const elem = $(".maputnik-toolbar-link");
|
||||
elem.waitForExist();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
browser.click(wd.$("nav:export"))
|
||||
const elem2 = $(wd.$("nav:export"));
|
||||
elem2.click();
|
||||
browser.flushReactUpdates();
|
||||
});
|
||||
|
||||
@@ -99,9 +106,10 @@ describe("modals", function() {
|
||||
browser.url(config.baseUrl+"?debug&style="+helper.getStyleUrl([
|
||||
"geojson:example"
|
||||
]));
|
||||
browser.alertAccept();
|
||||
browser.acceptAlert();
|
||||
|
||||
browser.selectByValue(wd.$("nav:inspect", "select"), "inspect");
|
||||
const selectBox = $(wd.$("nav:inspect", "select"));
|
||||
selectBox.selectByAttribute('value', "inspect");
|
||||
})
|
||||
})
|
||||
|
||||
@@ -109,16 +117,19 @@ describe("modals", function() {
|
||||
beforeEach(function() {
|
||||
browser.url(config.baseUrl+"?debug");
|
||||
|
||||
browser.waitForExist(".maputnik-toolbar-link");
|
||||
const elem = $(".maputnik-toolbar-link");
|
||||
elem.waitForExist();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
browser.click(wd.$("nav:settings"))
|
||||
const elem2 = $(wd.$("nav:settings"));
|
||||
elem2.click();
|
||||
browser.flushReactUpdates();
|
||||
});
|
||||
|
||||
it("name", function() {
|
||||
browser.setValueSafe(wd.$("modal-settings.name"), "foobar")
|
||||
browser.click(wd.$("modal-settings.owner"))
|
||||
const elem = $(wd.$("modal-settings.owner"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -126,7 +137,8 @@ describe("modals", function() {
|
||||
})
|
||||
it("owner", function() {
|
||||
browser.setValueSafe(wd.$("modal-settings.owner"), "foobar")
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -134,7 +146,8 @@ describe("modals", function() {
|
||||
})
|
||||
it("sprite url", function() {
|
||||
browser.setValueSafe(wd.$("modal-settings.sprite"), "http://example.com")
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -143,7 +156,8 @@ describe("modals", function() {
|
||||
it("glyphs url", function() {
|
||||
var glyphsUrl = "http://example.com/{fontstack}/{range}.pbf"
|
||||
browser.setValueSafe(wd.$("modal-settings.glyphs"), glyphsUrl)
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -153,7 +167,8 @@ describe("modals", function() {
|
||||
it("mapbox access token", function() {
|
||||
var apiKey = "testing123";
|
||||
browser.setValueSafe(wd.$("modal-settings.maputnik:mapbox_access_token"), apiKey);
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -165,7 +180,8 @@ describe("modals", function() {
|
||||
it("maptiler access token", function() {
|
||||
var apiKey = "testing123";
|
||||
browser.setValueSafe(wd.$("modal-settings.maputnik:openmaptiles_access_token"), apiKey);
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -175,7 +191,8 @@ describe("modals", function() {
|
||||
it("thunderforest access token", function() {
|
||||
var apiKey = "testing123";
|
||||
browser.setValueSafe(wd.$("modal-settings.maputnik:thunderforest_access_token"), apiKey);
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
@@ -183,9 +200,10 @@ describe("modals", function() {
|
||||
})
|
||||
|
||||
it("style renderer", function() {
|
||||
var selector = wd.$("modal-settings.maputnik:renderer");
|
||||
browser.selectByValue(selector, "ol");
|
||||
browser.click(wd.$("modal-settings.name"))
|
||||
const selector = $(wd.$("modal-settings.maputnik:renderer"));
|
||||
selector.selectByAttribute('value', "ol");
|
||||
const elem = $(wd.$("modal-settings.name"));
|
||||
elem.click();
|
||||
browser.flushReactUpdates();
|
||||
|
||||
var styleObj = helper.getStyleStore(browser);
|
||||
|
||||
Reference in New Issue
Block a user