Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Dec 27, 2023
1 parent e2102ca commit ca8a8e4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
64 changes: 32 additions & 32 deletions cypress/e2e/modal-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@ import { CypressHelper } from "@shellygo/cypress-test-utils";
import ThirdPartyDriver from "./thirs-party-driver";

export default class ModalDriver {
private helper = new CypressHelper({ defaultDataAttribute: "data-wd-key" });
private thirdPartyDriver = new ThirdPartyDriver();
private helper = new CypressHelper({ defaultDataAttribute: "data-wd-key" });
private thirdPartyDriver = new ThirdPartyDriver();

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()}`;
}
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.thirdPartyDriver.get.element("input").type(layer!);
}, "add-layer.layer-source-block")
}
this.helper.when.click("add-layer");
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.thirdPartyDriver.get.element("input").type(layer!);
}, "add-layer.layer-source-block")
}
this.helper.when.click("add-layer");

return id;
},
return id;
},

open: () => {
this.helper.when.click("layer-list:add-layer");
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");
},
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");
},
}
close: (key: string) => {
this.helper.when.waitUntil(() => this.helper.get.element(key));
this.helper.when.click(key + ".close-modal");
},
}
}
34 changes: 17 additions & 17 deletions cypress/e2e/thirs-party-driver.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
export default class ThirdPartyDriver {
public given = {
/**
public given = {
/**
*
* @param url a url to a file, this assumes the file name is the last part of the url
* @param alias
*/
interceptGetToFile(url: string) {
let fileNameAndAlias = url.split('/').pop();
cy.intercept('GET', url, { fixture: fileNameAndAlias }).as(fileNameAndAlias!);
},
interceptGetToFile(url: string) {
let fileNameAndAlias = url.split('/').pop();
cy.intercept('GET', url, { fixture: fileNameAndAlias }).as(fileNameAndAlias!);
},

interceptAndIgnore(url: string) {
cy.intercept({ method: "GET", url }, []);
}
interceptAndIgnore(url: string) {
cy.intercept({ method: "GET", url }, []);
}
}

public get = {
element(slector: string) {
return cy.get(slector);
}
public get = {
element(slector: string) {
return cy.get(slector);
}
}

public when = {
confirmAlert() {
cy.on("window:confirm", () => true);
}
public when = {
confirmAlert() {
cy.on("window:confirm", () => true);
}
}
}

0 comments on commit ca8a8e4

Please sign in to comment.