remove left overs

This commit is contained in:
shelly_goldblit
2023-12-31 20:47:10 +02:00
parent 2213e74e2a
commit fa2dfa7480
4 changed files with 9 additions and 10 deletions
+1 -4
View File
@@ -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;
+1 -1
View File
@@ -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");
+3 -3
View File
@@ -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");
+4 -2
View File
@@ -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;