mirror of
https://github.com/maputnik/editor.git
synced 2026-06-23 15:47:27 +00:00
remove left overs
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { CypressHelper } from "@shellygo/cypress-test-utils";
|
import { CypressHelper } from "@shellygo/cypress-test-utils";
|
||||||
|
|
||||||
export default class CypressWrapperDriver {
|
export default class MaputnikCypressHelper {
|
||||||
private helper = new CypressHelper({ defaultDataAttribute: "data-wd-key" });
|
private helper = new CypressHelper({ defaultDataAttribute: "data-wd-key" });
|
||||||
|
|
||||||
public given = {
|
public given = {
|
||||||
@@ -13,9 +13,6 @@ export default class CypressWrapperDriver {
|
|||||||
|
|
||||||
public when = {
|
public when = {
|
||||||
...this.helper.when,
|
...this.helper.when,
|
||||||
confirmAlert() {
|
|
||||||
cy.on("window:confirm", () => true);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public beforeAndAfter = this.helper.beforeAndAfter;
|
public beforeAndAfter = this.helper.beforeAndAfter;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { v1 as uuid } from "uuid";
|
|||||||
import { MaputnikDriver } from "./maputnik-driver";
|
import { MaputnikDriver } from "./maputnik-driver";
|
||||||
|
|
||||||
describe("layers", () => {
|
describe("layers", () => {
|
||||||
let { beforeAndAfter, get, when, should, then } = new MaputnikDriver();
|
let { beforeAndAfter, get, when, then } = new MaputnikDriver();
|
||||||
beforeAndAfter();
|
beforeAndAfter();
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
when.setStyle("both");
|
when.setStyle("both");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CypressHelper } from "@shellygo/cypress-test-utils";
|
import { CypressHelper } from "@shellygo/cypress-test-utils";
|
||||||
import { Assertable, then } from "@shellygo/cypress-test-utils/assertable";
|
import { Assertable, then } from "@shellygo/cypress-test-utils/assertable";
|
||||||
import CypressWrapperDriver from "./cypress-wrapper-driver";
|
import MaputnikCypressHelper from "./cypress-wrapper-driver";
|
||||||
import ModalDriver from "./modal-driver";
|
import ModalDriver from "./modal-driver";
|
||||||
const baseUrl = "http://localhost:8888/";
|
const baseUrl = "http://localhost:8888/";
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export class MaputnikAssertable<T> extends Assertable<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MaputnikDriver {
|
export class MaputnikDriver {
|
||||||
private helper = new CypressWrapperDriver();
|
private helper = new MaputnikCypressHelper();
|
||||||
private modalDriver = new ModalDriver();
|
private modalDriver = new ModalDriver();
|
||||||
|
|
||||||
public beforeAndAfter = () => {
|
public beforeAndAfter = () => {
|
||||||
@@ -126,7 +126,7 @@ export class MaputnikDriver {
|
|||||||
}
|
}
|
||||||
this.helper.when.visit(baseUrl + url);
|
this.helper.when.visit(baseUrl + url);
|
||||||
if (styleProperties) {
|
if (styleProperties) {
|
||||||
this.helper.when.confirmAlert();
|
this.helper.when.acceptConfirm();
|
||||||
}
|
}
|
||||||
// when methods should not include assertions
|
// when methods should not include assertions
|
||||||
this.helper.get.elementByTestId("toolbar:link").should("be.visible");
|
this.helper.get.elementByTestId("toolbar:link").should("be.visible");
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import { v1 as uuid } from "uuid";
|
import { v1 as uuid } from "uuid";
|
||||||
import CypressWrapperDriver from "./cypress-wrapper-driver";
|
import MaputnikCypressHelper from "./cypress-wrapper-driver";
|
||||||
|
|
||||||
export default class ModalDriver {
|
export default class ModalDriver {
|
||||||
private helper = new CypressWrapperDriver();
|
private helper = new MaputnikCypressHelper();
|
||||||
|
|
||||||
public when = {
|
public when = {
|
||||||
fillLayers: (opts: { type: string; layer?: string; id?: string }) => {
|
fillLayers: (opts: { type: string; layer?: string; id?: string }) => {
|
||||||
|
// Having logic in test code is an anti pattern.
|
||||||
|
// This should be splitted to multiple single responsibility functions
|
||||||
let type = opts.type;
|
let type = opts.type;
|
||||||
let layer = opts.layer;
|
let layer = opts.layer;
|
||||||
let id;
|
let id;
|
||||||
|
|||||||
Reference in New Issue
Block a user