mirror of
https://github.com/maputnik/editor.git
synced 2026-07-18 03:47:27 +00:00
E2E: Improve tests, lint, and add more drivers (#855)
This PR introduces lint to cypress code, adds drivers to try and abstract the usage of cypress as much as possible. Nothing very interesting, mainly to try out the driver pattern for the e2e tests.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { v1 as uuid } from "uuid";
|
||||
import CypressWrapperDriver from "./cypress-wrapper-driver";
|
||||
|
||||
export default class ModalDriver {
|
||||
private helper = new CypressWrapperDriver();
|
||||
|
||||
public when = {
|
||||
fillLayers: (opts: {type: string, layer?: string, id?: string}) => {
|
||||
let type = opts.type;
|
||||
let layer = opts.layer;
|
||||
let id;
|
||||
if (opts.id) {
|
||||
id = opts.id;
|
||||
} else {
|
||||
id = `${type}:${uuid()}`;
|
||||
}
|
||||
|
||||
this.helper.get.element("add-layer.layer-type.select").select(type);
|
||||
this.helper.get.element("add-layer.layer-id.input").type(id);
|
||||
if (layer) {
|
||||
this.helper.when.within(() => {
|
||||
this.helper.get.elementByClassOrType("input").type(layer!);
|
||||
}, "add-layer.layer-source-block")
|
||||
}
|
||||
this.helper.when.click("add-layer");
|
||||
|
||||
return id;
|
||||
},
|
||||
|
||||
open: () => {
|
||||
this.helper.when.click("layer-list:add-layer");
|
||||
|
||||
this.helper.get.element("modal:add-layer").should("exist");
|
||||
this.helper.get.element("modal:add-layer").should("be.visible");
|
||||
},
|
||||
|
||||
close: (key: string) => {
|
||||
this.helper.when.waitUntil(() => this.helper.get.element(key));
|
||||
this.helper.when.click(key + ".close-modal");
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user