I have created one interface and implements it to create a city information with different parameters. I have implemented method definition with cypress code and asserting it in various function as given in the code.
when I execute the code and function is called
assertTC1Func(state:string, city:string: add:string: phone:string)
,
it also tries to interact with the parameter those are not pssed in the function (i.e add2, phone2 & street), what I am doing wrong here in my code?
interface CreateCityInterface{
state:string;
city:string;
add:string;
phone:string;
add2?:string;
phone2?:string;
street?:string;
enterdata(state: string, city: string, add: string, phone: string, add2: string, phone2: string, street: string): void;
enterdata(state: string, city: string, add: string, phone: string): void;
enterData(state: string, city: string): void;
}
class State extends Country implements CreateCityInterface{
state:string;
city:string;
add:string;
phone:string;
add2?:string;
phone2?:string;
street?:string;
enterData(state: string, city: string, add: string, phone: string, add2: string, phone2: string, street: string): void;
enterdata(state: string, city: string, add: string, phone: string): void;
enterData(state: string, city: string): void;
enterData(state: string, city: string, add?: string, phone?: string, add2?: string, phone2?: string, street?: string): void;
{
cy.wait(500);
this.createCityEle.state().contains(state).click();
this.createCityEle.city().type(city);
this.createCityEle.add().type(add)
this.createCityEle.phone().type(phone);
this.createCityEle.add2().type(add2);
this.createCityEle.phone2().type(phone2)
this.createCityEle.street().type(street);
}
assertTC1Func(state:string, city:string: add:string: phone:string){
this.enterData(state, city, add, phone)
//some code
}
assertTC2Func(state:String: city:String){
this.enterData(state, city)
//some code
}
assertTC3Func(state:string, city:string: add:string: phone:string, add2:string, phone2:string: street:string){
this.enterData(state, city, add, phone, add2, phone2, street)
//some code
}
}